:root {
    --primary: #e91e63;
    --primary-light: #ff6090;
    --primary-dark: #b0003a;
    --secondary: #212121;
    --text-main: #ffffff;
    --text-muted: #b0b0b0;
    --bg-main: #121212;
    --bg-card: #1e1e1e;
    --bg-nav: #181818;
    --accent: #00bcd4;
    --success: #4caf50;
    --danger: #f44336;
    --warning: #ff9800;
    --glass: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
    --shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    --pink: #ff4081;
}

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

body {
    font-family: 'Outfit', 'Inter', sans-serif;
    background-color: var(--bg-main);
    color: var(--text-main);
    line-height: 1.6;
    overflow-x: hidden;
}

a {
    text-decoration: none;
    color: inherit;
    transition: all 0.3s ease;
}

ul {
    list-style: none;
}

/* Layout */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background-color: var(--bg-nav);
    border-right: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    padding: 2rem 1rem;
    position: fixed;
    height: 100vh;
    transition: transform 0.3s ease;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 1.5rem;
    padding-left: 1rem;
}

.sidebar-logo {
    height: 70px;
}

.invert-logo {
    filter: brightness(0) invert(1);
}

.nav-links {
    flex-grow: 1;
}

.nav-item {
    margin-bottom: 0.5rem;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1rem;
    border-radius: 12px;
    color: var(--text-muted);
}

.nav-link:hover, .nav-link.active {
    background: var(--glass);
    color: var(--primary-light);
    transform: translateX(5px);
}

.logout-container {
    padding: 1rem;
}

/* Main Content */
.main-content {
    flex-grow: 1;
    margin-left: 260px;
    padding: 2rem;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 3rem;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-info span {
    display: block;
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Cards */
.card {
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 1.5rem;
    box-shadow: var(--shadow);
    backdrop-filter: blur(4px);
    transition: transform 0.3s ease;
}

.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 1rem;
    position: relative;
}

.table-responsive::-webkit-scrollbar {
    height: 6px;
}

.table-responsive::-webkit-scrollbar-thumb {
    background: var(--glass-border);
    border-radius: 10px;
}

/* Item Grid for Forms (Atención / Citas) */
.item-row {
    display: grid;
    grid-template-columns: 1.2fr 2fr 0.6fr 1.2fr 0.8fr 40px;
    gap: 1rem;
    align-items: center;
    background: rgba(255,255,255,0.03);
    padding: 0.75rem 1rem;
    border-radius: 12px;
    border: 1px solid var(--glass-border);
    margin-bottom: 0.75rem;
}

.item-row-header {
    display: grid;
    grid-template-columns: 1.2fr 2fr 0.6fr 1.2fr 0.8fr 40px;
    gap: 1rem;
    padding: 0 1rem;
    margin-bottom: 0.5rem;
    color: var(--text-muted);
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.grid-sidebar-layout {
    display: grid;
    grid-template-columns: 1fr 350px;
    gap: 2rem;
}

@media (max-width: 1024px) {
    .grid-sidebar-layout {
        grid-template-columns: 1fr;
    }
}

/* Buttons */
.btn {
    padding: 0.75rem 1.5rem;
    border-radius: 12px;
    border: none;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

@media (max-width: 600px) {
    .form-grid {
        grid-template-columns: 1fr !important;
    }
}

.btn-primary:hover {
    background: var(--primary-dark);
    box-shadow: 0 0 15px var(--primary);
}

/* Auth Page */
.auth-container {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding-top: 2rem;
    min-height: 100vh;
    background: radial-gradient(circle at top left, #2c1e24 0%, #121212 50%);
}

.auth-card {
    width: 100%;
    max-width: 440px;
    padding: 2rem 1.5rem;
    margin: 1rem auto;
    overflow: hidden;
}

/* Media Queries moved below definitions to ensure priority */

.auth-header {
    text-align: center;
    margin-bottom: 2rem;
    position: relative;
}

.auth-header img {
    width: 100%;
    height: auto;
    margin-bottom: 0;
    transition: all 0.5s ease;
}

.auth-header h2 {
    color: var(--primary);
    margin-top: -12.5rem; /* Default for desktop/tablet */
    font-size: 2.2rem;
    font-weight: 700;
    position: relative;
    z-index: 10;
    text-shadow: 0 4px 10px rgba(0,0,0,0.5);
}

.auth-header p {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-top: -0.25rem;
    position: relative;
    z-index: 10;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    color: white;
    outline: none;
    transition: border-color 0.3s ease;
}

.form-control:focus {
    border-color: var(--primary);
}

.alert {
    padding: 1rem;
    border-radius: 12px;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
}

.alert-danger {
    background: rgba(244, 67, 54, 0.1);
    color: var(--danger);
    border: 1px solid var(--danger);
}

.alert-info {
    background: rgba(0, 188, 212, 0.1);
    color: var(--accent);
    border: 1px solid var(--accent);
}
.badge {
    padding: 0.2rem 0.6rem;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-salon {
    background: rgba(233, 30, 99, 0.1);
    color: var(--primary);
}

.badge-makeup {
    background: rgba(156, 39, 176, 0.1);
    color: var(--accent);
}

.badge-sale {
    background: rgba(76, 175, 80, 0.1);
    color: var(--success);
}

/* User Selector Login */
.user-selector-container {
    display: flex;
    gap: 2rem;
    justify-content: center;
    margin-bottom: 2rem;
    flex-wrap: wrap; /* Ensure it can wrap if needed */
}

.user-card {
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 1.5rem;
    width: 160px; /* Default desktop */
    text-align: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    align-items: center;
}

.user-card:hover {
    transform: translateY(-10px);
    border-color: var(--primary);
    background: rgba(233, 30, 99, 0.05);
}

.user-card.active {
    border-color: var(--primary);
    background: rgba(233, 30, 99, 0.1);
    box-shadow: 0 0 20px rgba(233, 30, 99, 0.2);
}

.user-avatar {
    width: 100px; /* Default desktop */
    height: 100px;
    background: var(--glass-border);
    border-radius: 50%;
    margin: 0 auto 1.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 15px;
    transition: all 0.3s ease;
    overflow: hidden;
}

.user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.user-card:hover .user-avatar {
    background: var(--primary);
    color: white;
}

.user-name {
    font-weight: 600;
    font-size: 0.9rem;
}

/* Authentication Page Mobile Overrides */
@media (max-width: 576px) {
    .auth-card {
        padding: 1rem 0.75rem;
        margin: 0.5rem;
    }
    .auth-header img {
        max-height: 160px !important;
        width: auto !important;
        margin: 0 auto;
    }
    .auth-header h2#welcome-text {
        font-size: 1.6rem !important;
        margin-top: -3.5rem !important;
        margin-bottom: 0.25rem !important;
    }
    .auth-header p {
        font-size: 0.8rem !important;
    }
    .user-selector-container {
        flex-direction: column !important;
        align-items: center !important;
        gap: 0.75rem !important;
        margin-bottom: 1.5rem !important;
    }
    .user-card {
        width: 100% !important;
        max-width: 280px;
        padding: 1rem !important;
        flex-direction: row !important; /* Horizontal profile on column container for better space usage */
        justify-content: flex-start;
        gap: 1.25rem;
        text-align: left;
    }
    .user-avatar {
        width: 60px !important;
        height: 60px !important;
        margin: 0 !important;
        padding: 8px !important;
    }
    .user-name {
        font-size: 1.1rem !important;
    }
    .form-group {
        margin-bottom: 1rem !important;
    }
}

/* Responsive Sidebar & Mobile UI */
.mobile-header {
    display: none;
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        z-index: 1000;
        width: 280px;
        box-shadow: 10px 0 30px rgba(0,0,0,0.5);
    }
    
    .sidebar.sidebar-open {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
        padding: 1rem;
        padding-top: 5rem;
    }
    
    .mobile-header {
        display: flex;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        height: 60px;
        background: var(--bg-nav);
        border-bottom: 1px solid var(--glass-border);
        align-items: center;
        padding: 0 1.5rem;
        z-index: 900;
        justify-content: space-between;
        box-shadow: 0 4px 10px rgba(0,0,0,0.3);
    }
    
    .hamburger {
        font-size: 1.4rem;
        color: var(--primary-light);
        cursor: pointer;
        padding: 0.5rem;
    }
    
    .sidebar-backdrop {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0,0,0,0.7);
        backdrop-filter: blur(6px);
        z-index: 950;
    }
    
    .sidebar-backdrop.active {
        display: block;
    }

    header {
        display: none; 
    }

    /* Grid Resets */
    .grid-2, .grid-sidebar-layout {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    /* Dashboard Cards Fix */
    .dashboard-stats {
        grid-template-columns: 1fr !important; /* Stack stats on mobile */
    }

    .stat-card h3 {
        font-size: 0.9rem !important;
    }

    .stat-card .value {
        font-size: 1.6rem !important;
    }

    /* Grid Resets for Dashboard */
    .dashboard-stats {
        display: grid;
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
    }

    .grid-2 {
        grid-template-columns: 1fr !important;
    }

    /* Form Items */
    .item-row {
        grid-template-columns: 1fr 1fr !important;
        grid-template-areas: 
            "tipo qty"
            "item item"
            "price trash" !important;
        gap: 0.5rem !important;
    }

    .item-row > div:nth-child(1) { grid-area: tipo; }
    .item-row > div:nth-child(2) { grid-area: item; }
    .item-row > div:nth-child(3) { grid-area: qty; }
    .item-row > div:nth-child(4) { grid-area: price; }
    .item-row > button { grid-area: trash; align-self: center; }

    /* Table Responsiveness */
    .card {
        padding: 1rem;
        overflow-x: auto;
    }
    
    table {
        min-width: 600px;
        font-size: 0.85rem;
    }

    h1 { font-size: 1.5rem; }

    /* Mobile Item Row Stacking */
    .item-row-header {
        display: none !important; /* Hide headers on mobile, use placeholders or labels */
    }

    .item-row {
        grid-template-columns: 1fr 1fr !important;
        grid-template-areas: 
            "tipo qty"
            "item item"
            "price share"
            "trash trash" !important;
        gap: 0.75rem !important;
        padding: 1.25rem !important;
    }

    .item-row > div:nth-child(1) { grid-area: tipo; }
    .item-row > div:nth-child(2) { grid-area: item; }
    .item-row > div:nth-child(3) { grid-area: qty; }
    .item-row > div:nth-child(4) { grid-area: price; }
    .item-row > div:nth-child(5) { grid-area: share; }
    .item-row > button { 
        grid-area: trash; 
        width: 100%; 
        border: 1px solid rgba(244, 67, 54, 0.2) !important;
        padding: 0.5rem !important;
        background: rgba(244, 67, 54, 0.05) !important;
        margin-top: 0.5rem;
    }

    /* Appointments Mobile Grid */
    .agenda-grid {
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
    }

    /* Additional Mobile Polish */
    .card {
        border-radius: 15px !important;
    }

    .btn {
        width: 100%;
        justify-content: center;
    }

    .btn-sm {
        width: auto !important;
    }
}

/* Premium Tablet Fixes */
@media (min-width: 769px) and (max-width: 1200px) {
    .dashboard-stats {
        grid-template-columns: 1fr 1fr !important;
    }
}

.attention-image a:hover img {
    transform: scale(1.05);
    filter: brightness(1.1);
}
