/* 
    HIKARI GYM - Premium Design System
    Aesthetics: Aura Light Glassmorphism, Energetic Accents.
*/

:root {
    /* Palette strictly aligned with Hikari Taller */
    --gym-primary: #0B1120;           /* deep navy sidebar/header */
    --gym-secondary: #020617;         /* main background */
    --gym-accent: #06B6D4;            /* teal/cyan accent */
    --gym-accent-glow: rgba(6, 182, 212, 0.4);
    --gym-bg: #020617;                /* dark background */
    --gym-card-bg: rgba(11, 17, 32, 0.65); /* translucent card */
    --gym-text: #F8FAFC;              /* light text */
    --gym-text-muted: #94A3B8;        /* muted text */
    --gym-border: rgba(6, 182, 212, 0.08); /* cyan-tinted border */
    --glass: rgba(11, 17, 32, 0.85);  /* dark glass */
    --font-main: 'Plus Jakarta Sans', 'Inter', sans-serif;
    --font-heading: 'Outfit', sans-serif;
}

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

body {
    background: var(--gym-bg);
    color: var(--gym-text);
    font-family: var(--font-main);
    overflow-x: hidden;
    line-height: 1.6;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes glow {
    0% { box-shadow: 0 0 5px rgba(2, 132, 199, 0.1); }
    50% { box-shadow: 0 0 20px rgba(2, 132, 199, 0.2); }
    100% { box-shadow: 0 0 5px rgba(2, 132, 199, 0.1); }
}

/* Glassmorphism Classes */
.glass {
    background: var(--gym-card-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: 24px;
    box-shadow: 0 20px 40px -15px rgba(15, 23, 42, 0.06),
                0 1px 3px rgba(15, 23, 42, 0.02);
}

/* Auth Pages Styling */
.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gym-bg);
    padding: 20px;
}

.auth-card {
    width: 100%;
    max-width: 450px;
    padding: 40px;
    animation: fadeIn 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.auth-header {
    text-align: center;
    margin-bottom: 40px;
}

.auth-header h1 {
    font-family: var(--font-heading);
    font-size: 2.5rem;
    font-weight: 800;
    letter-spacing: -1px;
    margin-bottom: 10px;
}

.auth-header h1 span {
    color: var(--gym-primary);
}

.auth-header p {
    color: var(--gym-text-muted);
}

.form-group {
    margin-bottom: 25px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.9rem;
    color: var(--gym-text-muted);
    font-weight: 500;
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-wrapper i {
    position: absolute;
    left: 15px;
    color: var(--gym-text-muted);
    transition: 0.3s;
}

.input-wrapper input {
    width: 100%;
    background: rgba(11, 17, 32, 0.6);
    border: 1px solid var(--gym-border);
    border-radius: 12px;
    padding: 14px 14px 14px 45px;
    color: var(--gym-text);
    font-size: 1rem;
    transition: all 0.3s ease;
    outline: none;
}

.input-wrapper input:focus {
    border-color: var(--gym-accent);
    background: rgba(11, 17, 32, 0.9);
    box-shadow: 0 0 0 4px var(--gym-accent-glow);
}

.input-wrapper input:focus + i {
    color: var(--gym-accent);
}

/* Select and inputs fallback in light mode */
select {
    background: rgba(11, 17, 32, 0.6);
    color: var(--gym-text);
    border: 1px solid var(--gym-border);
    border-radius: 12px;
    padding: 12px;
    outline: none;
}
select option {
    background-color: var(--gym-primary);
    color: var(--gym-text);
}

.btn-primary {
    width: 100%;
    background: linear-gradient(135deg, var(--gym-accent), #0284c7);
    color: white;
    border: none;
    border-radius: 12px;
    padding: 15px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    margin-top: 10px;
    box-shadow: 0 4px 12px var(--gym-accent-glow);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 24px var(--gym-accent-glow);
}

.btn-secondary {
    width: 100%;
    background: var(--glass);
    color: var(--gym-text);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 12px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-secondary:hover {
    background: rgba(6, 182, 212, 0.1);
    border-color: var(--gym-accent);
    color: var(--gym-accent);
}

.theme-toggle {
    cursor: pointer;
    transition: background 0.3s ease, color 0.3s ease;
}

.theme-toggle:hover {
    background: var(--gym-accent);
}

/* Dark mode overrides */
html[data-theme="dark"] {
    --gym-bg: hsl(215, 30%, 10%);
    --gym-text: #F8FAFC;
    --gym-text-muted: #9CA3AF;
    --gym-card-bg: rgba(0,0,0,0.3);
    --gym-border: rgba(255,255,255,0.1);
}

.btn-rent {
    border-color: var(--gym-accent);
    box-shadow: 0 4px 12px rgba(6, 182, 212, 0.2);
}

.btn-rent:hover {
    text-shadow: 0 0 10px rgba(6, 182, 212, 0.4);
    background: rgba(6, 182, 212, 0.1);
}

/* Dashboard Styling */
.gym-layout {
    display: flex;
    min-height: 100vh;
    background: var(--gym-bg);
}

.gym-sidebar {
    width: 290px;
    min-width: 290px;
    background: #111827;
    border-right: 1px solid rgba(6, 182, 212, 0.1);
    padding: 35px 20px;
    display: flex;
    flex-direction: column;
    z-index: 100;
    height: 100vh;
    position: sticky;
    top: 0;
    overflow-y: auto;
    box-shadow: 4px 0 20px rgba(0,0,0,0.4);
}

.gym-sidebar h1 {
    font-family: var(--font-heading);
    font-size: 1.6rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    color: var(--gym-text);
    display: flex;
    align-items: center;
    gap: 8px;
}

.gym-sidebar h1 span {
    color: var(--gym-accent);
    font-weight: 900;
    filter: drop-shadow(0 0 5px var(--gym-accent-glow));
}

.gym-main {
    flex: 1;
    padding: 40px;
    background: transparent;
    overflow-y: auto;
    max-height: 100vh;
}

.gym-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 25px;
}

.gym-card {
    padding: 30px;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    background: var(--gym-card-bg) !important;
    border: 1px solid var(--gym-border) !important;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.2) !important;
    border-radius: 24px !important;
}

.gym-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(255,255,255,0), var(--gym-accent-glow), rgba(255,255,255,0));
    opacity: 0;
    transition: 0.6s ease;
    pointer-events: none;
    border-radius: inherit;
}

.gym-card:hover::before {
    opacity: 1;
}

.gym-card:hover {
    transform: translateY(-6px) !important;
    border-color: var(--gym-accent) !important;
    box-shadow: 0 25px 50px -12px rgba(6, 182, 212, 0.15) !important;
}

.gym-card h3 {
    font-family: var(--font-heading);
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.1rem;
    color: var(--gym-text);
}

.gym-card h3 i {
    color: var(--gym-accent);
    background: rgba(6, 182, 212, 0.1);
    padding: 10px;
    border-radius: 12px;
    font-size: 1.2rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: inset 0 2px 4px rgba(255,255,255,0.1), 0 4px 8px rgba(0,0,0,0.3); /* semi-3D */
}

.gym-card:hover h3 i {
    transform: scale(1.1) rotate(6deg) translateZ(10px);
    background: rgba(6, 182, 212, 0.2);
    color: #fff;
    box-shadow: inset 0 2px 4px rgba(255,255,255,0.2), 0 8px 16px var(--gym-accent-glow);
}

.gym-card .stat {
    font-family: var(--font-heading);
    font-size: 3.2rem !important;
    font-weight: 800;
    background: linear-gradient(135deg, var(--gym-text), var(--gym-text-muted));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin: 15px 0 5px 0;
    line-height: 1;
}

/* Responsiveness */
.mobile-toggle, .sidebar-close {
    display: none !important;
}

@media (max-width: 1024px) {
    .mobile-toggle {
        display: flex !important;
    }

    .sidebar-close {
        display: flex !important;
    }

    .gym-sidebar {
        position: fixed !important;
        top: 0 !important;
        left: -290px !important;
        height: 100vh !important;
        width: 290px !important;
        transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1) !important;
        box-shadow: 25px 0 50px rgba(15, 23, 42, 0.15) !important;
        border-right: 1px solid rgba(15, 23, 42, 0.08) !important;
        border-bottom: none !important;
        padding-top: 80px !important; /* spacing for top close button */
        z-index: 1000 !important;
        background: #ffffff !important;
    }

    .gym-sidebar.mobile-open {
        left: 0 !important;
    }

    .gym-main {
        padding: 25px !important;
        max-height: none !important;
        width: 100% !important;
    }
    
    .gym-main > header {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 15px !important;
    }
    
    .gym-main > header > div {
        width: 100% !important;
    }
    
    .gym-main > header > div:last-child {
        display: flex !important;
        flex-wrap: wrap !important;
        gap: 12px !important;
        width: 100% !important;
    }
}

@media (max-width: 480px) {
    .gym-grid,
    .metrics-grid {
        grid-template-columns: 1fr !important;
    }
}

/* Navigation Sidebar */
nav {
    flex: 1;
    margin: 20px 0;
    overflow-y: auto;
    padding-right: 5px;
}

/* Thin Scrollbar for Nav */
nav::-webkit-scrollbar {
    width: 4px;
}
nav::-webkit-scrollbar-track {
    background: transparent;
}
nav::-webkit-scrollbar-thumb {
    background: rgba(15, 23, 42, 0.1);
    border-radius: 10px;
}
nav::-webkit-scrollbar-thumb:hover {
    background: var(--gym-primary);
}

.gym-nav-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.gym-nav-item {
    margin: 0;
}

.gym-nav-link {
    color: #94a3b8; /* gray-400 */
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 18px;
    border-radius: 0 12px 12px 0;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    font-size: 0.95rem;
    font-weight: 500;
    position: relative;
    border-left: 4px solid transparent;
}

.gym-nav-link i {
    font-size: 1.1rem;
    width: 20px;
    text-align: center;
    transition: all 0.3s ease;
}

.gym-nav-link:hover {
    background: rgba(255, 255, 255, 0.06);
    color: #e2e8f0;
    transform: translateX(5px);
}

.gym-nav-link:hover i {
    color: #e2e8f0;
}

.gym-nav-link.active {
    background: rgba(30, 41, 59, 0.8); /* Slate 800 - dark contrast */
    color: #06b6d4; /* Bright cyan */
    font-weight: 600;
    border-left: 4px solid #06b6d4; /* Cyan left border */
}

.gym-nav-link.active i {
    color: #06b6d4;
    filter: drop-shadow(0 0 5px rgba(6, 182, 212, 0.4));
}

.sidebar-footer {
    padding-top: 25px;
    border-top: 1px solid rgba(15, 23, 42, 0.05);
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(15, 23, 42, 0.02);
    border: 1px solid rgba(15, 23, 42, 0.05);
    padding: 12px;
    border-radius: 16px;
    transition: 0.3s;
}

.user-profile:hover {
    background: rgba(15, 23, 42, 0.05);
}

.user-avatar {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--gym-accent), #0284c7);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: white;
    box-shadow: inset 0 2px 4px rgba(255,255,255,0.3), 0 4px 12px var(--gym-accent-glow);
}


/* Control de Accesos QR */
.acceso-container {
    max-width: 500px;
    margin: 4rem auto;
    background: rgba(11, 17, 32, 0.7);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    padding: 3rem 2rem;
    text-align: center;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4), inset 0 1px 3px rgba(255, 255, 255, 0.1);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.acceso-container.success-state {
    border-color: #10b981;
    box-shadow: 0 0 30px rgba(16, 185, 129, 0.2), inset 0 0 20px rgba(16, 185, 129, 0.1);
}

.acceso-container.error-state {
    border-color: #ef4444;
    box-shadow: 0 0 30px rgba(239, 68, 68, 0.2), inset 0 0 20px rgba(239, 68, 68, 0.1);
}

.estado-icon {
    font-size: 4rem;
    color: var(--gym-accent);
    margin-bottom: 1.5rem;
    filter: drop-shadow(0 0 10px var(--gym-accent-glow));
}

.success-state .estado-icon {
    color: #10b981;
    filter: drop-shadow(0 0 10px rgba(16, 185, 129, 0.5));
}

.error-state .estado-icon {
    color: #ef4444;
    filter: drop-shadow(0 0 10px rgba(239, 68, 68, 0.5));
}

.socio-foto {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid var(--gym-accent);
    margin: 0 auto 1.5rem auto;
    display: none;
    box-shadow: 0 10px 20px rgba(0,0,0,0.5);
}

.acceso-container h1 {
    font-family: var(--font-heading);
    font-size: 1.8rem;
    margin-bottom: 0.5rem;
    color: var(--gym-text);
}

.acceso-container .mensaje {
    color: var(--gym-text-muted);
    font-size: 1rem;
    margin-bottom: 2rem;
}

.qr-input-wrapper {
    position: relative;
    max-width: 300px;
    margin: 0 auto;
}

.qr-input-wrapper input {
    width: 100%;
    background: rgba(15, 23, 42, 0.8);
    border: 2px solid rgba(255, 255, 255, 0.1);
    color: var(--gym-text);
    padding: 1rem;
    border-radius: 12px;
    text-align: center;
    font-size: 1.1rem;
    letter-spacing: 2px;
    transition: all 0.3s ease;
    outline: none;
}

.qr-input-wrapper input:focus {
    border-color: var(--gym-accent);
    box-shadow: 0 0 15px var(--gym-accent-glow);
    background: rgba(15, 23, 42, 1);
}

.info-adicional {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--gym-text-muted);
    font-size: 0.95rem;
}

.info-adicional strong {
    color: var(--gym-text);
}

.volver-btn {
    position: absolute;
    top: 20px;
    left: 20px;
    color: var(--gym-text-muted);
    text-decoration: none;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
}

.volver-btn:hover {
    color: var(--gym-accent);
    transform: translateX(-5px);
}
