/* ============================================================
   Temposy Admin Dashboard — Styles
   ============================================================ */

* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif; background: #f5f7fa; min-height: 100vh; }

/* Login */
.login-container { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); }
.login-box { background: white; padding: 40px; border-radius: 16px; box-shadow: 0 20px 60px rgba(0,0,0,0.2); width: 100%; max-width: 400px; }
.login-logo { text-align: center; margin-bottom: 32px; }
.login-logo h1 { font-size: 28px; font-weight: 700; color: #1a1a2e; }
.login-logo span { color: #667eea; }
.login-logo p { color: #666; margin-top: 8px; font-size: 14px; }
.form-group { margin-bottom: 20px; }
.form-group label { display: block; margin-bottom: 8px; font-weight: 500; color: #333; font-size: 14px; }
.form-group input { width: 100%; padding: 14px 16px; border: 2px solid #e0e0e0; border-radius: 10px; font-size: 16px; transition: border-color 0.2s, box-shadow 0.2s; }
.form-group input:focus { outline: none; border-color: #667eea; box-shadow: 0 0 0 3px rgba(102,126,234,0.1); }
.login-btn { width: 100%; padding: 14px; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); color: white; border: none; border-radius: 10px; font-size: 16px; font-weight: 600; cursor: pointer; transition: transform 0.2s, box-shadow 0.2s; }
.login-btn:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(102,126,234,0.4); }
.login-btn:disabled { opacity: 0.7; cursor: not-allowed; transform: none; }
.login-error { background: #fee2e2; color: #dc2626; padding: 12px 16px; border-radius: 8px; margin-bottom: 20px; font-size: 14px; display: none; }

/* Dashboard Layout */
.dashboard-container { display: none; }
.sidebar { position: fixed; left: 0; top: 0; width: 260px; height: 100vh; background: #1a1a2e; padding: 24px; color: white; z-index: 40; overflow-y: hidden; transition: transform 0.3s ease; display: flex; flex-direction: column; }
.sidebar-menu-wrapper { flex: 1; overflow-y: auto; min-height: 0; padding-bottom: 8px; }
.sidebar-menu-wrapper::-webkit-scrollbar { width: 4px; }
.sidebar-menu-wrapper::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 4px; }
.sidebar-menu-wrapper::-webkit-scrollbar-track { background: transparent; }
.sidebar-logo { font-size: 24px; font-weight: 700; margin-bottom: 40px; flex-shrink: 0; }
.sidebar-logo span { color: #667eea; }
.sidebar-section-label { font-size: 10px; text-transform: uppercase; letter-spacing: 1px; color: #555; margin: 20px 0 8px 16px; font-weight: 600; list-style: none; }
.sidebar-menu { list-style: none; }
.sidebar-menu li { margin-bottom: 4px; }
.sidebar-menu a { display: flex; align-items: center; padding: 12px 16px; color: #a0a0a0; text-decoration: none; border-radius: 10px; transition: all 0.2s; font-weight: 500; font-size: 14px; }
.sidebar-menu a:hover, .sidebar-menu a.active { background: rgba(102,126,234,0.2); color: white; }
.sidebar-menu svg { width: 20px; height: 20px; margin-right: 12px; flex-shrink: 0; }
.logout-btn { margin-top: 16px; padding: 12px; background: rgba(220,38,38,0.2); color: #ef4444; border: none; border-radius: 10px; cursor: pointer; font-weight: 500; transition: background 0.2s; font-size: 14px; width: 100%; flex-shrink: 0; }
.logout-btn:hover { background: rgba(220,38,38,0.3); }
.main-content { margin-left: 260px; padding: 32px; min-height: 100vh; }

/* Mobile */
.mobile-header { display: none; position: fixed; top: 0; left: 0; right: 0; height: 56px; background: #1a1a2e; z-index: 50; align-items: center; padding: 0 16px; }
.mobile-header button { background: none; border: none; color: white; cursor: pointer; }
.mobile-header .logo { color: white; font-size: 20px; font-weight: 700; margin-left: 12px; }
.mobile-header .logo span { color: #667eea; }
.sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 39; }

.page-section { display: none; }
.page-section.active { display: block; }

/* Tables */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th, .data-table td { padding: 14px 20px; text-align: left; }
.data-table th { background: #f8f9fa; color: #666; font-weight: 500; font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px; }
.data-table td { border-bottom: 1px solid #f0f0f0; font-size: 14px; color: #333; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: #f8f9fa; }
.data-table tr.clickable { cursor: pointer; }

/* Badges */
.badge { display: inline-block; padding: 4px 10px; border-radius: 20px; font-size: 12px; font-weight: 500; white-space: nowrap; }
.badge.success { background: rgba(16,185,129,0.1); color: #10b981; }
.badge.warning { background: rgba(245,158,11,0.1); color: #f59e0b; }
.badge.danger { background: rgba(239,68,68,0.1); color: #ef4444; }
.badge.info { background: rgba(59,130,246,0.1); color: #3b82f6; }
.badge.premium { background: rgba(139,92,246,0.1); color: #8b5cf6; }

/* Loading */
.loading { text-align: center; padding: 40px; color: #666; }
.loading::after { content: ''; display: inline-block; width: 20px; height: 20px; border: 2px solid #667eea; border-top-color: transparent; border-radius: 50%; animation: spin 0.8s linear infinite; margin-left: 10px; vertical-align: middle; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Toast Notifications */
.toast-container { position: fixed; top: 24px; right: 24px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; }
.toast { padding: 14px 20px; border-radius: 10px; color: white; font-size: 14px; font-weight: 500; box-shadow: 0 4px 20px rgba(0,0,0,0.15); animation: slideIn 0.3s ease; min-width: 280px; max-width: 400px; }
.toast.success { background: #10b981; }
.toast.error { background: #ef4444; }
.toast.info { background: #667eea; }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* Modal / Slide Panel */
.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 100; justify-content: flex-end; }
.modal-overlay.open { display: flex; }
.slide-panel { width: 560px; max-width: 100vw; background: white; height: 100vh; overflow-y: auto; animation: slidePanel 0.3s ease; box-shadow: -4px 0 20px rgba(0,0,0,0.1); }
@keyframes slidePanel { from { transform: translateX(100%); } to { transform: translateX(0); } }

/* Toggle Switch */
.toggle-switch { position: relative; width: 48px; height: 26px; display: inline-block; cursor: pointer; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider { position: absolute; inset: 0; background: #ccc; border-radius: 26px; transition: 0.3s; }
.toggle-slider::before { content: ''; position: absolute; width: 20px; height: 20px; left: 3px; bottom: 3px; background: white; border-radius: 50%; transition: 0.3s; }
.toggle-switch input:checked + .toggle-slider { background: #667eea; }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(22px); }

/* Stat Icons */
.stat-icon { width: 48px; height: 48px; border-radius: 12px; display: flex; align-items: center; justify-content: center; margin-bottom: 16px; }
.stat-icon.users { background: rgba(59,130,246,0.1); color: #3b82f6; }
.stat-icon.events { background: rgba(16,185,129,0.1); color: #10b981; }
.stat-icon.bookings { background: rgba(245,158,11,0.1); color: #f59e0b; }
.stat-icon.revenue { background: rgba(139,92,246,0.1); color: #8b5cf6; }
.stat-icon.premium { background: rgba(236,72,153,0.1); color: #ec4899; }
.stat-icon.fees { background: rgba(249,115,22,0.1); color: #f97316; }
.stat-icon.moments { background: rgba(6,182,212,0.1); color: #06b6d4; }
.stat-icon.momentbookings { background: rgba(168,85,247,0.1); color: #a855f7; }
.stat-icon.payouts { background: rgba(59,130,246,0.1); color: #3b82f6; }

/* Section titles */
.section-title { font-size: 16px; font-weight: 600; color: #1f2937; margin-bottom: 16px; margin-top: 8px; padding-bottom: 8px; border-bottom: 2px solid rgba(102,126,234,0.15); }

/* Quick Action Cards */
.quick-action-card {
    background: white; border-radius: 16px; padding: 20px; box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    cursor: pointer; transition: all 0.25s ease; border: 1px solid transparent; position: relative; overflow: hidden;
}
.quick-action-card:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0,0,0,0.08); border-color: rgba(102,126,234,0.2); }
.quick-action-card .qa-icon { width: 40px; height: 40px; border-radius: 10px; display: flex; align-items: center; justify-content: center; margin-bottom: 10px; font-size: 18px; }
.quick-action-card .qa-count { font-size: 24px; font-weight: 700; color: #1f2937; }
.quick-action-card .qa-label { font-size: 12px; color: #6b7280; margin-top: 2px; }
.quick-action-card .qa-arrow { position: absolute; right: 16px; top: 50%; transform: translateY(-50%); color: #d1d5db; transition: color 0.2s, transform 0.2s; }
.quick-action-card:hover .qa-arrow { color: #667eea; transform: translateY(-50%) translateX(3px); }

/* Health */
.health-dot { width: 12px; height: 12px; border-radius: 50%; display: inline-block; }
.health-dot.ok { background: #10b981; }
.health-dot.error { background: #ef4444; }

/* Config */
.config-group { margin-bottom: 24px; }
.config-group-title { font-size: 13px; font-weight: 600; color: #667eea; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 12px; padding-bottom: 8px; border-bottom: 2px solid rgba(102,126,234,0.2); }

/* Pagination */
.pagination { display: flex; justify-content: center; align-items: center; gap: 8px; padding: 20px; }
.pagination button { padding: 8px 14px; border: 1px solid #e0e0e0; background: white; border-radius: 8px; cursor: pointer; font-size: 14px; transition: all 0.2s; }
.pagination button:hover:not(:disabled) { background: #667eea; color: white; border-color: #667eea; }
.pagination button:disabled { opacity: 0.5; cursor: not-allowed; }
.pagination .page-info { padding: 0 16px; color: #666; font-size: 14px; }

/* Tab styles */
.tab-btn { padding: 10px 20px; border: none; background: #f3f4f6; color: #6b7280; border-radius: 10px 10px 0 0; cursor: pointer; font-size: 14px; font-weight: 500; transition: all 0.2s; }
.tab-btn.active { background: white; color: #667eea; box-shadow: 0 -2px 8px rgba(0,0,0,0.05); }

/* Chart container */
.chart-card { background: white; border-radius: 16px; padding: 24px; box-shadow: 0 1px 3px rgba(0,0,0,0.06); }
.chart-card h4 { font-size: 14px; font-weight: 600; color: #374151; margin-bottom: 16px; }

/* Search bar reusable */
.search-bar { display: flex; align-items: center; background: #f3f4f6; border-radius: 10px; padding: 8px 12px; }
.search-bar svg { width: 16px; height: 16px; color: #9ca3af; flex-shrink: 0; }
.search-bar input { background: transparent; border: none; outline: none; margin-left: 8px; font-size: 14px; width: 180px; }

/* Table responsive wrapper */
.table-wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-wrapper::-webkit-scrollbar { height: 4px; }
.table-wrapper::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 4px; }

/* ============================================================
   Responsive — Tablet / Mobile (≤768px)
   ============================================================ */
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .mobile-header { display: flex; }
    .main-content { margin-left: 0; padding: 64px 12px 16px; }
    .slide-panel { width: 100vw; }

    /* Page header */
    .main-content > .flex.justify-between { flex-direction: column; gap: 12px; align-items: flex-start !important; }
    .main-content > .flex.justify-between > .flex.items-center { align-self: flex-end; }

    /* Section headers: stack title + search */
    .section-header { flex-direction: column !important; gap: 12px !important; align-items: stretch !important; }
    .search-bar { width: 100% !important; }
    .search-bar input { width: 100% !important; }

    /* Filters row */
    .filters-row { flex-direction: column !important; gap: 8px !important; align-items: stretch !important; }
    .filters-row .search-bar { width: 100% !important; }
    .filters-row select { width: 100% !important; }

    /* Tables */
    .data-table th, .data-table td { padding: 10px 12px; font-size: 12px; white-space: nowrap; }
    .data-table th { font-size: 10px; }

    /* Stat cards */
    .stat-icon { width: 36px; height: 36px; border-radius: 8px; margin-bottom: 10px; }
    .stat-icon svg { width: 18px; height: 18px; }

    /* Chart cards */
    .chart-card { padding: 16px; }
    .chart-card h4 { font-size: 13px; }
    .chart-card canvas { max-height: 250px; }

    /* Revenue split card */
    .revenue-split-row { flex-direction: column !important; gap: 4px !important; align-items: flex-start !important; }

    /* Tab buttons */
    .tab-btn { padding: 8px 14px; font-size: 13px; }

    /* Pagination */
    .pagination { padding: 12px; gap: 6px; }
    .pagination button { padding: 6px 10px; font-size: 13px; }
    .pagination .page-info { padding: 0 8px; font-size: 12px; }

    /* Toasts */
    .toast-container { top: 68px; right: 12px; left: 12px; }
    .toast { min-width: auto; max-width: 100%; font-size: 13px; padding: 10px 14px; }

    /* Config section */
    .config-group .grid { grid-template-columns: 1fr !important; }

    /* Modals */
    .slide-panel .p-6 { padding: 16px; }
    .slide-panel .px-6 { padding-left: 16px; padding-right: 16px; }

    /* Badge smaller */
    .badge { font-size: 11px; padding: 3px 8px; }

    /* Logout btn */
    .logout-btn { margin-top: 16px; }
}

/* ============================================================
   Responsive — Small Mobile (≤480px)
   ============================================================ */
@media (max-width: 480px) {
    .main-content { padding: 60px 8px 12px; }

    /* Stat cards: 2 columns on very small screens */
    .stat-grid-counts { grid-template-columns: repeat(2, 1fr) !important; }
    .stat-grid-revenue { grid-template-columns: 1fr 1fr !important; }
    .section-title { font-size: 14px; margin-top: 4px; }

    /* Rev category tables: stack */
    .rev-cat-grid { grid-template-columns: 1fr !important; }

    .data-table th, .data-table td { padding: 8px 10px; font-size: 11px; }
}
