﻿/* ===== PALETA DE COLORES ===== */
:root {
    --primary: #192C84;
    --primary-dark: #142438;
    --primary-darker: #0f1b2c;
    --primary-light: #2d4460;
    --primary-bright: #3d5674;
    --primary-very-light: #e8ecf1;
    --bg-light: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-very-light: #e0f2fe;
    --bg-super-light: #f0f9ff;
    --text-dark: #0f172a;
    --text-medium: #334155;
    --text-light: #64748b;
    --text-lighter: #94a3b8;
    --success: #059669;
    --success-dark: #047857;
    --warning: #d97706;
    --danger: #dc2626;
    --danger-dark: #b91c1c;
    --border: #cbd5e1;
    --border-light: #93c5fd;
    --shadow: 0 4px 20px rgba(25, 44, 68, 0.15);
    --shadow-hover: 0 8px 30px rgba(25, 44, 68, 0.25);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --glow-effect: 0 0 15px rgba(25, 44, 68, 0.2);
}

/* ===== RESET ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

html, body {
    overflow-x: hidden;
    max-width: 100%;
}

/* ===== BODY ===== */
body {
    background-color: var(--bg-light);
    color: var(--text-dark);
    transition: margin-left 0.3s ease;
    background-image: radial-gradient(circle at 10% 20%, rgba(25, 44, 68, 0.05) 0%, transparent 40%), radial-gradient(circle at 90% 80%, rgba(45, 68, 96, 0.04) 0%, transparent 40%);
    background-attachment: fixed;
}

/* ===== HEADER ===== */
.header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    min-height: 70px;
    gap: 1rem;
    flex-wrap: wrap;
}

.logo-container {
    display: flex;
    align-items: center;
}

.logo {
    font-size: 1.3rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    color: white;
    text-transform: uppercase;
    letter-spacing: 1px;
    gap: 0.5rem;
}

    .logo i {
        padding: 6px;
        border-radius: 8px;
        background: rgba(255, 255, 255, 0.2);
        font-size: 1.2rem;
        color: var(--primary-bright);
    }

/* ===== HEADER NAV ===== */
.header-nav {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-left: auto;
    flex-wrap: wrap;
}

.header-nav-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.8rem;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    text-decoration: none;
    transition: var(--transition);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

    .header-nav-link:hover {
        background-color: rgba(255, 255, 255, 0.25);
        transform: translateY(-1px);
    }

    .header-nav-link i {
        font-size: 1.1rem;
    }

/* ===== BOTÓN TOGGLE MENU ===== */
.menu-toggle-btn {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    font-size: 1.4rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 8px;
    transition: var(--transition);
    width: 45px;
    height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
}

    .menu-toggle-btn:hover {
        background-color: rgba(255, 255, 255, 0.25);
        transform: scale(1.05);
    }

/* ===== SIDEBAR ===== */
.sidebar {
    position: fixed;
    top: 0;
    left: -280px;
    width: 280px;
    height: 100vh;
    background: var(--bg-light);
    color: var(--text-dark);
    transition: var(--transition);
    z-index: 200;
    box-shadow: 0 0 30px rgba(25, 44, 68, 0.15);
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border);
    overflow-y: auto;
}

    .sidebar.open {
        left: 0;
    }

/* ===== SIDEBAR HEADER ===== */
.sidebar-header {
    padding: 1.2rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-light);
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    position: sticky;
    top: 0;
    z-index: 10;
}

    .sidebar-header h3 {
        font-weight: 600;
        font-size: 1.1rem;
        color: white;
        text-transform: uppercase;
        letter-spacing: 1px;
    }

.close-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    font-size: 1.3rem;
    cursor: pointer;
    border-radius: 50%;
    transition: var(--transition);
    padding: 6px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

    .close-btn:hover {
        background-color: rgba(255, 255, 255, 0.3);
        transform: scale(1.1);
    }

/* ===== MENÚ PRINCIPAL ===== */
.nav-menu {
    list-style: none;
    padding: 1rem 0;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

    .nav-menu li {
        margin: 6px 0;
    }

    .nav-menu a {
        color: var(--text-dark);
        text-decoration: none;
        padding: 0.9rem 1rem;
        display: flex;
        align-items: center;
        border-radius: 8px;
        transition: var(--transition);
        margin: 0.4rem 1rem;
        font-weight: 500;
        font-size: 0.95rem;
        background: rgba(25, 44, 68, 0.05);
        border: 1px solid transparent;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        min-height: 44px; /* Mejor para touch */
    }

        .nav-menu a:hover {
            background: rgba(25, 44, 68, 0.1);
            color: var(--primary);
            border: 1px solid var(--border-light);
            transform: translateX(5px);
        }

        .nav-menu a.active {
            background: rgba(25, 44, 68, 0.15);
            color: var(--primary);
            font-weight: 600;
            border-left: 3px solid var(--primary);
        }

    .nav-menu i {
        margin-right: 12px;
        font-size: 1.1rem;
        color: var(--primary);
        width: 20px;
        text-align: center;
        flex-shrink: 0;
    }

/* Divisores */
.nav-divider {
    height: 1px;
    background: var(--border);
    margin: 0.8rem 1rem;
    opacity: 0.6;
}

/* ===== BOTÓN CERRAR SESIÓN ===== */
.logout-container {
    margin-top: auto;
    padding: 1rem;
    border-top: 1px solid var(--border);
    background: var(--bg-secondary);
    position: sticky;
    bottom: 0;
    z-index: 10;
}

.nav-sesion {
    list-style: none;
    padding: 0;
    margin: 0;
}

.logout a {
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(220, 38, 38, 0.1);
    color: var(--danger);
    font-weight: 600;
    padding: 0.9rem 1rem;
    border-radius: 8px;
    text-decoration: none;
    transition: var(--transition);
    border: 1px solid rgba(220, 38, 38, 0.2);
    font-size: 0.95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-height: 44px; /* Mejor para touch */
}

    .logout a:hover {
        background: rgba(220, 38, 38, 0.15);
        transform: translateY(-2px);
    }

/* ===== CONTENIDO PRINCIPAL ===== */
#mainContentCliente {
    padding: 1.5rem;
    transition: var(--transition);
    background: var(--bg-light);
    min-height: 100vh;
}

/* ===== OVERLAY ===== */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(15, 23, 42, 0.5);
    z-index: 150;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease;
    backdrop-filter: blur(4px);
}

    .overlay.active {
        opacity: 1;
        visibility: visible;
    }

/* ===== BOTÓN FLOTANTE ===== */
.btn-agendar-flotante {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.8rem;
    box-shadow: var(--shadow);
    z-index: 2000;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    border: 2px solid rgba(255, 255, 255, 0.3);
    animation: pulse 3s infinite;
}

@keyframes pulse {
    0% {
        box-shadow: var(--shadow);
    }

    50% {
        box-shadow: 0 0 20px rgba(25, 44, 68, 0.4);
    }

    100% {
        box-shadow: var(--shadow);
    }
}

.btn-agendar-flotante:hover {
    transform: scale(1.1);
    box-shadow: var(--shadow-hover);
}

/* ===== LOGO CON IMAGEN ===== */
.logo img {
    height: 80px; /* Tamaño base del logo */
    width: auto; /* Mantiene proporción */
    object-fit: contain; /* Evita estiramientos */
    display: block;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.2)); /* Opcional */
}

/* ===== RESPONSIVE ===== */

/* Tablets */
@media (max-width: 1024px) {
    .header {
        padding: 0.9rem 1.5rem;
        gap: 0.8rem;
    }

    .logo {
        font-size: 1.2rem;
    }

    .header-nav-link {
        font-size: 0.85rem;
        padding: 0.5rem 0.7rem;
    }

    .logo img {
        height: 44px;
    }
}

/* Tablets pequeñas y móviles grandes */
@media (max-width: 768px) {
    .header {
        padding: 0.8rem 1rem;
        min-height: 65px;
        gap: 0.6rem;
    }

    .logo {
        font-size: 1.1rem;
    }

        .logo i {
            font-size: 1.1rem;
            padding: 5px;
        }

    .header-nav {
        gap: 0.5rem;
    }

    .header-nav-link {
        padding: 0.45rem 0.6rem;
        font-size: 0.85rem;
    }

    .menu-toggle-btn {
        width: 40px;
        height: 40px;
        font-size: 1.2rem;
    }

    .logo img {
        height: 45px;
    }
}

/* Móviles - Punto de quiebre crítico */
@media (max-width: 600px) {
    .header {
        padding: 0.7rem 0.8rem;
        min-height: 60px;
        justify-content: space-between;
        flex-wrap: nowrap;
    }

    .logo {
        font-size: 1rem;
        flex-shrink: 0;
    }

        .logo i {
            font-size: 1rem;
            padding: 4px;
        }

    .header-nav {
        gap: 0.3rem;
        margin-left: auto;
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none; /* Firefox */
        -ms-overflow-style: none; /* IE and Edge */
        padding-bottom: 2px;
    }

        .header-nav::-webkit-scrollbar {
            display: none; /* Chrome, Safari, Opera */
        }

    .header-nav-link {
        min-width: auto;
        padding: 0.5rem 0.7rem;
        border-radius: 20px;
        flex-shrink: 0;
        font-size: 0.8rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 120px;
    }

        .header-nav-link i {
            font-size: 1rem;
            margin-right: 4px;
        }

    .menu-toggle-btn {
        width: 38px;
        height: 38px;
        font-size: 1.1rem;
        padding: 0.4rem;
        flex-shrink: 0;
        margin-left: 0.5rem;
    }

    /* SIDEBAR MEJORADO PARA MÓVILES - NO CUBRE TODA LA PANTALLA */
    .sidebar {
        width: 85%; /* No cubre el 100% */
        max-width: 300px;
        left: -100%;
        box-shadow: 4px 0 25px rgba(25, 44, 68, 0.3);
        border-radius: 0 12px 12px 0;
        animation: slideOut 0.3s ease-in;
    }

        .sidebar.open {
            left: 0;
            animation: slideIn 0.3s ease-out;
        }

    @keyframes slideIn {
        from {
            left: -100%;
            opacity: 0.7;
        }

        to {
            left: 0;
            opacity: 1;
        }
    }

    @keyframes slideOut {
        from {
            left: 0;
            opacity: 1;
        }

        to {
            left: -100%;
            opacity: 0.7;
        }
    }

    /* Overlay más sutil en móviles */
    .overlay.active {
        background-color: rgba(15, 23, 42, 0.4);
        backdrop-filter: blur(2px);
    }

    .sidebar-header {
        padding: 1rem 0.8rem;
        min-height: 60px;
    }

        .sidebar-header h3 {
            font-size: 1rem;
        }

    /* Menú más compacto */
    .nav-menu a {
        margin: 0.15rem 0.8rem;
        padding: 0.7rem 0.8rem;
        font-size: 0.85rem;
        min-height: 44px;
    }

    .nav-menu i {
        margin-right: 10px;
        font-size: 1rem;
        width: 18px;
    }

    /* Botón cerrar más visible */
    .close-btn {
        width: 36px;
        height: 36px;
        font-size: 1.1rem;
    }

    #mainContentCliente {
        padding: 1rem;
    }

    .btn-agendar-flotante {
        width: 50px;
        height: 50px;
        font-size: 1.4rem;
        bottom: 10px;
        right: 10px;
    }

    .logo img {
        height: 26px;
    }
}

/* Móviles muy pequeños */
@media (max-width: 360px) {
    .header {
        padding: 0.6rem 0.5rem;
    }

    .logo {
        font-size: 0.9rem;
    }

    .header-nav-link {
        padding: 0.4rem 0.5rem;
        font-size: 0.75rem;
        max-width: 100px;
    }

        .header-nav-link i {
            font-size: 0.9rem;
        }

    .sidebar {
        width: 90%;
        max-width: 280px;
    }

    .sidebar-header {
        padding: 0.8rem 0.6rem;
    }

    .nav-menu a {
        margin: 0.1rem 0.6rem;
        padding: 0.6rem 0.7rem;
    }

    .logout-container {
        padding: 0.8rem;
    }

    .logout a {
        padding: 0.7rem 0.8rem;
        font-size: 0.85rem;
    }

    .logo img {
        height: 22px;
    }
}

/* Mejoras para tablets en landscape */
@media (max-width: 1024px) and (orientation: landscape) {
    .sidebar {
        height: 100vh;
        overflow-y: auto;
    }

    .sidebar-header {
        position: sticky;
        top: 0;
    }

    .logout-container {
        position: sticky;
        bottom: 0;
    }
}

/* Mejor rendimiento móvil */
@media (max-width: 768px) {
    .header {
        -webkit-backface-visibility: hidden;
        backface-visibility: hidden;
    }

    .sidebar {
        -webkit-overflow-scrolling: touch;
    }

    .nav-menu a,
    .logout a {
        min-height: 44px; /* Tamaño mínimo para touch */
    }
}
