/* ============================================
   Salon & Spa Management System — Stylesheet
   Theme: White + Soft Gold + Dark Navy
   ============================================ */

/* --- CSS Variables --- */
:root {
    --primary: #1a1a2e;
    --primary-light: #16213e;
    --accent: #d4a84b;
    --accent-light: #f5e6cc;
    --accent-hover: #c4952e;
    --danger: #e94560;
    --success: #2ecc71;
    --warning: #f39c12;
    --info: #3498db;
    --secondary: #95a5a6;
    --bg: #f4f6f9;
    --white: #ffffff;
    --text: #2c3e50;
    --text-light: #7f8c8d;
    --border: #e0e0e0;
    --shadow: 0 2px 12px rgba(0,0,0,0.08);
    --shadow-lg: 0 8px 30px rgba(0,0,0,0.12);
    --radius: 12px;
    --radius-sm: 8px;
    --sidebar-width: 260px;
    --topbar-height: 65px;
    --transition: all 0.3s cubic-bezier(.4,0,.2,1);
    --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* --- Reset & Base --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; scroll-behavior: smooth; }
body { font-family: var(--font); background: var(--bg); color: var(--text); line-height: 1.6; overflow-x: hidden; }
a { text-decoration: none; color: inherit; }
img { max-width: 100%; }
table { border-collapse: collapse; width: 100%; }
button, input, select, textarea { font-family: var(--font); font-size: 0.95rem; }

/* --- Scrollbar --- */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--accent); border-radius: 3px; }

/* ============================================
   SIDEBAR
   ============================================ */
.sidebar {
    position: fixed; top: 0; left: 0; width: var(--sidebar-width); height: 100vh;
    background: linear-gradient(180deg, var(--primary) 0%, var(--primary-light) 100%);
    z-index: 1000; display: flex; flex-direction: column; transition: var(--transition);
    box-shadow: 4px 0 20px rgba(0,0,0,0.15);
}
.sidebar-brand {
    padding: 20px; display: flex; align-items: center; gap: 12px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}
.brand-icon {
    width: 42px; height: 42px; background: linear-gradient(135deg, var(--accent), var(--accent-hover));
    border-radius: 10px; display: flex; align-items: center; justify-content: center;
    font-size: 1.3rem; color: var(--white); flex-shrink: 0;
}
.brand-text h2 { font-size: 0.95rem; color: var(--white); font-weight: 600; line-height: 1.2; }
.brand-text small { font-size: 0.7rem; color: rgba(255,255,255,0.5); }
.sidebar-nav { flex: 1; padding: 12px 10px; overflow-y: auto; }
.nav-link {
    display: flex; align-items: center; gap: 12px; padding: 11px 16px;
    border-radius: var(--radius-sm); color: rgba(255,255,255,0.65);
    transition: var(--transition); margin-bottom: 2px; font-size: 0.9rem; font-weight: 500;
}
.nav-link:hover { background: rgba(255,255,255,0.08); color: var(--white); }
.nav-link.active { background: linear-gradient(135deg, var(--accent), var(--accent-hover)); color: var(--white); box-shadow: 0 4px 12px rgba(212,168,75,0.3); }
.nav-icon { width: 20px; height: 20px; flex-shrink: 0; }
.nav-icon svg { width: 100%; height: 100%; }
.nav-divider { height: 1px; background: rgba(255,255,255,0.08); margin: 12px 0; }
.nav-link-logout:hover { background: rgba(233,69,96,0.2); color: var(--danger); }

/* Sidebar overlay for mobile */
.sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 999; }

/* ============================================
   TOPBAR
   ============================================ */
.main-wrapper { margin-left: var(--sidebar-width); min-height: 100vh; transition: var(--transition); }
.topbar {
    position: sticky; top: 0; height: var(--topbar-height);
    background: rgba(255,255,255,0.95); backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border); display: flex; align-items: center;
    padding: 0 24px; gap: 16px; z-index: 100;
}
.hamburger { display: none; background: none; border: none; cursor: pointer; padding: 6px; flex-direction: column; gap: 5px; }
.hamburger span { width: 24px; height: 2.5px; background: var(--text); border-radius: 2px; transition: var(--transition); }
.topbar-title { flex: 1; }
.topbar-title h1 { font-size: 1.25rem; font-weight: 700; color: var(--primary); }
.user-info { display: flex; align-items: center; gap: 10px; }
.user-avatar {
    width: 38px; height: 38px; border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--accent-hover));
    color: var(--white); display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 0.9rem;
}
.user-details { display: flex; flex-direction: column; }
.user-name { font-size: 0.85rem; font-weight: 600; color: var(--text); }
.user-role { font-size: 0.7rem; color: var(--text-light); text-transform: uppercase; letter-spacing: 0.5px; }

/* ============================================
   MAIN CONTENT
   ============================================ */
.content { padding: 24px; min-height: calc(100vh - var(--topbar-height) - 60px); animation: fadeIn 0.4s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

.footer { padding: 16px 24px; text-align: center; font-size: 0.8rem; color: var(--text-light); border-top: 1px solid var(--border); }

/* ============================================
   CARDS
   ============================================ */
.card {
    background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow);
    padding: 24px; transition: var(--transition); border: 1px solid transparent;
}
.card:hover { box-shadow: var(--shadow-lg); border-color: var(--accent-light); }
.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; flex-wrap: wrap; gap: 12px; }
.card-header h2 { font-size: 1.1rem; font-weight: 700; color: var(--primary); }

/* Stat Cards */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 20px; margin-bottom: 24px; }
.stat-card {
    background: var(--white); border-radius: var(--radius); padding: 22px;
    display: flex; align-items: center; gap: 16px; box-shadow: var(--shadow);
    border-left: 4px solid var(--accent); transition: var(--transition); position: relative; overflow: hidden;
}
.stat-card::after {
    content: ''; position: absolute; top: -20px; right: -20px; width: 80px; height: 80px;
    background: linear-gradient(135deg, var(--accent-light), transparent); border-radius: 50%; opacity: 0.5;
}
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.stat-icon {
    width: 52px; height: 52px; border-radius: 12px; display: flex; align-items: center;
    justify-content: center; font-size: 1.5rem; flex-shrink: 0;
}
.stat-icon.gold { background: linear-gradient(135deg, var(--accent-light), #fceabb); color: var(--accent-hover); }
.stat-icon.green { background: linear-gradient(135deg, #d4efdf, #a9dfbf); color: #27ae60; }
.stat-icon.red { background: linear-gradient(135deg, #fadbd8, #f1948a); color: #c0392b; }
.stat-icon.blue { background: linear-gradient(135deg, #d6eaf8, #85c1e9); color: #2980b9; }
.stat-icon.purple { background: linear-gradient(135deg, #e8daef, #c39bd3); color: #8e44ad; }
.stat-info h3 { font-size: 1.6rem; font-weight: 700; color: var(--primary); line-height: 1.2; }
.stat-info p { font-size: 0.8rem; color: var(--text-light); font-weight: 500; margin-top: 2px; }

/* ============================================
   TABLES
   ============================================ */
.table-wrapper { overflow-x: auto; border-radius: var(--radius-sm); }
table { width: 100%; }
table thead th {
    background: var(--primary); color: var(--white); padding: 13px 16px;
    text-align: left; font-size: 0.8rem; font-weight: 600; text-transform: uppercase;
    letter-spacing: 0.5px; white-space: nowrap;
}
table thead th:first-child { border-radius: var(--radius-sm) 0 0 0; }
table thead th:last-child { border-radius: 0 var(--radius-sm) 0 0; }
table tbody td { padding: 12px 16px; border-bottom: 1px solid var(--border); font-size: 0.9rem; vertical-align: middle; }
table tbody tr:hover { background: var(--accent-light); }
table tbody tr:last-child td { border-bottom: none; }
.table-empty { text-align: center; padding: 40px !important; color: var(--text-light); font-size: 0.95rem; }

/* ============================================
   FORMS
   ============================================ */
.form-group { margin-bottom: 18px; }
.form-group label { display: block; font-size: 0.85rem; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.form-control {
    width: 100%; padding: 12px 16px; border: 2px solid var(--border); border-radius: var(--radius-sm);
    font-size: 0.95rem; transition: var(--transition); background: var(--white); color: var(--text);
}
.form-control:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(212,168,75,0.15); }
select.form-control { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%237f8c8d' d='M6 8.825L1.175 4 2.238 2.938 6 6.7 9.763 2.937 10.825 4z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 40px; }
textarea.form-control { resize: vertical; min-height: 80px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-inline { display: flex; gap: 12px; align-items: end; flex-wrap: wrap; }
.form-inline .form-group { margin-bottom: 0; }

/* ============================================
   BUTTONS
   ============================================ */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 12px 24px; border-radius: var(--radius-sm); font-size: 0.9rem; font-weight: 600;
    border: none; cursor: pointer; transition: var(--transition); white-space: nowrap;
    min-height: 44px; text-decoration: none;
}
.btn-primary { background: linear-gradient(135deg, var(--accent), var(--accent-hover)); color: var(--white); }
.btn-primary:hover { box-shadow: 0 4px 15px rgba(212,168,75,0.4); transform: translateY(-1px); }
.btn-dark { background: var(--primary); color: var(--white); }
.btn-dark:hover { background: var(--primary-light); }
.btn-danger { background: var(--danger); color: var(--white); }
.btn-danger:hover { background: #c0392b; }
.btn-success { background: var(--success); color: var(--white); }
.btn-success:hover { background: #27ae60; }
.btn-outline { background: transparent; border: 2px solid var(--accent); color: var(--accent-hover); }
.btn-outline:hover { background: var(--accent); color: var(--white); }
.btn-sm { padding: 8px 16px; font-size: 0.8rem; min-height: 36px; }
.btn-group { display: flex; gap: 8px; flex-wrap: wrap; }

/* ============================================
   BADGES
   ============================================ */
.badge {
    display: inline-block; padding: 4px 12px; border-radius: 20px; font-size: 0.75rem;
    font-weight: 600; text-transform: uppercase; letter-spacing: 0.3px;
}
.badge-success { background: #d4efdf; color: #27ae60; }
.badge-danger { background: #fadbd8; color: #c0392b; }
.badge-warning { background: #fef9e7; color: #f39c12; }
.badge-info { background: #d6eaf8; color: #2980b9; }
.badge-secondary { background: #eaecee; color: #7f8c8d; }

/* ============================================
   ALERTS
   ============================================ */
.alert {
    display: flex; align-items: center; gap: 12px; padding: 14px 20px;
    border-radius: var(--radius-sm); margin-bottom: 20px;
    animation: slideDown 0.4s ease; font-size: 0.9rem; font-weight: 500;
}
@keyframes slideDown { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }
.alert-success { background: #d4efdf; color: #1e8449; border-left: 4px solid var(--success); }
.alert-error { background: #fadbd8; color: #922b21; border-left: 4px solid var(--danger); }
.alert-icon { font-size: 1.1rem; font-weight: 700; }
.alert-close { margin-left: auto; background: none; border: none; font-size: 1.3rem; cursor: pointer; color: inherit; opacity: 0.6; }
.alert-close:hover { opacity: 1; }

/* ============================================
   MODALS
   ============================================ */
.modal-overlay {
    display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5);
    z-index: 2000; align-items: center; justify-content: center; padding: 20px;
    backdrop-filter: blur(4px);
}
.modal-overlay.active { display: flex; }
.modal {
    background: var(--white); border-radius: var(--radius); width: 100%;
    max-width: 560px; max-height: 90vh; overflow-y: auto; box-shadow: var(--shadow-lg);
    animation: modalIn 0.3s ease;
}
@keyframes modalIn { from { opacity: 0; transform: scale(0.95); } to { opacity: 1; transform: scale(1); } }
.modal-header {
    padding: 20px 24px; border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
}
.modal-header h3 { font-size: 1.1rem; font-weight: 700; color: var(--primary); }
.modal-close { background: none; border: none; font-size: 1.5rem; cursor: pointer; color: var(--text-light); padding: 4px; }
.modal-close:hover { color: var(--danger); }
.modal-body { padding: 24px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }

/* ============================================
   PAGINATION
   ============================================ */
.pagination { display: flex; align-items: center; justify-content: center; gap: 6px; margin-top: 20px; }
.page-btn {
    padding: 8px 14px; border-radius: var(--radius-sm); font-size: 0.85rem;
    font-weight: 500; color: var(--text); background: var(--white); border: 1px solid var(--border);
    cursor: pointer; transition: var(--transition); text-decoration: none;
}
.page-btn:hover { border-color: var(--accent); color: var(--accent-hover); }
.page-btn.active { background: var(--accent); color: var(--white); border-color: var(--accent); }

/* ============================================
   TOOLBAR (filters + search)
   ============================================ */
.toolbar { display: flex; align-items: end; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.toolbar .form-group { margin-bottom: 0; flex: 1; min-width: 160px; }
.search-box { position: relative; }
.search-box input { padding-left: 40px; }
.search-box::before {
    content: '🔍'; position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
    font-size: 0.9rem; pointer-events: none;
}

/* ============================================
   CHART CONTAINERS
   ============================================ */
.charts-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 24px; }
.chart-card { background: var(--white); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); }
.chart-card h3 { font-size: 1rem; font-weight: 700; color: var(--primary); margin-bottom: 16px; }
.chart-container { position: relative; height: 300px; }

/* ============================================
   LOGIN PAGE
   ============================================ */
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 50%, #0f3460 100%); padding: 20px; }
.login-card {
    background: var(--white); border-radius: var(--radius); padding: 40px;
    width: 100%; max-width: 420px; box-shadow: var(--shadow-lg);
    animation: modalIn 0.5s ease;
}
.login-brand { text-align: center; margin-bottom: 32px; }
.login-brand .brand-icon { width: 64px; height: 64px; margin: 0 auto 16px; font-size: 1.8rem; }
.login-brand h1 { font-size: 1.5rem; color: var(--primary); font-weight: 700; }
.login-brand p { color: var(--text-light); font-size: 0.85rem; margin-top: 4px; }
.login-error { background: #fadbd8; color: #c0392b; padding: 12px; border-radius: var(--radius-sm); margin-bottom: 16px; text-align: center; font-size: 0.9rem; }

/* ============================================
   ATTENDANCE TABLE CUSTOM
   ============================================ */
.attendance-grid { display: grid; gap: 12px; }
.attendance-row {
    display: flex; align-items: center; gap: 16px; background: var(--white);
    padding: 14px 20px; border-radius: var(--radius-sm); box-shadow: var(--shadow);
    border-left: 4px solid var(--accent);
}
.attendance-row .emp-name { flex: 1; font-weight: 600; font-size: 0.95rem; }
.attendance-row select { min-width: 140px; }

/* ============================================
   LOADING SPINNER
   ============================================ */
.spinner { display: inline-block; width: 20px; height: 20px; border: 3px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading-overlay {
    position: fixed; inset: 0; background: rgba(255,255,255,0.8); display: none;
    align-items: center; justify-content: center; z-index: 3000; flex-direction: column; gap: 12px;
}
.loading-overlay.active { display: flex; }
.loading-overlay .spinner { width: 40px; height: 40px; border-width: 4px; }

/* ============================================
   PRINT STYLES
   ============================================ */
@media print {
    .sidebar, .topbar, .hamburger, .footer, .toolbar, .btn, .sidebar-overlay, .no-print { display: none !important; }
    .main-wrapper { margin-left: 0 !important; }
    .content { padding: 0 !important; }
    .card { box-shadow: none !important; border: 1px solid #ddd !important; }
    table thead th { background: #333 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .badge { border: 1px solid currentColor; }
    body { font-size: 12px; }
    .stats-grid, .charts-grid { display: none !important; }
    .print-header { display: block !important; text-align: center; margin-bottom: 20px; }
    .print-header h2 { font-size: 1.3rem; }
    .print-header p { font-size: 0.85rem; color: #666; }
}
.print-header { display: none; }

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 1024px) {
    .charts-grid { grid-template-columns: 1fr; }
    .form-row { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .sidebar-overlay.open { display: block; }
    .main-wrapper { margin-left: 0; }
    .hamburger { display: flex; }
    .content { padding: 16px; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .stat-card { padding: 16px; }
    .stat-icon { width: 42px; height: 42px; font-size: 1.2rem; }
    .stat-info h3 { font-size: 1.3rem; }
    .topbar { padding: 0 16px; }
    .topbar-title h1 { font-size: 1.05rem; }
    .user-details { display: none; }
    .toolbar { flex-direction: column; align-items: stretch; }
    .toolbar .form-group { min-width: unset; }
    .modal { max-width: 95vw; }
    .attendance-row { flex-direction: column; align-items: stretch; gap: 8px; }
    .attendance-row select { min-width: unset; }
}
@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr; }
    .btn-group { flex-direction: column; }
    .btn { width: 100%; }
    .card { padding: 16px; }
    table { font-size: 0.8rem; }
    table thead th, table tbody td { padding: 10px 12px; }
}

/* ============================================
   UTILITY CLASSES
   ============================================ */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-gold { color: var(--accent); }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.text-muted { color: var(--text-light); }
.fw-bold { font-weight: 700; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.d-flex { display: flex; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }
.w-100 { width: 100%; }
.grand-total-row td { background: var(--accent-light) !important; font-weight: 700 !important; font-size: 1rem; }
.sub-total-row td { background: #f0f0f0 !important; font-weight: 600 !important; }

/* ============================================
   EXCEL EXPORT BUTTON
   ============================================ */
.btn-excel { background: linear-gradient(135deg, #27ae60, #2ecc71); color: var(--white); }
.btn-excel:hover { box-shadow: 0 4px 15px rgba(46,204,113,0.4); transform: translateY(-1px); }

/* ============================================
   AUTOCOMPLETE DROPDOWN
   ============================================ */
.autocomplete-wrapper { position: relative; }
.autocomplete-dropdown {
    position: absolute; top: 100%; left: 0; right: 0; z-index: 1050;
    background: var(--white); border: 2px solid var(--accent); border-top: none;
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
    max-height: 220px; overflow-y: auto; display: none;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
}
.autocomplete-dropdown.show { display: block; }
.autocomplete-item {
    padding: 10px 16px; cursor: pointer; transition: var(--transition);
    border-bottom: 1px solid var(--border); display: flex; flex-direction: column; gap: 2px;
}
.autocomplete-item:last-child { border-bottom: none; }
.autocomplete-item:hover, .autocomplete-item.highlighted { background: var(--accent-light); }
.autocomplete-item .ac-name { font-weight: 600; font-size: 0.9rem; color: var(--text); }
.autocomplete-item .ac-detail { font-size: 0.75rem; color: var(--text-light); }

/* ============================================
   IMPORT UPLOAD AREA
   ============================================ */
.import-upload-area {
    border: 2px dashed var(--accent); border-radius: var(--radius);
    padding: 40px 20px; text-align: center; cursor: pointer;
    transition: var(--transition); background: var(--bg);
}
.import-upload-area:hover, .import-upload-area.dragover {
    border-color: var(--accent-hover); background: var(--accent-light);
    transform: scale(1.01);
}
.import-upload-area .upload-icon { font-size: 2.5rem; margin-bottom: 8px; }
.import-upload-area .upload-text { font-size: 0.9rem; color: var(--text-light); font-weight: 500; }
.import-upload-area .upload-text strong { color: var(--accent-hover); }

#importPreview { margin-top: 20px; }
#importStats { font-size: 0.85rem; font-weight: 600; color: var(--text); margin-bottom: 10px; }
#importPreviewTable .badge { font-size: 0.7rem; }
