/* =====================================================================
   Toyos & Espin - Tema compartido
   Colores tomados del logo del estudio (bordo + gris carbon).
   Criterio: sistema de trabajo sobrio. Sin animaciones de entrada,
   sin iconos decorativos en titulos, sin mayusculas espaciadas,
   sin tarjetas que "flotan". Se carga desde navs/nav.html.
   ===================================================================== */

:root {
    /* Marca (logo) */
    --primary: #7f3054;
    --primary-light: #a35a7c;
    --primary-mid: #8f3d62;
    --primary-dark: #5e2140;
    --primary-tint: #f6eef2;
    --primary-dim: rgba(127, 48, 84, 0.08);
    --primary-border: rgba(127, 48, 84, 0.35);
    --charcoal: #58585a;         /* gris del logo */
    --accent: var(--charcoal);
    --accent-light: #c9c9cb;

    /* Neutros */
    --secondary: #f5f5f4;
    --bg: #f3f3f2;
    --card: #ffffff;
    --white: #ffffff;
    --border: #dddcd9;
    --border-strong: #c7c6c2;
    --text-dark: #252527;
    --text-mid: #47474a;
    --text-light: #6e6e72;

    /* Estados */
    --success: #2f6b4a;
    --success-light: #edf5f0;
    --danger: #a8322d;
    --danger-light: #fbefee;
    --warning: #9a6b1f;

    /* Forma */
    --nav-height: 64px;
    --border-radius: 3px;
    --radius-lg: 4px;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 6px 18px rgba(0, 0, 0, 0.10);
    --transition: background-color .15s ease, color .15s ease, border-color .15s ease;

    /* Tipografia: una sola familia */
    --font: 'Source Sans 3', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    --font-serif: var(--font);

    /* Alias heredados: las paginas usaban otras paletas (bordo, azul, ciruela...).
       Este CSS se carga despues de los <style> de cada pagina, asi que los redefine. */
    --bordo: var(--primary);
    --bordo2: var(--primary-mid);
    --bordo-light: var(--primary-tint);
    --bordo-dim: var(--primary-dim);
    --bordo-border: var(--primary-border);
    --azul: var(--primary);
    --azul-med: var(--primary-mid);
    --azul-light: var(--primary-tint);
    --ciruela: var(--primary);
    --ciruela-dark: var(--primary-dark);
    --primary-color: var(--primary);
    --secondary-color: var(--primary-mid);
    --c: var(--primary);
    --c-dk: var(--primary-dark);
    --rojo: var(--danger);
    --rojo-light: var(--danger-light);
    --verde: var(--success);
    --texto: var(--text-dark);
    --texto2: var(--text-mid);
    --texto3: var(--text-light);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font);
    background-color: var(--bg);
    color: var(--text-dark);
    overflow-x: hidden;
    padding-top: var(--nav-height);
    line-height: 1.55;
    font-size: 15px;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font) !important;
    font-weight: 600;
    letter-spacing: 0 !important;
}

input, select, textarea, button {
    font-family: inherit;
}

::selection { background: var(--primary-dim); }

:focus-visible {
    outline: 2px solid var(--primary-light);
    outline-offset: 1px;
}

img, svg, video { max-width: 100%; }

.table-responsive, .tabla-wrap, .table-wrapper { overflow-x: auto; }

/* ---------------------------------------------------------------------
   Sobriedad global (las paginas traen estilos propios; esto los aplana)
   --------------------------------------------------------------------- */

/* Sin animaciones de entrada (fade/slide). Los spinners siguen girando. */
*, *::before, *::after {
    animation-duration: 0s !important;
    animation-delay: 0s !important;
}
.fa-spin, .fa-spinner, .fa-circle-notch,
[class*="spinner"], [class*="loader"], [class*="loading"] {
    animation-duration: 1s !important;
}

/* Las tarjetas y botones no "saltan" al pasar el mouse */
[class*="card"]:hover,
[class*="btn"]:hover,
button:hover,
.quick-link:hover {
    transform: none !important;
}

/* Iconos decorativos en titulos y etiquetas: fuera */
:is(h1, h2, h3, h4, .section-title, .card-title, .category-title, .stitle) > i[class*="fa-"],
:is(h1, h2, h3, h4, .section-title, .card-title) > span > i[class*="fa-"],
label > i[class*="fa-"]:first-child:not(.fa-info-circle):not(.fa-question-circle):not(.fa-circle-info) {
    display: none !important;
}

/* Etiquetas y subtitulos en caja normal, sin tracking */
label,
.section-title, .card-title, .stitle,
[class*="header"] :is(p, span, small),
.header-sub, .subtitle {
    text-transform: none !important;
    letter-spacing: normal !important;
}

/* Encabezados de pagina: barra blanca con titulo a la izquierda (no bandas
   de color con titulo gigante centrado) */
:is(.page-header, .form-header, .card-header, .header-section, .library-hero, .search-hero) {
    background: var(--white) !important;
    color: var(--text-dark) !important;
    text-align: left !important;
    box-shadow: none !important;
    border: 0 !important;
    border-bottom: 1px solid var(--border) !important;
    padding: 18px 28px !important;
}
:is(.page-header, .form-header, .card-header, .header-section, .library-hero, .search-hero) :is(h1, h2) {
    color: var(--text-dark) !important;
    font-size: 1.45rem !important;
    text-align: left !important;
    margin-bottom: 2px !important;
}
:is(.page-header, .form-header, .card-header, .header-section, .library-hero, .search-hero) :is(p, span, small) {
    color: var(--text-light) !important;
    text-align: left !important;
    font-size: .92rem !important;
    opacity: 1 !important;
}
:is(.page-header, .header-section) :is(a, button) {
    background: var(--white) !important;
    color: var(--primary) !important;
    border: 1px solid var(--primary-border) !important;
    box-shadow: none !important;
}
:is(.library-hero, .search-hero) :is(input, button) { box-shadow: none !important; }

/* Barritas y adornos al costado de los titulos de seccion */
:is(.section-title, .card-title, .stitle, .category-title)::before,
:is(.section-title, .card-title, .stitle)::after {
    display: none !important;
}
.section-title, .card-title {
    padding-left: 0 !important;
    border-left: 0 !important;
    border-bottom-color: var(--border) !important;
    color: var(--text-dark) !important;
}
:is(.page-header, .form-header, .card-header, .header-section) :is(h1, h2) {
    display: block !important;
}
th > i[class*="fa-"] { display: none !important; }

/* Encabezados de tabla discretos */
thead th {
    background: var(--secondary) !important;
    color: var(--text-mid) !important;
    text-transform: none !important;
    letter-spacing: normal !important;
    font-weight: 600 !important;
    border-bottom: 1px solid var(--border-strong) !important;
}

/* ---------- Componentes compartidos (para paginas nuevas) ---------- */
.tye-container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }

.tye-page-header {
    background: var(--white);
    border-bottom: 1px solid var(--border);
    padding: 20px 32px;
}
.tye-page-header h1 { font-size: 1.5rem; color: var(--text-dark); }
.tye-page-header p { color: var(--text-light); margin-top: 2px; }

.tye-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
}

.tye-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 8px 16px; border: 1px solid var(--primary); border-radius: var(--border-radius);
    background: var(--primary); color: #fff; font-weight: 600; font-size: .9rem;
    cursor: pointer; text-decoration: none; transition: var(--transition);
}
.tye-btn:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.tye-btn-outline { background: #fff; color: var(--primary); border-color: var(--primary-border); }
.tye-btn-outline:hover { background: var(--primary-tint); color: var(--primary-dark); }
.tye-btn-success { background: var(--success); border-color: var(--success); }
.tye-btn-danger { background: var(--danger); border-color: var(--danger); }

.tye-input {
    width: 100%; padding: 8px 12px; border: 1px solid var(--border-strong);
    border-radius: var(--border-radius); background: #fff; color: var(--text-dark);
    font-size: .95rem;
}
.tye-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-dim); outline: none; }

/* =====================================================================
   Navegacion
   ===================================================================== */
.navbar {
    background-color: var(--white);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--nav-height);
    display: flex;
    align-items: center;
    gap: 32px;
    padding: 0 28px;
    border-bottom: 1px solid var(--border);
    z-index: 1005;
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    flex-shrink: 0;
}

.brand-emblem { height: 38px; width: auto; }
.brand-wordmark { height: 26px; width: auto; }

.navbar-links {
    display: flex;
    align-items: stretch;
    height: 100%;
}

.nav-item {
    height: 100%;
    display: flex;
}

.nav-link {
    color: var(--text-mid);
    text-decoration: none;
    padding: 0 14px;
    height: 100%;
    display: flex;
    align-items: center;
    font-size: .95rem;
    font-weight: 500;
    border-bottom: 2px solid transparent;
    border-top: 2px solid transparent;
    transition: var(--transition);
}

.nav-link:hover {
    color: var(--primary);
}

.nav-link.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.navbar-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 16px;
    height: 100%;
}

.credits {
    color: var(--text-dark);
    font-size: .92rem;
    font-weight: 600;
}

.navbar-actions .nav-link { padding: 0; }

/* Logout es un form POST (CSRF): el boton se ve como enlace */
.navbar form,
.sidenav form {
    display: flex;
    margin: 0;
    padding: 0;
    background: none;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    max-width: none;
    width: auto;
    height: 100%;
}
.sidenav form { height: auto; }

.navbar button.nav-link,
.sidenav button.sidenav-link {
    background: none;
    border-left: 0;
    border-right: 0;
    cursor: pointer;
    font-family: inherit;
    margin: 0;
    border-radius: 0;
    box-shadow: none;
    transform: none;
}
.navbar button.nav-link { width: auto; }
.navbar button.nav-link:hover { text-decoration: underline; }

/* Hamburguesa */
.menu-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 40px;
    height: 40px;
    margin-left: auto;
    border: 1px solid var(--border-strong);
    border-radius: var(--border-radius);
    background: var(--white);
    cursor: pointer;
    padding: 0;
    position: relative;
    z-index: 1006;
}

.menu-toggle span {
    width: 18px;
    height: 2px;
    background-color: var(--text-mid);
    margin: 2px 0;
}

.menu-toggle.active span:nth-child(1) { transform: rotate(45deg) translate(4px, 4px); }
.menu-toggle.active span:nth-child(2) { opacity: 0; }
.menu-toggle.active span:nth-child(3) { transform: rotate(-45deg) translate(4px, -4px); }

/* Menu lateral (mobile) */
.sidenav {
    height: 100%;
    width: 270px;
    position: fixed;
    top: 0;
    left: -280px;
    background: var(--white);
    border-right: 1px solid var(--border);
    overflow-x: hidden;
    transition: left .25s ease;
    padding-top: calc(var(--nav-height) + 12px);
    z-index: 1004;
}

.sidenav-content {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.sidenav-links { flex: 1; }

.sidenav-link {
    display: block;
    width: 100%;
    padding: 12px 24px;
    text-decoration: none;
    text-align: left;
    font-size: 1rem;
    color: var(--text-dark);
    border: 0;
    border-left: 3px solid transparent;
}

.sidenav-link:hover,
.sidenav-link.active {
    background: var(--secondary);
    border-left-color: var(--primary);
    color: var(--primary);
}

.sidenav-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    color: var(--text-light);
    font-size: .9rem;
}

.tye-overlay {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.35);
    z-index: 1003;
    opacity: 0;
    visibility: hidden;
}

@media screen and (max-width: 860px) {
    .navbar { padding: 0 16px; }
    .navbar-links,
    .navbar-actions { display: none; }
    .menu-toggle { display: flex; }
    body.nav-open { overflow: hidden; }
    body.nav-open .tye-overlay { opacity: 1; visibility: visible; }
    body.nav-open .sidenav { left: 0; }
}

@media screen and (max-width: 420px) {
    .brand-wordmark { height: 20px; }
    .brand-emblem { height: 32px; }
}

/* =====================================================================
   Footer
   ===================================================================== */
.footer {
    background: #2f2f31;
    color: rgba(255, 255, 255, 0.72);
    margin-top: 48px;
    font-size: .9rem;
}

.footer-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 28px 28px 20px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 32px;
    flex-wrap: wrap;
}

.footer-brand img { height: 24px; width: auto; opacity: .92; }

.footer-contact {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 22px;
    line-height: 1.5;
}

.footer a {
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
}

.footer a:hover { text-decoration: underline; }

.footer-legal {
    max-width: 1200px;
    margin: 0 auto;
    padding: 12px 28px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px 20px;
    font-size: .82rem;
    color: rgba(255, 255, 255, 0.5);
}

.footer-legal a { color: rgba(255, 255, 255, 0.6); }

@media (max-width: 860px) {
    .footer-inner { padding: 24px 16px 16px; flex-direction: column; gap: 14px; }
    .footer-contact { flex-direction: column; }
    .footer-legal { padding: 12px 16px 18px; }
}
