/* ==========================================
   AE Pro Design System (Linear/Stripe Style)
   ========================================== */
:root {
    --bg-color: #f8fafc;
    --surface-color: #ffffff;
    --surface-hover: #f1f5f9;
    --border-color: #e2e8f0;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --danger: #ef4444;
    --success: #10b981;
    --warning: #f59e0b;
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(0, 0, 0, 0.05);
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
}

[data-theme="dark"] {
    --bg-color: #09090b;
    --surface-color: #18181b;
    --surface-hover: #27272a;
    --border-color: rgba(255, 255, 255, 0.1);
    --text-main: #f4f4f5;
    --text-muted: #a1a1aa;
    --glass-bg: rgba(24, 24, 27, 0.6);
    --glass-border: rgba(255, 255, 255, 0.08);
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

* { box-sizing: border-box; margin: 0; padding: 0; font-family: 'Inter', system-ui, -apple-system, sans-serif; }
body { background-color: var(--bg-color); color: var(--text-main); line-height: 1.5; transition: background-color 0.3s, color 0.3s; overflow-x: hidden; }

/* Typography */
.gradient-text { background: linear-gradient(135deg, #818cf8, #c084fc); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.font-bold { font-weight: 700; }
.text-sm { font-size: 0.875rem; }
.text-lg { font-size: 1.125rem; }
.text-2xl { font-size: 1.5rem; }
.text-3xl { font-size: 2rem; }
.text-5xl { font-size: 3rem; }
.text-muted { color: var(--text-muted); }
.text-primary { color: var(--primary); }
.text-center { text-align: center; }
.text-right { text-align: right; }
.whitespace-nowrap { white-space: nowrap; }

/* Utilities */
.hidden { display: none !important; }
.w-full { width: 100%; }
.max-w-600 { max-width: 600px; margin: 0 auto; }
.max-w-800 { max-width: 800px; margin: 0 auto; }
.max-w-1200 { max-width: 1200px; margin: 0 auto; }
.mx-auto { margin-left: auto; margin-right: auto; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.mb-8 { margin-bottom: 2rem; }
.mt-1 { margin-top: 0.25rem; }
.mt-4 { margin-top: 1rem; }
.mt-6 { margin-top: 1.5rem; }
.mt-10 { margin-top: 3rem; }
.pb-2 { padding-bottom: 0.5rem; }
.pb-4 { padding-bottom: 1rem; }
.pt-4 { padding-top: 1rem; }
.border-b { border-bottom: 1px solid var(--border-color); }
.border-t { border-top: 1px solid var(--border-color); }
.bg-alt { background-color: var(--surface-hover); }
.bg-surface { background-color: var(--surface-color); }
.border { border: 1px solid var(--border-color); }
.rounded { border-radius: 8px; }
.text-danger { color: var(--danger) !important; }
.text-danger:hover { filter: brightness(0.8); }

/* Flex & Grid */
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.flex-center { display: flex; justify-content: center; align-items: center; flex-direction: column; }
.items-center { align-items: center; }
.justify-end { justify-content: flex-end; }
.gap-2 { gap: 0.5rem; }
.gap-4 { gap: 1rem; }
.gap-6 { gap: 1.5rem; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid-4 { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem;}

/* Glassmorphism Components */
.glass-panel { background: var(--glass-bg); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); border: 1px solid var(--glass-border); }
.glass-card { background: var(--surface-color); border: 1px solid var(--border-color); border-radius: 12px; padding: 1.5rem; box-shadow: var(--shadow); transition: transform 0.2s, box-shadow 0.2s; }
.glass-card:hover { border-color: var(--primary); box-shadow: 0 8px 30px rgba(99, 102, 241, 0.15); }

/* Buttons & Inputs */
.btn { padding: 0.75rem 1.5rem; border-radius: 8px; font-weight: 500; cursor: pointer; transition: all 0.2s; border: none; display: inline-flex; align-items: center; justify-content: center; text-decoration: none;}
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-hover); transform: translateY(-1px); }
.btn-outline { background: transparent; border: 1px solid var(--border-color); color: var(--text-main); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-danger { background: rgba(239, 68, 68, 0.1); color: var(--danger); border: 1px solid rgba(239, 68, 68, 0.2); }
.btn-danger:hover { background: var(--danger); color: white; }

.icon-btn { background: transparent; border: none; font-size: 1.2rem; cursor: pointer; color: var(--text-muted); display: inline-flex; align-items: center; justify-content: center; transition: color 0.2s; }
.icon-btn:hover { color: var(--primary); }
.icon-btn.text-danger:hover { color: var(--danger); }
.icon-btn svg { width: 1.2rem; height: 1.2rem; fill: currentColor; transition: fill 0.2s; }
.icon-btn svg path { fill: currentColor; }

.form-group { display: flex; flex-direction: column; margin-bottom: 1rem; text-align: left; }
.form-group label { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 0.4rem; font-weight: 500;}
input, select, textarea { width: 100%; padding: 0.75rem 1rem; border-radius: 8px; background: rgba(0,0,0,0.02); border: 1px solid var(--border-color); color: var(--text-main); outline: none; transition: 0.2s; font-size: 0.95rem; }
[data-theme="dark"] input, [data-theme="dark"] select, [data-theme="dark"] textarea { background: rgba(0,0,0,0.2); }
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2); }
.bg-disabled { opacity: 0.7; pointer-events: none; }
.search-input { max-width: 300px; margin-bottom: 0; }

/* Dashboard Layout */
.dashboard-layout { display: flex; height: 100vh; overflow: hidden; }
.sidebar { width: 260px; height: 100%; display: flex; flex-direction: column; border-right: 1px solid var(--border-color); border-radius: 0; padding: 1.5rem; z-index: 10; }
.sidebar-brand { display: flex; align-items: center; gap: 0.5rem; }
.brand-logo-small { width: 32px; height: 32px; border-radius: 8px; }
.sidebar-nav a { display: block; padding: 0.8rem 1rem; color: var(--text-muted); text-decoration: none; border-radius: 8px; margin-bottom: 0.5rem; transition: 0.2s; font-weight: 500;}
.sidebar-nav a:hover, .sidebar-nav a.active { background: rgba(99, 102, 241, 0.1); color: var(--primary); }
.main-content { flex: 1; display: flex; flex-direction: column; overflow-y: auto; padding: 2rem; }
.topbar { padding: 1rem 1.5rem; border-radius: 12px; margin-bottom: 2rem; }

/* Tables */
.table-wrapper { overflow-x: auto; padding: 0; }
.data-table { width: 100%; border-collapse: collapse; text-align: left; }
.data-table th, .data-table td { padding: 1rem 1.5rem; border-bottom: 1px solid var(--border-color); }
.data-table th { color: var(--text-muted); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.05em; background: rgba(0,0,0,0.02); }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: rgba(255,255,255,0.02); }
.badge { padding: 0.25rem 0.6rem; border-radius: 99px; font-size: 0.75rem; font-weight: 600; display: inline-block; }
.badge.pending { background: rgba(245, 158, 11, 0.1); color: var(--warning); }
.badge.completed { background: rgba(16, 185, 129, 0.1); color: var(--success); }
.badge.inprogress { background: rgba(99, 102, 241, 0.1); color: var(--primary); }
.badge.cancelled { background: rgba(239, 68, 68, 0.1); color: var(--danger); }

/* Modals & Toasts */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.6); backdrop-filter: blur(4px); display: flex; justify-content: center; align-items: center; z-index: 1000; padding: 1rem;}
.modal-content { width: 100%; max-height: 90vh; overflow-y: auto; }

#toast-container { position: fixed; bottom: 1.5rem; right: 1.5rem; z-index: 9999; display: flex; flex-direction: column; gap: 0.5rem; }
.toast { background: var(--surface-color); border-left: 4px solid var(--primary); padding: 1rem 1.5rem; border-radius: 8px; box-shadow: 0 10px 30px rgba(0,0,0,0.2); animation: slideIn 0.3s forwards; display: flex; align-items: center; font-weight: 500; }
.toast.error { border-left-color: var(--danger); }

/* Animations */
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes pulse { 0% { opacity: 1; } 50% { opacity: 0.5; } 100% { opacity: 1; } }
@keyframes spin { to { transform: rotate(360deg); } }

.animate-fade-in { animation: fadeIn 0.4s ease-out forwards; }
.animate-slide-up { animation: slideUp 0.3s ease-out forwards; }
.spinner { width: 20px; height: 20px; border: 2px solid var(--border-color); border-top-color: var(--primary); border-radius: 50%; animation: spin 0.8s linear infinite; }
.skeleton-loader { background: var(--surface-hover); border-radius: 8px; animation: pulse 1.5s infinite; height: 40px; width: 100%; }

/* Public UI Specifics */
.public-layout { padding-top: 0; }
.sticky { position: sticky; top: 0; z-index: 100; border-radius: 0; border-left: none; border-right: none; border-top: none;}
.nav-container { padding: 1rem 2rem; }
.nav-link { color: var(--text-main); text-decoration: none; font-weight: 500; transition: 0.2s; }
.nav-link:hover { color: var(--primary); }
.hero-section { min-height: 70vh; padding: 2rem; position: relative; overflow: hidden;}
.hero-section::before { content:''; position:absolute; top:-50%; left:-50%; width:200%; height:200%; background: radial-gradient(circle, rgba(99,102,241,0.1) 0%, transparent 60%); z-index: -1; }
.section-padding { padding: 5rem 2rem; }
.shadow-glow { box-shadow: 0 0 20px rgba(99, 102, 241, 0.4); }

/* Floating WhatsApp */
.wa-float { position: fixed; bottom: 30px; left: 30px; background-color: #25d366; color: white; border-radius: 50px; width: 60px; height: 60px; display: flex; justify-content: center; align-items: center; z-index: 100; transition: transform 0.2s; }
.wa-float:hover { transform: scale(1.1); }

/* Print Styles */
.print-only { display: none; }
@media print {
    body { background: white; color: black; }
    .no-print, .sidebar, .topbar, .wa-float, .public-navbar { display: none !important; }
    .print-only { display: block !important; padding: 2rem; }
    .dashboard-layout { display: block; height: auto; overflow: visible; }
    .main-content { padding: 0; overflow: visible;}
}

@media (max-width: 768px) {
    .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; }
    .hidden-mobile { display: none; }
    .dashboard-layout { flex-direction: column; }
    .sidebar { width: 100%; height: auto; border-right: none; border-bottom: 1px solid var(--border-color); padding: 1rem; flex-direction: row; justify-content: space-between; align-items: center; }
    .sidebar-nav { display: none; }
    .sidebar-footer { margin-top: 0; }
}