/* Modern Glassmorphic Theme for Massage Parlor BMS - Customized for Massda Spa */
@import url('https://fonts.googleapis.com/css2?family=Tajawal:wght@300;400;500;700;800;900&display=swap');

:root {
    --bg-color: #171513;
    --card-bg: rgba(30, 27, 24, 0.65);
    --card-border: rgba(189, 163, 130, 0.25);
    --card-border-hover: rgba(189, 163, 130, 0.6);
    
    --primary: #bda382;
    --primary-glow: rgba(189, 163, 130, 0.4);
    --secondary: #f4f1ea;
    --accent: #a1826b;
    
    --text-main: #f4f1ea;
    --text-muted: #a89f95;
    --success: #52b788;
    --danger: #ff5a5f;
    --warning: #ffd166;
    
    --sidebar-width: 260px;
    --topbar-height: 70px;
    --transition-speed: 0.3s;
    
    --input-bg: rgba(20, 18, 16, 0.75);
    --sidebar-bg: rgba(20, 18, 16, 0.95);
}

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

body {
    font-family: 'Tajawal', sans-serif;
    background-color: var(--bg-color);
    background-image: 
        radial-gradient(at 10% 20%, rgba(161, 130, 107, 0.15) 0px, transparent 50%),
        radial-gradient(at 90% 80%, rgba(189, 163, 130, 0.1) 0px, transparent 50%);
    background-attachment: fixed;
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: var(--bg-color);
}
::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--secondary);
}

/* Glassmorphism utility with premium gradient styling */
.glass {
    background: linear-gradient(135deg, rgba(38, 34, 30, 0.75) 0%, rgba(24, 22, 20, 0.6) 100%);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    transition: all var(--transition-speed) ease;
}

.glass:hover {
    border-color: var(--card-border-hover);
    box-shadow: 0 8px 32px 0 rgba(189, 163, 130, 0.15);
}

/* Page Layout */
#app-layout {
    display: flex;
    min-height: 100vh;
}

/* Sidebar Styling */
#sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    border-right: 1px solid var(--card-border);
    display: flex;
    flex-direction: column;
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
    z-index: 100;
}

.sidebar-header {
    height: var(--topbar-height);
    display: flex;
    align-items: center;
    justify-content: center;
    border-bottom: 1px solid var(--card-border);
    padding: 0 20px;
}

.sidebar-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(45deg, var(--secondary), var(--primary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: 1px;
}

.sidebar-menu {
    list-style: none;
    padding: 20px 15px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sidebar-menu li a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: 10px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.sidebar-menu li a:hover, 
.sidebar-menu li.active a {
    color: var(--text-main);
    background: linear-gradient(135deg, rgba(189, 163, 130, 0.22) 0%, rgba(161, 130, 107, 0.08) 100%);
    box-shadow: inset 0 0 10px rgba(189, 163, 130, 0.08);
}

.sidebar-menu li.active a {
    border-left: 4px solid var(--primary);
}

.sidebar-menu li a svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
    fill: none;
}

.sidebar-footer {
    margin-top: auto;
    padding: 20px;
    border-top: 1px solid var(--card-border);
}

/* Main Content Area */
#main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Topbar Styling */
#topbar {
    height: var(--topbar-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 40px;
    border-bottom: 1px solid var(--card-border);
}

.page-title h1 {
    font-size: 1.6rem;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-name {
    font-weight: 500;
}

.btn-logout {
    padding: 8px 16px;
    background: rgba(255, 90, 95, 0.15);
    border: 1px solid rgba(255, 90, 95, 0.3);
    color: var(--danger);
    border-radius: 8px;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.btn-logout:hover {
    background: var(--danger);
    color: white;
}

/* Content Frame */
.content-body {
    padding: 40px;
    flex: 1;
}

/* Stat Cards Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 25px;
    margin-bottom: 40px;
}

.stat-card {
    padding: 25px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.stat-card .label {
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-card .value {
    font-size: 2.2rem;
    font-weight: 700;
    color: var(--text-main);
}

.stat-card .trend {
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 5px;
}

.trend.positive { color: var(--success); }
.trend.negative { color: var(--danger); }

/* Dashboard Charts Grid */
.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 30px;
    margin-bottom: 40px;
}

.chart-card {
    padding: 25px;
}

.chart-card h3 {
    margin-bottom: 20px;
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-main);
}

.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, var(--accent) 0%, var(--primary) 100%);
    border: none;
    color: #171513;
    padding: 12px 24px;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    box-shadow: 0 4px 15px var(--primary-glow);
    transition: all 0.2s ease;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(197, 168, 128, 0.5);
}

/* Tables and Panels */
.panel {
    padding: 30px;
    margin-bottom: 30px;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}

.panel-header h3 {
    font-size: 1.3rem;
    font-weight: 600;
}

/* Custom Table Style */
.table-wrapper {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

th {
    padding: 15px 20px;
    font-weight: 600;
    color: var(--text-muted);
    border-bottom: 2px solid var(--card-border);
    font-size: 0.95rem;
}

td {
    padding: 15px 20px;
    border-bottom: 1px solid var(--card-border);
    color: var(--text-main);
    vertical-align: middle;
}

tr:hover td {
    background: rgba(197, 168, 128, 0.05);
}

/* Badges */
.badge {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
}

.badge.pending { background: rgba(255, 209, 102, 0.15); color: var(--warning); border: 1px solid rgba(255, 209, 102, 0.3); }
.badge.confirmed { background: rgba(82, 183, 136, 0.15); color: var(--success); border: 1px solid rgba(82, 183, 136, 0.3); }
.badge.completed { background: rgba(157, 78, 221, 0.15); color: var(--secondary); border: 1px solid rgba(157, 78, 221, 0.3); }
.badge.cancelled { background: rgba(255, 90, 95, 0.15); color: var(--danger); border: 1px solid rgba(255, 90, 95, 0.3); }

.badge.paid { background: rgba(82, 183, 136, 0.15); color: var(--success); }
.badge.unpaid { background: rgba(255, 90, 95, 0.15); color: var(--danger); }

/* Forms styling */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group.full-width {
    grid-column: 1 / -1;
}

.form-group label {
    font-size: 0.95rem;
    color: var(--text-muted);
    font-weight: 500;
}

.form-control {
    width: 100%;
    background: var(--input-bg);
    border: 1px solid var(--card-border);
    padding: 12px 16px;
    border-radius: 8px;
    color: var(--text-main);
    font-family: inherit;
    font-size: 1rem;
    outline: none;
    transition: all 0.2s ease;
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 10px rgba(197, 168, 128, 0.3);
}

select.form-control option {
    background: var(--bg-color);
    color: var(--text-main);
}

.form-actions {
    display: flex;
    gap: 15px;
    justify-content: flex-end;
}

.btn-secondary {
    background: transparent;
    border: 1px solid var(--card-border);
    color: var(--text-muted);
    padding: 12px 24px;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s ease;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
}

/* Actions in tables */
.table-actions {
    display: flex;
    gap: 8px;
}

.btn-icon {
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    padding: 5px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.btn-icon:hover {
    color: var(--primary);
    background: rgba(157, 78, 221, 0.1);
}

.btn-icon.success:hover { color: var(--success); background: rgba(82, 183, 136, 0.1); }
.btn-icon.danger:hover { color: var(--danger); background: rgba(255, 90, 95, 0.1); }

/* Login Page Styling */
.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}

.login-card {
    width: 100%;
    max-width: 420px;
    padding: 40px;
}

.login-logo {
    text-align: center;
    margin-bottom: 30px;
}

.login-logo h1 {
    font-size: 2rem;
    background: linear-gradient(45deg, var(--secondary), var(--primary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 700;
}

.login-logo p {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-top: 5px;
}

/* Toast Messages */
.messages-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.alert {
    padding: 16px 24px;
    border-radius: 10px;
    color: white;
    font-weight: 500;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    min-width: 300px;
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    animation: slideIn 0.3s ease-out;
}

.alert.success { background: rgba(82, 183, 136, 0.85); border-left: 5px solid var(--success); }
.alert.error { background: rgba(255, 90, 95, 0.85); border-left: 5px solid var(--danger); }
.alert.warning { background: rgba(255, 209, 102, 0.85); border-left: 5px solid var(--warning); }

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* Filter controls */
.filter-bar {
    display: flex;
    gap: 10px;
    margin-bottom: 25px;
}

.filter-btn {
    padding: 8px 16px;
    border-radius: 8px;
    border: 1px solid var(--card-border);
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s ease;
}

.filter-btn:hover, .filter-btn.active {
    background: rgba(197, 168, 128, 0.2);
    color: var(--text-main);
    border-color: var(--primary);
}

/* Toggle Sidebar transition styles */
#sidebar {
    transition: transform var(--transition-speed) ease !important;
}
#main-content {
    transition: margin-left var(--transition-speed) ease !important;
}
.collapsed-sidebar #sidebar {
    transform: translateX(-100%) !important;
}
.collapsed-sidebar #main-content {
    margin-left: 0 !important;
}

/* Responsive adjustments */
@media (max-width: 900px) {
    #sidebar {
        width: 70px;
    }
    #sidebar .sidebar-header h2,
    #sidebar .sidebar-menu span,
    #sidebar .sidebar-footer {
        display: none;
    }
    #main-content {
        margin-left: 70px;
    }
    .collapsed-sidebar #main-content {
        margin-left: 0 !important;
    }
    #topbar {
        padding: 0 20px;
    }
    .content-body {
        padding: 20px;
    }
}

/* RTL structural flips removed to keep the sidebar anchored to the left */


/* Light Theme Styling Overrides */
.light-theme {
    --bg-color: #FDFBF7; /* Very light warm cream */
    --card-bg: rgba(255, 255, 255, 0.95);
    --card-border: rgba(189, 163, 130, 0.3); /* Warmer border */
    --card-border-hover: rgba(189, 163, 130, 0.6);
    
    --primary: #8A6E59; /* Darker Bronze for contrast */
    --primary-glow: rgba(138, 110, 89, 0.3);
    --secondary: #A1826B; /* Medium Bronze */
    --accent: #D4AF37; /* Elegant gold accent */
    
    --text-main: #2C2825; /* Very dark charcoal for high readability */
    --text-muted: #6B635A; /* Medium muted brown/grey */
    
    --input-bg: #FFFFFF;
    --sidebar-bg: #FFFFFF;
}

.light-theme body {
    background-image: 
        radial-gradient(at 10% 20%, rgba(138, 110, 89, 0.05) 0px, transparent 50%),
        radial-gradient(at 90% 80%, rgba(189, 163, 130, 0.05) 0px, transparent 50%);
}

.light-theme #sidebar {
    background: var(--sidebar-bg);
}

.light-theme .form-control {
    background: var(--input-bg);
    color: var(--text-main);
    border-color: var(--card-border);
}

.light-theme .form-control:focus {
    background: #ffffff;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

.light-theme .sidebar-menu li a:hover, 
.light-theme .sidebar-menu li.active a {
    background: linear-gradient(135deg, rgba(161, 130, 107, 0.15) 0%, rgba(189, 163, 130, 0.05) 100%);
    color: var(--primary);
}

.light-theme .btn-primary {
    color: #ffffff; /* Contrast text on primary button */
}

.light-theme #topbar {
    background: rgba(255, 255, 255, 0.6);
}

.light-theme th {
    border-bottom-color: var(--card-border);
}

.light-theme .glass {
    background: rgba(255, 255, 255, 0.92) !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.03);
}

.light-theme .glass:hover {
    box-shadow: 0 8px 32px 0 rgba(138, 110, 89, 0.1);
}

.light-theme .btn-secondary:hover {
    background: rgba(0, 0, 0, 0.05);
}

.light-theme .btn-icon:hover {
    background: rgba(0, 0, 0, 0.05);
}
