﻿/* ==============================================
   TRADUCEHOMBRES — Layout Index Theme
   Header móvil · Sidebar desktop · Bottom Nav
   ============================================== */

/* ─── VARIABLES ─────────────────────────────── */
:root {
    --th-primary: #e91e8c;
    --th-primary-dark: #c2185b;
    --th-purple: #9c27b0;
    --th-purple-dark: #7b1fa2;
    --th-gradient: linear-gradient(135deg, #e91e8c 0%, #9c27b0 100%);
    --th-gradient-soft: linear-gradient(135deg, #fce4ec 0%, #f3e5f5 100%);
    --th-bg: #fff8fc;
    --th-surface: #ffffff;
    --th-border: rgba(233, 30, 140, 0.15);
    --th-border-strong: rgba(233, 30, 140, 0.25);
    --th-shadow-sm: 0 2px 8px rgba(233, 30, 140, 0.08);
    --th-shadow-md: 0 8px 24px rgba(233, 30, 140, 0.12);
    --th-shadow-lg: 0 20px 48px rgba(233, 30, 140, 0.18);
    --th-shadow-nav: 0 -4px 20px rgba(233, 30, 140, 0.10);
    --th-text: #1a1a2e;
    --th-text-soft: #6b6b8a;
    --th-text-muted: #9ca3af;
    --th-ease: cubic-bezier(0.4, 0, 0.2, 1);
    --th-transition: all 0.3s var(--th-ease);
    /* Layout */
    --th-bottom-nav-height: 68px;
    --th-header-mobile-height: 58px;
    --th-sidebar-width: 230px;
    /* Radios */
    --th-radius-sm: 12px;
    --th-radius: 16px;
    --th-radius-lg: 24px;
    --th-radius-xl: 32px;
}

/* ─── BASE ───────────────────────────────────── */
*, *::before, *::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Nunito', 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--th-bg);
    color: var(--th-text);
    line-height: 1.6;
    overflow-x: hidden;
    min-height: 100svh;
    /* Espacio para header móvil + bottom nav */
    padding-top: var(--th-header-mobile-height);
    padding-bottom: var(--th-bottom-nav-height);
    padding-bottom: calc(var(--th-bottom-nav-height) + env(safe-area-inset-bottom));
}

@media (min-width: 992px) {
    body {
        padding-top: 0;
        padding-bottom: 0;
        padding-left: var(--th-sidebar-width);
    }
}

/* ═══════════════════════════════════════════════
   HEADER MÓVIL
═══════════════════════════════════════════════ */
.th-app-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--th-header-mobile-height);
    background: var(--th-gradient);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.25rem;
    z-index: 900;
    box-shadow: 0 2px 16px rgba(233, 30, 140, 0.2);
}

.th-app-header__brand {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
}

.th-app-header__emoji {
    font-size: 1.4rem;
    line-height: 1;
}

.th-app-header__name {
    font-size: 1.05rem;
    font-weight: 900;
    color: white;
    letter-spacing: -0.3px;
}

.th-app-header__right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.th-app-header__user {
    font-size: 0.82rem;
    font-weight: 700;
    color: rgba(255,255,255,0.85);
    background: rgba(255,255,255,0.18);
    padding: 4px 12px;
    border-radius: 20px;
    border: 1px solid rgba(255,255,255,0.25);
}

/* ═══════════════════════════════════════════════
   SIDEBAR DESKTOP
═══════════════════════════════════════════════ */
.th-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--th-sidebar-width);
    height: 100vh;
    background: var(--th-surface);
    border-right: 1px solid var(--th-border);
    box-shadow: 4px 0 24px rgba(233, 30, 140, 0.07);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    overflow: hidden;
}

/* Brand del sidebar */
.th-sidebar__header {
    height: 70px;
    display: flex;
    align-items: center;
    padding: 0 1.25rem;
    background: var(--th-gradient);
    flex-shrink: 0;
}

.th-sidebar__brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
}

.th-sidebar__brand-emoji {
    font-size: 1.5rem;
    line-height: 1;
    flex-shrink: 0;
}

.th-sidebar__brand-name {
    font-size: 1rem;
    font-weight: 900;
    color: white;
    letter-spacing: -0.3px;
    white-space: nowrap;
}

/* Navegación del sidebar */
.th-sidebar__nav {
    flex: 1;
    padding: 1rem 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 2px;
    overflow-y: auto;
}

.th-sidebar__link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 14px;
    border-radius: var(--th-radius-sm);
    color: var(--th-text-soft);
    font-weight: 700;
    font-size: 0.88rem;
    text-decoration: none;
    transition: var(--th-transition);
    white-space: nowrap;
}

    .th-sidebar__link i {
        font-size: 1.15rem;
        flex-shrink: 0;
        width: 20px;
        text-align: center;
    }

    .th-sidebar__link:hover {
        background: linear-gradient(135deg, rgba(233, 30, 140, 0.10) 0%, rgba(156, 39, 176, 0.08) 100%);
        color: var(--th-primary);
        transform: translateX(3px);
    }

.th-sidebar__link--active {
    background: var(--th-gradient);
    color: white;
    box-shadow: 0 4px 14px rgba(233, 30, 140, 0.3);
}

    .th-sidebar__link--active:hover {
        background: var(--th-gradient); /* mantiene el gradiente sólido */
        color: white;
        transform: translateX(2px); /* ligero movimiento en vez de nada */
    }

/* Admin link — borde sutil para diferenciarlo */
.th-sidebar__link--admin {
    margin-top: auto;
    border: 1px dashed var(--th-border-strong);
}

    .th-sidebar__link--admin.th-sidebar__link--active {
        border: none;
    }

/* Footer del sidebar */
.th-sidebar__footer {
    padding: 0.75rem;
    border-top: 1px solid var(--th-border);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.th-sidebar__avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--th-gradient);
    color: white;
    font-size: 0.9rem;
    font-weight: 900;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.th-sidebar__user {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    overflow: hidden;
}

.th-sidebar__user-info {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.th-sidebar__user-name {
    font-size: 0.82rem;
    font-weight: 800;
    color: var(--th-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.th-sidebar__user-role {
    font-size: 0.7rem;
    color: var(--th-text-muted);
    font-weight: 600;
}

.th-sidebar__logout {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--th-text-muted);
    text-decoration: none;
    transition: var(--th-transition);
    flex-shrink: 0;
    font-size: 1.1rem;
}

    .th-sidebar__logout:hover {
        background: rgba(239, 68, 68, 0.1);
        color: #ef4444;
    }

/* ═══════════════════════════════════════════════
   MAIN CONTENT
═══════════════════════════════════════════════ */
.th-main {
    min-height: 100svh;
    width: 100%;
}

/* ═══════════════════════════════════════════════
   BOTTOM NAV MÓVIL
═══════════════════════════════════════════════ */
.th-bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--th-bottom-nav-height);
    background: var(--th-surface);
    border-top: 1px solid var(--th-border);
    box-shadow: var(--th-shadow-nav);
    display: flex;
    align-items: stretch;
    z-index: 900;
    padding-bottom: env(safe-area-inset-bottom);
    /* ✅ Fix iOS Chrome viewport dinámico */
    -webkit-transform: translate3d(0, 0, 0);
    transform: translate3d(0, 0, 0);
    will-change: transform;
    /* ✅ Garantiza que el fondo tapa los iconos en todo momento */
    isolation: isolate;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
}

.th-bottom-nav__item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    text-decoration: none;
    color: var(--th-text-muted);
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.3px;
    text-transform: uppercase;
    transition: var(--th-transition);
    padding: 8px 4px;
    position: relative;
    z-index: 1;
}

    .th-bottom-nav__item i {
        font-size: 1.3rem;
        transition: transform 0.2s var(--th-ease);
    }

    .th-bottom-nav__item:hover {
        color: var(--th-primary);
    }

.th-bottom-nav__item--active {
    color: var(--th-primary);
}

    .th-bottom-nav__item--active i {
        transform: scale(1.15);
        filter: drop-shadow(0 2px 4px rgba(233, 30, 140, 0.35));
    }

    /* Línea activa en la parte superior del tab */
    .th-bottom-nav__item--active::before {
        content: '';
        position: absolute;
        top: 0;
        left: 20%;
        right: 20%;
        height: 3px;
        background: var(--th-gradient);
        border-radius: 0 0 4px 4px;
    }

/* Admin tab — color especial */
.th-bottom-nav__item--admin {
    color: var(--th-purple);
}

    .th-bottom-nav__item--admin.th-bottom-nav__item--active {
        color: var(--th-purple-dark);
    }

        .th-bottom-nav__item--admin.th-bottom-nav__item--active::before {
            background: linear-gradient(135deg, var(--th-purple) 0%, var(--th-purple-dark) 100%);
        }

/* =============================================
   SIDEBAR — FOOTER / USUARIO / LOGOUT
============================================= */
.th-sidebar__footer {
    margin-top: auto;
    padding: 1rem 0.75rem;
    border-top: 1px solid var(--th-border);
    flex-shrink: 0;
}

.th-sidebar__user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 14px;
    background: var(--th-gradient-soft);
    border: 1px solid var(--th-border);
    transition: var(--th-transition);
}

.th-sidebar__avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--th-gradient);
    color: #fff;
    font-size: 0.95rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(233, 30, 140, 0.3);
}

.th-sidebar__user-info {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
}

.th-sidebar__user-name {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--th-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.th-sidebar__user-role {
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--th-primary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
}

.th-sidebar__logout {
    width: 32px;
    height: 32px;
    border-radius: 10px;
    border: 1.5px solid var(--th-border);
    background: var(--th-surface);
    color: var(--th-text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1rem;
    flex-shrink: 0;
    transition: var(--th-transition);
    -webkit-tap-highlight-color: transparent;
}

    .th-sidebar__logout:hover {
        background: rgba(239, 68, 68, 0.08);
        border-color: #ef4444;
        color: #ef4444;
        transform: scale(1.08);
    }

/* Ocultar texto en sidebar colapsado */
.sidebar.sidebar-collapsed .th-sidebar__user-info,
.sidebar.sidebar-collapsed .th-sidebar__user-name,
.sidebar.sidebar-collapsed .th-sidebar__user-role {
    display: none;
}

.sidebar.sidebar-collapsed .th-sidebar__user {
    justify-content: center;
    padding: 8px;
    background: transparent;
    border-color: transparent;
}

.sidebar.sidebar-collapsed .th-sidebar__logout {
    display: none;
}

.th-sidebar__brand-logo {
    width: 100%;
    max-width: 175px;
    height: auto;
    object-fit: contain;
    display: block;
}

.th-app-header__logo {
    height: 32px;
    width: auto;
    object-fit: contain;
    display: block;
}

