/* ============================================================
   TESTSADMINISTRATIVO.ES — Word 365 Funciones y Herramientas
   styles.css  |  Versión Profesional (Temática Word)
   ============================================================ */

/* ── CSS Variables ──────────────────────────────────────────── */
:root {
  /* Word 365 Color Palette */
  --accent: #2B579A;
  --accent-light: #4A7DC4;
  --accent-dark: #1E3F6F;
  --accent-glow: rgba(43, 87, 154, 0.25);
  
  /* Background & Surface */
  --bg: #F7F9FC;
  --bg-alt: #EDF1F7;
  --surface: #FFFFFF;
  --surface-hover: #F0F4FA;
  --surface-active: #E5EBF5;
  
  /* Text */
  --text: #1A2B3C;
  --text-muted: #5A6A7A;
  --text-light: #8A9AAA;
  
  /* Borders & Shadows */
  --border: #D4DCE8;
  --border-light: #E8EDF5;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
  --shadow-accent: 0 4px 20px rgba(43, 87, 154, 0.2);
  
  /* Spacing */
  --hdr-h: 64px;
  --sidebar-w: 280px;
  --content-max: 1200px;
  --gap: 24px;
  --radius: 12px;
  --radius-sm: 8px;
  
  /* Typography */
  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
}

/* ── Reset & Base ───────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--hdr-h) + 24px);
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.2s;
}
a:hover { color: var(--accent-light); }

/* ── Header ─────────────────────────────────────────────────── */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--hdr-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  z-index: 100;
  backdrop-filter: blur(12px);
}

.header__inner {
  max-width: var(--content-max);
  margin: 0 auto;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--gap);
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--text);
}

.logo-icon {
  width: 36px;
  height: 36px;
}

.logo-text { letter-spacing: -0.02em; }
.logo-365 { color: var(--accent); }

.nav-desktop {
  display: none;
  gap: 8px;
}

.nav-link {
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-weight: 500;
  font-size: 0.9rem;
  color: var(--text-muted);
  transition: all 0.2s;
}

.nav-link:hover {
  color: var(--accent);
  background: var(--surface-hover);
}

@media (min-width: 900px) {
  .nav-desktop { display: flex; }
}

/* ── Hamburger Button ───────────────────────────────────────── */
.ham {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  padding: 8px;
  background: none;
  border: none;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: background 0.2s;
}

.ham:hover { background: var(--surface-hover); }

.ham span {
  display: block;
  width: 100%;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: all 0.3s ease;
}

.ham.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.ham.open span:nth-child(2) { opacity: 0; }
.ham.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

@media (min-width: 900px) {
  .ham { display: none; }
}

/* ── Mobile Drawer ──────────────────────────────────────────── */
.drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s;
  z-index: 150;
}

.drawer.open ~ .drawer-overlay,
.drawer.open + .drawer-overlay {
  opacity: 1;
  visibility: visible;
}

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: min(320px, 85vw);
  height: 100%;
  background: var(--surface);
  transform: translateX(100%);
  transition: transform 0.3s ease;
  z-index: 200;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
}

.drawer.open { transform: translateX(0); }

.drawer__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.drawer__title {
  font-weight: 600;
  font-size: 1rem;
}

.drawer__close {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  cursor: pointer;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  transition: all 0.2s;
}

.drawer__close:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.drawer__close svg { width: 20px; height: 20px; }

.drawer__search {
  padding: 16px 20px;
  position: relative;
}

.drawer__search input {
  width: 100%;
  padding: 10px 40px 10px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  background: var(--bg);
  transition: all 0.2s;
}

.drawer__search input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.drawer__search .search-icon {
  position: absolute;
  right: 32px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--text-light);
}

.drawer-nav {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
}

@media (min-width: 900px) {
  .drawer-overlay,
  .drawer { display: none; }
}

/* ── Layout ─────────────────────────────────────────────────── */
.layout {
  display: flex;
  min-height: 100vh;
  padding-top: var(--hdr-h);
}

/* ── Sidebar (Desktop) ──────────────────────────────────────── */
.sidebar {
  display: none;
  position: fixed;
  top: var(--hdr-h);
  left: 0;
  width: var(--sidebar-w);
  height: calc(100vh - var(--hdr-h));
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 24px 16px;
  overflow-y: auto;
  flex-direction: column;
}

@media (min-width: 900px) {
  .sidebar { display: flex; }
}

.sidebar__search {
  position: relative;
  margin-bottom: 20px;
}

.sidebar__search input {
  width: 100%;
  padding: 10px 40px 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  background: var(--bg);
  transition: all 0.2s;
}

.sidebar__search input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.sidebar__search .search-icon {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--text-light);
}

.toc {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.toc-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-muted);
  transition: all 0.2s;
}

.toc-item:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.toc-item.active {
  background: linear-gradient(135deg, var(--accent), var(--accent-light));
  color: #fff;
  box-shadow: var(--shadow-accent);
}

.toc-icon {
  font-size: 1.1rem;
  flex-shrink: 0;
}

.sidebar__footer {
  margin-top: auto;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.back-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
  transition: all 0.2s;
}

.back-link:hover {
  background: var(--surface-hover);
  color: var(--accent);
}

/* ── Main Content ───────────────────────────────────────────── */
.main {
  flex: 1;
  padding: var(--gap);
  max-width: var(--content-max);
  margin: 0 auto;
  width: 100%;
}

@media (min-width: 900px) {
  .main {
    margin-left: var(--sidebar-w);
    padding: 32px 40px;
  }
}

/* ── Hero Section ───────────────────────────────────────────── */
.hero {
  text-align: center;
  padding: 48px 24px 56px;
  margin-bottom: 40px;
  background: linear-gradient(160deg, var(--accent) 0%, var(--accent-dark) 100%);
  border-radius: var(--radius);
  color: #fff;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -20%;
  width: 60%;
  height: 200%;
  background: radial-gradient(ellipse, rgba(255,255,255,0.1) 0%, transparent 70%);
  pointer-events: none;
}

.hero__badge {
  display: inline-block;
  padding: 6px 16px;
  background: rgba(255,255,255,0.2);
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 20px;
  backdrop-filter: blur(4px);
}

.hero__title {
  font-size: clamp(2.5rem, 6vw, 3.5rem);
  font-weight: 800;
  margin: 0 0 16px;
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.hero__word {
  display: block;
}

.hero__subtitle {
  display: block;
  font-size: 0.45em;
  font-weight: 500;
  opacity: 0.9;
  margin-top: 8px;
  letter-spacing: 0;
}

.hero__desc {
  max-width: 560px;
  margin: 0 auto;
  font-size: 1.05rem;
  opacity: 0.9;
  line-height: 1.7;
}

/* ── Content Sections ───────────────────────────────────────── */
.content-section {
  margin-bottom: 56px;
  scroll-margin-top: calc(var(--hdr-h) + 24px);
}

.section-header {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 2px solid var(--border);
}

.section-icon {
  font-size: 2rem;
  flex-shrink: 0;
  margin-top: 4px;
}

.section-title {
  font-size: 1.6rem;
  font-weight: 700;
  margin: 0;
  color: var(--text);
  letter-spacing: -0.02em;
}

.section-desc {
  margin: 4px 0 0;
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* ── Function Card Grid ─────────────────────────────────────── */
.fn-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

/* ── Function Card ──────────────────────────────────────────── */
.fn-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  opacity: 0;
  transform: translateY(16px);
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.fn-card.visible {
  opacity: 1;
  transform: translateY(0);
}

.fn-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.fn-card.hidden { display: none; }

.fn-card__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.fn-name {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
}

.fn-shortcut {
  flex-shrink: 0;
  padding: 4px 10px;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--accent);
  white-space: nowrap;
}

.fn-card__desc {
  margin: 0 0 16px;
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.6;
}

.fn-card__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.fn-tag {
  padding: 4px 10px;
  background: linear-gradient(135deg, var(--accent-glow), transparent);
  border: 1px solid var(--accent);
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--accent);
}

/* ── No Results ─────────────────────────────────────────────── */
.no-results {
  grid-column: 1 / -1;
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
  font-size: 1rem;
}

/* ── Footer ─────────────────────────────────────────────────── */
.main-footer {
  margin-top: 64px;
  padding: 32px 24px;
  text-align: center;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.9rem;
}

.main-footer a {
  font-weight: 600;
}

.footer-note {
  margin-top: 8px;
  font-size: 0.8rem;
  color: var(--text-light);
}

/* ── Scrollbar Styling ──────────────────────────────────────── */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg);
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-light);
}

/* ── Selection ──────────────────────────────────────────────── */
::selection {
  background: var(--accent);
  color: #fff;
}

/* ── Focus Visible ──────────────────────────────────────────── */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ── Print Styles ───────────────────────────────────────────── */
@media print {
  .header,
  .sidebar,
  .drawer,
  .drawer-overlay,
  .ham { display: none !important; }
  
  .main {
    margin-left: 0;
    padding: 0;
  }
  
  .fn-card {
    break-inside: avoid;
    opacity: 1;
    transform: none;
  }
}
