/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: #0a0b0e;
  color: #e1e4e8;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
:root {
  --accent: #6366f1;
  --accent-hover: #818cf8;
  --accent-dim: #4f46e5;
  --bg-card: #13141a;
  --bg-elevated: #1a1b23;
  --bg-hover: #22232d;
  --border: #2a2b36;
  --text: #e1e4e8;
  --text-muted: #8b8fa3;
  --text-dim: #5c6073;
  --danger: #ef4444;
  --success: #22c55e;
  --sidebar-w: 240px;
  --header-h: 56px;
  --radius: 12px;
  --radius-sm: 8px;
}
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }
.hidden { display: none !important; }

/* ===== LOGIN SCREEN ===== */
.login-screen {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: #0a0b0e;
  z-index: 1000;
}
.login-bg-pattern {
  position: absolute; inset: 0;
  background:
    radial-gradient(ellipse at 20% 50%, rgba(99,102,241,0.08) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 20%, rgba(236,72,153,0.06) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 80%, rgba(99,102,241,0.05) 0%, transparent 50%);
  pointer-events: none;
}
.login-card {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 48px 40px;
  width: 100%;
  max-width: 400px;
  margin: 20px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.login-icon { font-size: 3rem; text-align: center; margin-bottom: 8px; }
.login-title {
  font-size: 1.75rem; font-weight: 800; text-align: center;
  background: linear-gradient(135deg, var(--accent), #ec4899);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.login-subtitle { text-align: center; color: var(--text-muted); margin-bottom: 32px; font-size: 0.9rem; }
.login-form { display: flex; flex-direction: column; gap: 20px; }
.input-group { display: flex; flex-direction: column; gap: 6px; }
.input-group label { font-size: 0.85rem; font-weight: 500; color: var(--text-muted); }
.input-group input {
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  color: var(--text);
  font-size: 0.95rem;
  font-family: inherit;
  transition: border 0.2s, box-shadow 0.2s;
  outline: none;
}
.input-group input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.15);
}
.input-group input::placeholder { color: var(--text-dim); }
.password-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}
.password-wrapper input {
  width: 100%;
  padding-right: 44px;
}
.toggle-password {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  padding: 4px;
  line-height: 1;
  opacity: 0.5;
  transition: opacity 0.15s;
}
.toggle-password:hover { opacity: 1; }
.btn-login {
  padding: 14px;
  border: none;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--accent), var(--accent-dim));
  color: white;
  font-size: 1rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.btn-login:hover { transform: translateY(-1px); box-shadow: 0 8px 25px rgba(99,102,241,0.3); }
.btn-login:active { transform: translateY(0); }
.spinner {
  width: 18px; height: 18px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.login-error {
  text-align: center;
  color: var(--danger);
  font-size: 0.85rem;
  margin-top: -8px;
}

/* ===== DASHBOARD ===== */
.dashboard {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-card);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  z-index: 100;
  transition: transform 0.3s ease;
}
.sidebar-header {
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--border);
}
.sidebar-logo { font-size: 1.4rem; }
.sidebar-title {
  font-size: 1.1rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--accent), #ec4899);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.sidebar-nav {
  flex: 1;
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  font-size: 0.9rem;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s;
  text-align: left;
  width: 100%;
}
.nav-item:hover { background: var(--bg-hover); color: var(--text); }
.nav-item.active {
  background: rgba(99,102,241,0.12);
  color: var(--accent);
  font-weight: 500;
}
.nav-icon { font-size: 1.1rem; width: 24px; text-align: center; }
.sidebar-footer {
  padding: 10px;
  border-top: 1px solid var(--border);
}
.logout-btn { color: var(--text-dim); }
.logout-btn:hover { color: var(--danger); background: rgba(239,68,68,0.08); }

/* Mobile Header */
.mobile-header {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--header-h);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  z-index: 99;
}
.menu-toggle {
  background: none; border: none;
  font-size: 1.5rem; color: var(--text);
  cursor: pointer; padding: 4px;
}
.mobile-title { font-weight: 600; }
.mobile-logout {
  background: none; border: none;
  font-size: 1.2rem; cursor: pointer;
}

/* Mobile sidebar toggle */
.sidebar.open { transform: translateX(0); }
.overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 99;
}
.overlay.show { display: block; }

/* Main Content */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-w);
  padding: 32px;
  min-height: 100vh;
}
.section { display: none; animation: fadeIn 0.3s ease; }
.section.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.section-header { margin-bottom: 28px; }
.section-header h1 { font-size: 1.5rem; font-weight: 700; }
.section-header p { color: var(--text-muted); font-size: 0.9rem; margin-top: 4px; }
.section-date { color: var(--text-muted); font-size: 0.85rem; }
.section-subtitle { font-size: 1.15rem; font-weight: 600; margin-bottom: 16px; }

/* Cards */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}
.card-title { font-size: 1rem; font-weight: 600; margin-bottom: 16px; }

/* Home Grid */
.home-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 32px;
}
.stats-card { grid-column: 1 / -1; }

/* Note Card */
.note-input-row { display: flex; gap: 8px; margin-bottom: 12px; }
.note-input {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  color: var(--text);
  font-family: inherit;
  font-size: 0.9rem;
  outline: none;
}
.note-input:focus { border-color: var(--accent); }
.btn-note {
  padding: 10px 18px;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: white;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-note:hover { background: var(--accent-hover); }
.note-list { max-height: 200px; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; }
.note-item {
  padding: 8px 12px;
  background: var(--bg-elevated);
  border-radius: 6px;
  font-size: 0.85rem;
  animation: fadeIn 0.2s ease;
}
.note-empty, .event-empty { color: var(--text-dim); font-size: 0.85rem; }

/* Mini Calendar */
.today-date { font-size: 2rem; font-weight: 700; margin-bottom: 8px; }
.mini-events { display: flex; flex-direction: column; gap: 6px; }

/* Stats Grid */
.stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.stat-item { text-align: center; }
.stat-value { display: block; font-size: 1.5rem; font-weight: 700; color: var(--accent); }
.stat-label { font-size: 0.8rem; color: var(--text-muted); margin-top: 2px; }

/* Quick Access Links */
.quick-access { margin-top: 8px; }

.links-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}
.link-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  transition: all 0.2s;
  cursor: pointer;
}
.link-card:hover {
  border-color: var(--accent);
  background: var(--bg-hover);
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0,0,0,0.3);
}
.link-icon { font-size: 1.5rem; }
.link-info { flex: 1; }
.link-info .link-label { font-weight: 500; font-size: 0.9rem; display: block; }
.link-info .link-group-label { font-size: 0.75rem; color: var(--text-dim); }
.link-arrow { color: var(--text-dim); font-size: 0.9rem; }

/* Section group labels */
.section-links .links-grid { margin-top: 4px; }

/* Calendar Card */
.calendar-card { margin-bottom: 20px; padding: 16px; }
.calendar-embed iframe {
  border-radius: var(--radius-sm);
  background: white;
}
.reminders-card { }

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .mobile-header { display: flex; }
  .main-content {
    margin-left: 0;
    padding: 16px;
    padding-top: calc(var(--header-h) + 16px);
  }
  .home-grid { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(3, 1fr); }
  .links-grid { grid-template-columns: 1fr; }
  .login-card { padding: 32px 24px; margin: 16px; }
}

@media (min-width: 769px) and (max-width: 1024px) {
  .home-grid { grid-template-columns: 1fr; }
  .links-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-dim); }

.text-muted { color: var(--text-muted); font-size: 0.9rem; }

/* ===== MANUALES ===== */
.manual-selector { margin-bottom: 24px; }
.manual-card {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.2s;
}
.manual-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0,0,0,0.3);
}
.manual-card-icon { font-size: 2rem; }
.manual-card-info { flex: 1; }
.manual-card-info h3 { font-size: 1.1rem; font-weight: 600; margin-bottom: 4px; }
.manual-card-info p { color: var(--text-muted); font-size: 0.85rem; }
.manual-card-meta { font-size: 0.75rem; color: var(--text-dim); margin-top: 8px; }

/* Manual viewer */
.manual-header { margin-bottom: 24px; }
.btn-back {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.85rem;
  margin-bottom: 16px;
  transition: all 0.15s;
}
.btn-back:hover { background: var(--bg-hover); color: var(--text); }
.manual-title { font-size: 1.4rem; font-weight: 700; margin-bottom: 4px; }
.manual-subtitle { color: var(--text-muted); font-size: 0.9rem; }
.manual-meta { font-size: 0.75rem; color: var(--text-dim); margin-top: 6px; }

/* Section navigation tabs */
.manual-sections-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
.manual-section-tab {
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.8rem;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.manual-section-tab:hover { background: var(--bg-hover); color: var(--text); }
.manual-section-tab.active {
  background: rgba(99,102,241,0.15);
  border-color: var(--accent);
  color: var(--accent);
}

/* Section content */
.manual-content {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  margin-bottom: 24px;
  line-height: 1.7;
  font-size: 0.92rem;
}
.manual-content h2 { font-size: 1.2rem; margin-bottom: 16px; }
.manual-content h3 { font-size: 1rem; margin: 20px 0 8px; }
.manual-content p { margin-bottom: 12px; }
.manual-content blockquote {
  border-left: 3px solid var(--accent);
  padding-left: 16px;
  margin: 16px 0;
  color: var(--text-muted);
  font-style: italic;
}
.manual-content pre {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
  overflow-x: auto;
  font-size: 0.82rem;
  line-height: 1.4;
  margin: 16px 0;
}
.manual-content code {
  background: var(--bg-elevated);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.85em;
}
.manual-content pre code { background: none; padding: 0; }
.manual-content hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 24px 0;
}
.manual-content strong { color: var(--text); }
.manual-content ul, .manual-content ol { margin: 0 0 12px 20px; }
.manual-content li { margin-bottom: 4px; }

/* Comments */
.manual-comments {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}
.comment-hint { margin-bottom: 16px; }
.comment-form { margin-bottom: 24px; }
.comment-input {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  color: var(--text);
  font-family: inherit;
  font-size: 0.9rem;
  resize: vertical;
  outline: none;
  margin-bottom: 10px;
}
.comment-input:focus { border-color: var(--accent); }
.comment-list { display: flex; flex-direction: column; gap: 12px; }
.comment-item {
  padding: 14px 16px;
  background: var(--bg-elevated);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  animation: fadeIn 0.2s ease;
}
.comment-question {
  font-size: 0.9rem;
  margin-bottom: 4px;
}
.comment-date {
  font-size: 0.72rem;
  color: var(--text-dim);
}
.comment-reply {
  margin-top: 10px;
  padding: 10px 14px;
  background: rgba(99,102,241,0.08);
  border-left: 3px solid var(--accent);
  border-radius: 4px;
}
.comment-reply-label {
  font-size: 0.75rem;
  color: var(--accent);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}
.comment-reply-text { font-size: 0.88rem; color: var(--text); }
.comment-pending { font-size: 0.8rem; color: var(--text-dim); font-style: italic; }

@media (max-width: 768px) {
  .manual-content { padding: 16px; }
  .manual-sections-nav { gap: 4px; }
  .manual-section-tab { font-size: 0.75rem; padding: 4px 10px; }
}
