/* ==========================================================================
   DISEÑO DE SISTEMA Y VARIABLES
   ========================================================================== */

:root {
  /* Paleta de colores HSL premium */
  --bg-primary: hsl(240, 25%, 7%);
  --bg-secondary: hsl(240, 20%, 11%);
  --bg-card: hsla(240, 20%, 15%, 0.65);
  --border-color: hsla(240, 15%, 25%, 0.4);
  
  --text-primary: hsl(0, 0%, 96%);
  --text-secondary: hsl(240, 10%, 70%);
  --text-muted: hsl(240, 8%, 50%);
  
  /* Gradientes dinámicos y vibrantes */
  --accent-gradient: linear-gradient(135deg, hsl(275, 90%, 60%), hsl(195, 95%, 50%));
  --accent-gradient-hover: linear-gradient(135deg, hsl(275, 95%, 65%), hsl(195, 100%, 55%));
  --danger-gradient: linear-gradient(135deg, hsl(355, 80%, 55%), hsl(340, 85%, 45%));
  --success-gradient: linear-gradient(135deg, hsl(145, 75%, 45%), hsl(160, 80%, 40%));
  
  /* Efectos visuales de sombreado y desenfoque */
  --card-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.4);
  --glow-shadow: 0 0 15px hsla(195, 95%, 50%, 0.25);
  --glass-blur: blur(14px);
  --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --border-radius: 16px;
}

/* Reset de estilos globales */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  overflow-x: hidden;
  background-image: 
    radial-gradient(at 10% 20%, hsla(280, 80%, 40%, 0.12) 0px, transparent 50%),
    radial-gradient(at 90% 80%, hsla(190, 80%, 40%, 0.12) 0px, transparent 50%);
  background-attachment: fixed;
}

/* ==========================================================================
   ESTRUCTURA DE DISEÑO (LAYOUT)
   ========================================================================== */

.app-container {
  display: flex;
  width: 100%;
  max-width: 1600px;
  margin: 0 auto;
  min-height: 100vh;
  padding: 24px;
  gap: 24px;
}

/* Barra lateral de navegación e información */
.sidebar {
  width: 340px;
  flex-shrink: 0;
  background: var(--bg-card);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: 32px 24px;
  display: flex;
  flex-direction: column;
  gap: 32px;
  box-shadow: var(--card-shadow);
  height: calc(100vh - 48px);
  position: sticky;
  top: 24px;
}

/* Contenido de información principal */
.main-content {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  gap: 24px;
  min-width: 0; /* Evita que la tabla rompa el contenedor */
}

/* ==========================================================================
   COMPONENTES DE LA BARRA LATERAL
   ========================================================================== */

.logo-area {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-icon {
  width: 36px;
  height: 36px;
  stroke: url(#logo-grad); /* Usando gradiente si existiera, o color dinámico */
  color: hsl(195, 95%, 50%);
  filter: drop-shadow(0 0 4px hsla(195, 95%, 50%, 0.5));
}

.logo-area h1 {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.5px;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.tagline {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* Tarjeta de control de cuotas */
.quota-card {
  background: hsla(240, 15%, 5%, 0.5);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.quota-card h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.quota-bar-container {
  height: 8px;
  background-color: var(--bg-secondary);
  border-radius: 4px;
  overflow: hidden;
}

.quota-bar {
  height: 100%;
  background: var(--accent-gradient);
  border-radius: 4px;
  transition: width var(--transition-normal);
}

.quota-info {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
}

.quota-percentage {
  font-size: 13px;
  color: hsl(195, 95%, 50%);
  font-weight: 600;
  align-self: flex-end;
}

/* Tarjeta informativa de seguridad */
.security-card {
  background: hsla(240, 15%, 5%, 0.3);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: auto; /* Empuja el contenedor al fondo de la barra lateral */
}

.security-card h4 {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.security-card ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.security-card li {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--text-secondary);
}

.check-icon {
  width: 16px;
  height: 16px;
  color: hsl(145, 75%, 45%);
}

/* ==========================================================================
   SECCIÓN DE CARGA DE ARCHIVOS (DROPZONE)
   ========================================================================== */

.upload-section {
  background: var(--bg-card);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: 24px;
  box-shadow: var(--card-shadow);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.dropzone {
  border: 2px dashed hsla(240, 15%, 35%, 0.6);
  border-radius: 12px;
  padding: 40px 20px;
  text-align: center;
  position: relative;
  cursor: pointer;
  background: hsla(240, 20%, 8%, 0.3);
  transition: all var(--transition-normal);
  display: flex;
  justify-content: center;
  align-items: center;
}

.dropzone:hover, .dropzone.dragover {
  border-color: hsl(195, 95%, 50%);
  background: hsla(195, 95%, 50%, 0.04);
  box-shadow: var(--glow-shadow);
}

.file-input {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.dropzone-content {
  pointer-events: none; /* Permite que el clic pase a través del input */
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.upload-icon-wrapper {
  width: 64px;
  height: 64px;
  background: hsla(240, 15%, 15%, 0.8);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-color);
  margin-bottom: 8px;
  transition: transform var(--transition-fast);
}

.dropzone:hover .upload-icon-wrapper {
  transform: translateY(-4px);
  border-color: hsl(195, 95%, 50%);
  color: hsl(195, 95%, 50%);
}

.upload-cloud-icon {
  width: 32px;
  height: 32px;
  color: var(--text-secondary);
  transition: color var(--transition-fast);
}

.dropzone:hover .upload-cloud-icon {
  color: hsl(195, 95%, 50%);
}

.dropzone h2 {
  font-size: 18px;
  font-weight: 600;
}

.dropzone p {
  font-size: 14px;
  color: var(--text-secondary);
}

.file-limit-note {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Barra de progreso de carga activa */
.upload-progress-container {
  background: hsla(240, 15%, 5%, 0.5);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: all var(--transition-normal);
}

.progress-header {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 500;
}

#uploading-filename {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 75%;
}

.progress-bar-wrapper {
  height: 6px;
  background-color: var(--bg-secondary);
  border-radius: 3px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: var(--accent-gradient);
  transition: width 0.1s linear;
}

.hidden {
  display: none !important;
}

/* ==========================================================================
   SECCIÓN DE ARCHIVOS (TABLA)
   ========================================================================== */

.files-section {
  background: var(--bg-card);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: 24px;
  box-shadow: var(--card-shadow);
  display: flex;
  flex-direction: column;
  gap: 20px;
  flex-grow: 1;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.section-header h2 {
  font-size: 20px;
  font-weight: 700;
}

.table-container {
  width: 100%;
  overflow-x: auto;
  background: hsla(240, 15%, 5%, 0.3);
  border-radius: 12px;
  border: 1px solid var(--border-color);
}

table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 14px;
}

th, td {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
}

th {
  background: hsla(240, 15%, 5%, 0.6);
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  font-size: 12px;
  letter-spacing: 0.5px;
}

tr:last-child td {
  border-bottom: none;
}

tbody tr {
  transition: background-color var(--transition-fast);
}

tbody tr:hover {
  background-color: hsla(240, 15%, 20%, 0.25);
}

/* Columna de acciones y botones */
.actions-col {
  text-align: right;
  width: 280px;
}

.action-buttons {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

/* Estado de tabla vacía */
.empty-state td {
  padding: 60px 0;
  text-align: center;
}

.empty-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  color: var(--text-secondary);
}

.empty-folder-icon {
  width: 48px;
  height: 48px;
  color: var(--text-muted);
}

/* ==========================================================================
   BOTONES Y ELEMENTOS DE ACCIÓN
   ========================================================================== */

.btn-primary, .btn-secondary, .btn-danger, .btn-action {
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all var(--transition-fast);
}

.btn-primary {
  background: var(--accent-gradient);
  color: var(--text-primary);
}

.btn-primary:hover {
  background: var(--accent-gradient-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px hsla(195, 95%, 50%, 0.25);
}

.btn-secondary {
  background: hsla(240, 15%, 20%, 0.7);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background: hsla(240, 15%, 25%, 0.9);
  border-color: var(--text-secondary);
}

.btn-danger {
  background: var(--danger-gradient);
  color: var(--text-primary);
}

.btn-danger:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px hsla(355, 80%, 55%, 0.25);
}

/* Botones específicos de acciones sobre archivos */
.btn-action {
  padding: 6px 12px;
  font-size: 12px;
}

.icon {
  width: 14px;
  height: 14px;
}

/* ==========================================================================
   MODALES (POPUPS)
   ========================================================================== */

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  transition: opacity var(--transition-normal);
}

.modal-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  width: 500px;
  max-width: 90%;
  box-shadow: var(--card-shadow);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  animation: modalIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes modalIn {
  from {
    transform: translateY(20px) scale(0.95);
    opacity: 0;
  }
  to {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h3 {
  font-size: 18px;
  font-weight: 700;
}

.close-btn {
  background: none;
  border: none;
  font-size: 24px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: color var(--transition-fast);
}

.close-btn:hover {
  color: var(--text-primary);
}

.modal-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.modal-body p {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.share-input-wrapper {
  display: flex;
  gap: 8px;
}

.share-input-wrapper input {
  flex-grow: 1;
  background: hsla(240, 15%, 5%, 0.6);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 10px 14px;
  color: var(--text-primary);
  font-family: monospace;
  font-size: 13px;
  outline: none;
}

.share-input-wrapper input:focus {
  border-color: hsl(195, 95%, 50%);
}

/* ==========================================================================
   SISTEMA DE TOASTS (NOTIFICACIONES FLOTANTES)
   ========================================================================== */

.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 1000;
}

.toast {
  background: hsla(240, 20%, 15%, 0.9);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 12px 20px;
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: var(--card-shadow);
  transform: translateX(120%);
  animation: toastIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  backdrop-filter: var(--glass-blur);
}

.toast.success {
  border-left: 4px solid hsl(145, 75%, 45%);
}

.toast.error {
  border-left: 4px solid hsl(355, 80%, 55%);
}

.toast.info {
  border-left: 4px solid hsl(195, 95%, 50%);
}

@keyframes toastIn {
  to {
    transform: translateX(0);
  }
}

.toast.fade-out {
  animation: toastOut 0.3s ease-in forwards;
}

@keyframes toastOut {
  to {
    opacity: 0;
    transform: translateY(10px) scale(0.9);
  }
}

/* ==========================================================================
   RESPONSIVIDAD
   ========================================================================== */

@media (max-width: 1024px) {
  .app-container {
    flex-direction: column;
    padding: 16px;
  }
  
  .sidebar {
    width: 100%;
    height: auto;
    position: static;
  }
}
