/* ===== VARIABLES CSS ===== */
:root {
  --primary-color: #6366f1;
  --primary-dark: #4f46e5;
  --secondary-color: #8b5cf6;
  --background-color: #f8fafc;
  --surface-color: #ffffff;
  --surface-hover: #f1f5f9;
  --border-color: #e2e8f0;
  --text-primary: #1e293b;
  --text-secondary: #64748b;
  --text-muted: #94a3b8;
  --success-color: #10b981;
  --danger-color: #ef4444;
  --warning-color: #f59e0b;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
}

/* ===== RESET Y BASE ===== */
* {
  box-sizing: border-box;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: linear-gradient(135deg, var(--background-color) 0%, #e2e8f0 100%);
  min-height: 100vh;
  margin: 0;
  color: var(--text-primary);
  line-height: 1.6;
}

.container-main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
}

/* ===== NAVBAR ===== */
.navbar {
  background: linear-gradient(135deg, #1e293b 0%, #334155 100%) !important;
  box-shadow: var(--shadow-md);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
}

.navbar-brand {
  font-weight: 700;
  font-size: 1.5rem;
  background: linear-gradient(135deg, #f8fafc 0%, #cbd5e1 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-decoration: none !important;
  transition: all 0.3s ease;
}

.navbar-brand:hover {
  transform: translateY(-1px);
}

.top-controls {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.top-controls .btn {
  font-weight: 500;
  transition: all 0.3s ease;
  border: none;
  position: relative;
  overflow: hidden;
}

.top-controls .btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.top-controls .btn-success {
  background: linear-gradient(135deg, var(--success-color) 0%, #059669 100%);
}

.top-controls .btn-outline-light {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(10px);
}

.top-controls .btn-outline-light:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.3);
}

/* ===== PIZARRA Y NOTAS ===== */
.pizarra {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
  margin: 2rem 0;
}

.nota-card {
  background: var(--surface-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border-color);
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.nota-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
}

.nota-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-xl);
  border-color: var(--primary-color);
}

.nota-textarea {
  width: 100%;
  min-height: 150px;
  padding: 1.5rem;
  border: none;
  background: transparent;
  resize: vertical;
  font-family: inherit;
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--text-primary);
  transition: all 0.3s ease;
}

.nota-textarea:focus {
  outline: none;
  background: var(--surface-hover);
}

.nota-textarea::placeholder {
  color: var(--text-muted);
}

.nota-actions {
  padding: 1rem 1.5rem;
  background: var(--surface-hover);
  border-top: 1px solid var(--border-color);
  display: flex;
  gap: 0.75rem;
}

.btn-copy, .btn-delete {
  padding: 0.5rem 1rem;
  border: none;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.btn-copy {
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
  color: white;
}

.btn-copy:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-delete {
  background: linear-gradient(135deg, var(--danger-color) 0%, #dc2626 100%);
  color: white;
}

.btn-delete:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

/* ===== ARCHIVOS ===== */
.files-wrap {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
  margin: 2rem 0;
}

.file-card {
  background: var(--surface-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border-color);
  transition: all 0.3s ease;
  overflow: hidden;
  position: relative;
}

.file-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(135deg, var(--secondary-color) 0%, var(--primary-color) 100%);
}

.file-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-xl);
  border-color: var(--secondary-color);
}

.file-header {
  padding: 1rem 1.25rem;
  background: var(--surface-hover);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.file-header i {
  font-size: 1.25rem;
  color: var(--secondary-color);
}

.file-name {
  font-weight: 500;
  color: var(--text-primary);
  font-size: 0.9rem;
  word-break: break-word;
}

.file-preview {
  padding: 1.25rem;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 180px;
  background: #fafbfc;
}

.file-preview img {
  max-width: 100%;
  max-height: 160px;
  border-radius: var(--radius-md);
  object-fit: cover;
  box-shadow: var(--shadow-sm);
}

.file-preview video,
.file-preview audio {
  max-width: 100%;
  border-radius: var(--radius-md);
}

.file-preview iframe {
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.file-icon-large {
  font-size: 3rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
}

.file-actions {
  padding: 1rem 1.25rem;
  background: var(--surface-hover);
  border-top: 1px solid var(--border-color);
  display: flex;
  gap: 0.75rem;
}

.btn-file-open,
.btn-delete-file {
  padding: 0.5rem 1rem;
  border: none;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-file-open {
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
  color: white;
}

.btn-file-open:hover {
  color: white;
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-delete-file {
  background: linear-gradient(135deg, var(--danger-color) 0%, #dc2626 100%);
  color: white;
}

.btn-delete-file:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

/* ===== TÍTULOS Y TEXTO ===== */
h5 {
  color: var(--text-primary);
  font-weight: 600;
  font-size: 1.5rem;
  margin-bottom: 1.5rem;
  position: relative;
  padding-left: 1rem;
}

h5::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 60%;
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
  border-radius: 2px;
}

hr {
  border: none;
  height: 1px;
  background: linear-gradient(90deg, transparent 0%, var(--border-color) 50%, transparent 100%);
  margin: 2rem 0 !important;
}

/* ===== ANIMACIONES ===== */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.nota-card,
.file-card {
  animation: fadeIn 0.6s ease-out;
}

/* ===== RESPONSIVO ===== */
@media (max-width: 768px) {
  .container-main {
    padding: 0 0.75rem;
  }

  .pizarra {
    grid-template-columns: 1fr;
    gap: 1rem;
    margin: 1.5rem 0;
  }

  .files-wrap {
    grid-template-columns: 1fr;
    gap: 1rem;
    margin: 1.5rem 0;
  }

  .top-controls {
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .top-controls .btn {
    font-size: 0.8rem;
    padding: 0.4rem 0.8rem;
  }

  .nota-textarea {
    min-height: 120px;
    padding: 1rem;
    font-size: 0.9rem;
  }

  .nota-actions,
  .file-actions {
    padding: 0.75rem 1rem;
    flex-wrap: wrap;
  }

  .file-preview {
    padding: 1rem;
    min-height: 140px;
  }

  .file-preview img {
    max-height: 120px;
  }

  h5 {
    font-size: 1.25rem;
    margin-bottom: 1rem;
  }
}

@media (max-width: 480px) {
  .navbar-brand {
    font-size: 1.25rem;
  }

  .nota-actions,
  .file-actions {
    flex-direction: column;
  }

  .btn-copy,
  .btn-delete,
  .btn-file-open,
  .btn-delete-file {
    width: 100%;
    justify-content: center;
  }

  .file-header {
    padding: 0.75rem 1rem;
  }

  .file-name {
    font-size: 0.85rem;
  }
}

/* ===== SCROLLBAR PERSONALIZADA ===== */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: var(--surface-hover);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb {
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary-color) 100%);
}

/* ===== ESTADOS DE FOCUS Y ACCESIBILIDAD ===== */
button:focus,
.btn:focus,
textarea:focus {
  outline: 2px solid var(--primary-color);
  outline-offset: 2px;
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none !important;
}

/* ===== MODO OSCURO (OPCIONAL) ===== */
@media (prefers-color-scheme: dark) {
  :root {
    --background-color: #0f172a;
    --surface-color: #1e293b;
    --surface-hover: #334155;
    --border-color: #475569;
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
  }

  body {
    background: linear-gradient(135deg, var(--background-color) 0%, #1e293b 100%);
  }

  .file-preview {
    background: #334155;
  }
}

/* ===== EFECTOS ADICIONALES ===== */
.nota-card:hover::before,
.file-card:hover::before {
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.7;
  }
}

/* ===== LOADING STATES ===== */
.loading {
  position: relative;
  overflow: hidden;
}

.loading::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
  0% {
    left: -100%;
  }
  100% {
    left: 100%;
  }
}