:root {
    --primary: #6C4DFF;
    --primary-hover: #5839E6;
    --bg-dark: #0B0F1A;
    --bg-card: rgba(21, 26, 42, 0.7);
    --card-border: rgba(255, 255, 255, 0.1);
    --text-light: #F4F5F7;
    --text-muted: #A0AABF;
    --success: #1ECCA3;
    --danger: #FF4D4D;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Tajawal', sans-serif; background-color: var(--bg-dark); color: var(--text-light); line-height: 1.6; min-height: 100vh; display: flex; flex-direction: column; }
h1, h2, h3 { font-weight: 700; color: #FFF; }
p { color: var(--text-muted); }
.mt-15 { margin-top: 15px; } .mt-30 { margin-top: 30px; } .mb-30 { margin-bottom: 30px; }
.text-center { text-align: center; } .hidden { display: none !important; } .danger { color: var(--danger) !important; }

/* Buttons */
.btn { display: inline-block; padding: 12px 24px; border-radius: 8px; font-size: 1.1rem; font-weight: 700; cursor: pointer; transition: all 0.3s ease; border: none; font-family: inherit; text-align: center; }
.btn-primary { background-color: var(--primary); color: white; box-shadow: 0 4px 15px rgba(108, 77, 255, 0.4); }
.btn-primary:hover { background-color: var(--primary-hover); transform: translateY(-2px); box-shadow: 0 6px 20px rgba(108, 77, 255, 0.6); }
.btn-outline { background-color: transparent; color: var(--text-light); border: 2px solid var(--text-muted); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-block { width: 100%; padding: 15px; }

/* NAVBAR */
.navbar { background: rgba(11, 15, 26, 0.9); backdrop-filter: blur(10px); border-bottom: 1px solid var(--card-border); position: sticky; top: 0; z-index: 1000; padding: 15px 0; }
.nav-container { max-width: 1200px; margin: 0 auto; padding: 0 20px; display: flex; justify-content: space-between; align-items: center; }
.nav-logo { color: var(--primary); font-size: 1.8rem; font-weight: 800; text-decoration: none; }
.nav-logo span { color: var(--text-light); font-size: 1rem; font-weight: 400; }
.nav-links { display: flex; gap: 25px; }
.nav-link { color: var(--text-muted); text-decoration: none; font-weight: 500; font-size: 1.1rem; transition: color 0.3s ease; }
.nav-link:hover, .nav-link.active { color: var(--primary); }
.hamburger { display: none; flex-direction: column; gap: 5px; cursor: pointer; }
.hamburger span { height: 3px; width: 25px; background-color: var(--text-light); border-radius: 3px; transition: all 0.3s ease; }

/* APP WRAPPER */
.app-container { flex: 1; max-width: 1200px; margin: 0 auto; padding: 40px 20px; width: 100%; }
.page-section { opacity: 0; transform: translateY(20px); transition: opacity 0.5s ease, transform 0.5s ease; }
.page-section.active-section { opacity: 1; transform: translateY(0); display: block; }
.hidden-section { display: none; }
.card { background: var(--bg-card); backdrop-filter: blur(14px); border: 1px solid var(--card-border); border-radius: 16px; box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3); padding: 30px; }
.content-wrapper { max-width: 800px; margin: 0 auto; }

/* HERO */
.hero { display: flex; flex-direction: column; gap: 50px; }
.hero-content { text-align: center; max-width: 800px; margin: 0 auto; }
.hero-title { font-size: 2.8rem; margin-bottom: 20px; line-height: 1.4; color: #FFF; text-shadow: 0 2px 10px rgba(0,0,0,0.5); }
.hero-subtitle { font-size: 1.2rem; margin-bottom: 30px; }
.hero-video-wrapper { width: 100%; max-width: 800px; margin: 0 auto 30px auto; border-radius: 16px; overflow: hidden; border: 1px solid var(--card-border); box-shadow: 0 8px 32px rgba(0,0,0,0.3); }
.hero-actions { display: flex; justify-content: center; gap: 20px; }

/* LIVE STATS + COMMUNITY FEED */
.homepage-updates { width: 100%; margin-top: 30px; }
.stats-section-head,
.community-section-head { text-align: center; margin-bottom: 20px; }
.stats-section-head h2,
.community-section-head h2 { font-size: 1.8rem; margin-bottom: 10px; }
.stats-section-head p,
.community-section-head p { color: var(--text-muted); }
.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; }
.stats-card { background: rgba(18, 22, 45, 0.9); border: 1px solid rgba(108, 77, 255, 0.25); border-radius: 20px; padding: 25px 20px; min-height: 130px; display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; box-shadow: 0 10px 30px rgba(0,0,0,0.25); }
.stats-card-label { display: block; color: var(--text-muted); font-size: 0.95rem; margin-bottom: 12px; }
.stats-card-value { font-size: 2.2rem; color: var(--primary); line-height: 1.1; }
.community-feed-section { max-width: 700px; margin: 0 auto; padding-top: 20px; }
.feed-list { display: flex; flex-direction: column; gap: 20px; }
.feed-post-card { background: var(--bg-card); border: 1px solid var(--card-border); border-radius: 16px; padding: 20px; direction: rtl; }
.post-header { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 15px; }
.post-avatar { width: 45px; height: 45px; border-radius: 50%; background: var(--primary); color: white; display: flex; align-items: center; justify-content: center; font-size: 1.2rem; font-weight: bold; flex-shrink: 0; }
.post-author { font-weight: bold; color: #FFF; font-size: 1rem; }
.verified-badge { display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; border-radius: 50%; background: #1877F2; color: white; font-size: 0.7rem; margin-right: 5px; }
.post-time { color: var(--text-muted); font-size: 0.85rem; margin-top: 2px; }
.post-content { color: var(--text-light); font-size: 1rem; line-height: 1.8; white-space: pre-wrap; margin-bottom: 15px; }
.video-wrapper { border-radius: 12px; overflow: hidden; margin-bottom: 15px; }
.fb-wrapper { border-radius: 12px; overflow: hidden; margin-bottom: 15px; }
.post-actions { display: flex; gap: 10px; border-top: 1px solid var(--card-border); padding-top: 15px; }
.react-btn { padding: 8px 20px; border-radius: 20px; border: 1px solid var(--card-border); background: transparent; color: var(--text-muted); cursor: pointer; font-family: Tajawal; font-size: 0.95rem; transition: all 0.2s ease; }
.react-btn:hover { transform: translateY(-1px); }
.react-btn.liked { background: rgba(52,199,89,0.15); color: #34C759; border-color: #34C759; }
.react-btn.disliked { background: rgba(255,77,77,0.15); color: var(--danger); border-color: var(--danger); }

/* TIMELINE ROADMAP */
.timeline-container { display: flex; flex-direction: row; gap: 20px; position: relative; margin-top: 30px; }
.timeline-item { flex: 1; min-width: 250px; background: rgba(255, 255, 255, 0.03); border: 1px solid var(--card-border); border-radius: 12px; padding: 25px; position: relative; z-index: 1; transition: transform 0.3s; }
.timeline-item:hover { transform: translateY(-5px); background: rgba(255, 255, 255, 0.05); border-color: var(--primary); }
.timeline-dot { position: absolute; top: -10px; right: 20px; width: 20px; height: 20px; background: var(--bg-dark); border: 4px solid var(--primary); border-radius: 50%; z-index: 2; }
.timeline-container::before { content: ''; position: absolute; top: -1px; right: 30px; left: 30px; height: 2px; background: var(--primary); z-index: 0; opacity: 0.5; }
.timeline-content h3 { margin: 10px 0; font-size: 1.3rem; color: #FFF; }
.date-badge { display: inline-block; background: rgba(108, 77, 255, 0.2); color: #C4B5FD; padding: 5px 12px; border-radius: 20px; font-size: 0.85rem; font-weight: bold; }

/* FORMS & VALIDATION */
.card-header { margin-bottom: 30px; }
.form-group { margin-bottom: 20px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
label { display: block; margin-bottom: 8px; font-weight: 500; font-size: 0.95rem; color: #FFF; }
input[type="text"], input[type="tel"], select, textarea { width: 100%; padding: 14px 16px; background-color: rgba(0, 0, 0, 0.3); border: 1px solid var(--card-border); border-radius: 8px; color: var(--text-light); font-family: inherit; font-size: 1rem; transition: all 0.3s ease; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(108, 77, 255, 0.2); }
input.error-border { border-color: var(--danger) !important; box-shadow: 0 0 0 3px rgba(255, 77, 77, 0.2) !important; }
.input-helper { font-size: 0.85rem; margin-top: 5px; transition: opacity 0.3s ease; }
.slidable-field { transition: opacity 0.35s ease, transform 0.35s ease; }
.slidable-field.disabled-field { opacity: 0.6; transform: none; }
.slidable-field.disabled-field input {
    background-color: rgba(255,255,255,0.05);
    cursor: not-allowed;
}
.phone-status.loading { color: var(--text-muted); }
.phone-status.success { color: var(--success); }
.phone-status.error { color: var(--danger); font-weight: bold; }

.track-action-note { color: var(--text-muted); font-size: 0.9rem; text-align: center; margin-bottom: 20px; }
.btn-calendar { background: #FFF; color: #4285F4; border: 1px solid #4285F4; }
.btn-calendar:hover { background: rgba(66, 133, 244, 0.08); }

.checkbox-group { display: flex; align-items: center; gap: 12px; margin: 25px 0; cursor: pointer; }
.checkbox-group input[type="checkbox"] { width: 20px; height: 20px; accent-color: var(--primary); }
.checkbox-group label { margin: 0; cursor: pointer; color: var(--text-muted); }

/* ALERTS */
.alert { padding: 20px; border-radius: 12px; margin-bottom: 25px; }
.alert-success { background: rgba(30, 204, 163, 0.1); border: 1px solid var(--success); }
.alert-success h3 { color: var(--success); margin-bottom: 10px; }
.alert-danger { background: rgba(255, 77, 77, 0.1); border: 1px solid var(--danger); color: #FFF; }
.tracking-pin { background: rgba(0,0,0,0.5); padding: 5px 10px; border-radius: 6px; user-select: all; font-family: monospace; font-size: 1.2rem; color: #FFF; letter-spacing: 1px; display:inline-block;}
.official-badge { background: rgba(30, 204, 163, 0.15); border: 1px solid #1ECCA3; color: #1ECCA3; border-radius: 20px; padding: 6px 16px; font-size: 0.9rem; font-weight: bold; display: inline-block; margin-top: 10px; }

/* ESCALATION ACTIONS */
.escalation-actions { background: rgba(0,0,0,0.15); padding: 20px; border-radius: 12px; border: 1px dashed var(--success); }
.escalation-title { font-size: 1.1rem; color: #FFF; text-align: center; margin-bottom: 15px; }
.escalation-divider { height: 1px; background: var(--card-border); margin-bottom: 20px; opacity: 0.5; }
.btn-whatsapp { background-color: #25D366; color: #FFF; box-shadow: 0 4px 15px rgba(37, 211, 102, 0.3); }
.btn-whatsapp:hover { background-color: #128C7E; transform: translateY(-2px); box-shadow: 0 6px 20px rgba(37, 211, 102, 0.5); }
.btn-outline-primary { background-color: transparent; color: var(--text-light); border: 2px solid var(--primary); }
.btn-outline-primary:hover { background-color: rgba(108, 77, 255, 0.1); border-color: var(--primary); }

/* TRACK COMPLAINT SECURE FORMAT */
.centered-wrapper { max-width: 600px; }
.track-form-secure { background: rgba(0,0,0,0.1); padding: 20px; border-radius: 12px; border: 1px dashed var(--card-border); margin-bottom:20px; }
.track-result-box { background: rgba(0, 0, 0, 0.2); border: 1px solid var(--primary); border-radius: 12px; padding: 20px; }
.status-badge { display: inline-block; padding: 6px 12px; border-radius: 20px; font-size: 0.9rem; font-weight: bold; margin-bottom: 15px; }
.status-Submitted { background: rgba(108, 77, 255, 0.2); color: #C4B5FD; }
.status-UnderReview { background: rgba(255, 149, 0, 0.2); color: #FFD60A; }
.status-Escalated { background: rgba(255, 59, 48, 0.2); color: #FF6961; }
.status-Resolved { background: rgba(52, 199, 89, 0.2); color: #30D158; }

.track-item { display: flex; justify-content: space-between; padding: 10px 0; border-bottom: 1px dashed var(--card-border); }
.track-item:last-child { border: none; }
.track-item .label { color: var(--text-muted); }

/* SPINNER */
.loading-state { text-align: center; padding: 30px; }
.spinner { width: 40px; height: 40px; border: 4px solid rgba(108, 77, 255, 0.3); border-top: 4px solid var(--primary); border-radius: 50%; animation: spin 1s linear infinite; margin: 0 auto 15px auto; }
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

/* STATS TABS SYSTEM */
.stats-header { margin-bottom: 40px; }
.tabs-container { display: flex; justify-content: center; gap: 15px; margin-top: 25px; }
.tab-btn { background: rgba(0,0,0,0.3); border: 1px solid var(--card-border); color: var(--text-muted); padding: 12px 30px; border-radius: 30px; font-size: 1rem; font-family: inherit; font-weight: bold; cursor: pointer; transition: all 0.3s ease; }
.tab-btn.active { background: var(--primary); color: #FFF; border-color: var(--primary); box-shadow: 0 4px 15px rgba(108, 77, 255, 0.3); }

.tab-content { display: none; animation: fadeIn 0.4s ease-in-out forwards; }
.tab-content.active-tab { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* STATS ELEMENTS */
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; margin-bottom: 40px; }
.kpi-card { background: var(--bg-card); border: 1px solid var(--card-border); border-radius: 12px; padding: 20px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; box-shadow: 0 4px 15px rgba(0,0,0,0.2); }
.kpi-title { font-size: 0.9rem; color: var(--text-muted); margin-top: 10px; }
.kpi-value { font-size: 2rem; font-weight: 800; color: var(--primary); }
.history-kpi-grid { margin-bottom: 35px; }
.history-intro-card { background: rgba(18, 22, 45, 0.85); border: 1px solid rgba(108, 77, 255, 0.25); border-radius: 20px; padding: 30px; line-height: 2; color: var(--text-light); }
.history-intro-card p { font-size: 1.05rem; white-space: pre-wrap; }
.history-video-card { border-radius: 20px; padding: 25px; }
.history-card-title { font-size: 1.3rem; margin-bottom: 18px; }
.history-video-wrapper { border-radius: 16px; overflow: hidden; border: 1px solid var(--card-border); }
.history-chart-legend { display: flex; justify-content: center; gap: 24px; flex-wrap: wrap; margin-top: 18px; color: var(--text-light); }
.legend-swatch { width: 14px; height: 14px; display: inline-block; border-radius: 4px; margin-left: 8px; }
.legend-swatch.purple { background: #6C4DFF; }
.legend-swatch.teal { background: #1ECCA3; }
.history-charts-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-bottom: 35px; }
.history-timeline-section { margin-top: 45px; }
.history-timeline { position: relative; padding-right: 60px; }
.history-timeline::before { content: ''; position: absolute; top: 0; right: 32px; width: 4px; height: 100%; background: rgba(108, 77, 255, 0.25); border-radius: 4px; }
.history-timeline-item { background: var(--bg-card); border: 1px solid var(--card-border); border-radius: 20px; padding: 28px 24px 28px 20px; margin-bottom: 24px; opacity: 0; transform: translateX(90px); transition: transform 0.7s ease, opacity 0.7s ease; position: relative; }
.history-timeline-item.visible { opacity: 1; transform: translateX(0); }
.history-year-badge { position: absolute; top: 20px; right: -52px; width: 88px; height: 88px; background: var(--bg-card); border: 3px solid var(--primary); border-radius: 50%; display: flex; align-items: center; justify-content: center; color: var(--primary); font-weight: 800; font-size: 1rem; text-align: center; padding: 10px; }
.history-timeline-item.special { border-right: 3px solid #FF4D4D; }
.history-timeline-item.special .history-year-badge { border-color: #FF4D4D; color: #FF4D4D; }
.history-timeline-item h4 { margin-bottom: 12px; font-size: 1.2rem; color: #FFF; }
.history-timeline-item p { color: var(--text-muted); line-height: 1.8; }
.history-table-card { margin-top: 40px; }
.history-data-table th, .history-data-table td { padding: 14px 18px; }
.history-data-table tbody tr:hover td { background: rgba(255,255,255,0.03); }
.history-badge { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 14px; border-radius: 999px; font-size: 0.85rem; font-weight: 700; color: #FFF; }
.history-badge.blue { background: #1D4ED8; }
.history-badge.green { background: #047857; }
.history-badge.purple { background: #6D28D9; }
.history-badge.orange { background: #B45309; }
.history-source-note { margin-top: 30px; color: var(--text-muted); font-size: 0.95rem; text-align: center; }

.weekly-metrics-grid { display: flex; justify-content: space-around; text-align: center; margin-top:10px;}
.weekly-stat span { color: var(--text-muted); font-size: 0.95rem; margin-bottom: 5px; display:block; }
.weekly-stat strong { color: var(--primary); font-size: 2rem; font-weight: 800; }

.charts-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 30px; margin-bottom: 30px; }
.chart-card { min-width: 0; max-width: 100%; overflow: hidden; }
.chart-container { position: relative; width: 100%; max-width: 100%; margin-top: 20px; height: 300px; display:flex; justify-content:center; overflow: hidden; }
.metric-highlight { text-align: center; margin-top: 25px; padding: 15px; background: rgba(108, 77, 255, 0.1); border-radius: 8px; color: #FFF; font-size: 1.1rem; font-weight: 700; }

.empty-state { text-align: center; padding: 50px 20px; background: rgba(0,0,0,0.2); border-radius: 12px; border: 1px dashed var(--card-border); margin: 0 auto; max-width:600px;}
.empty-icon { font-size: 3rem; margin-bottom: 15px; opacity: 0.5; }

/* TABLE */
.table-responsive { overflow-x: auto; margin-top: 20px; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th, .data-table td { padding: 15px; text-align: right; border-bottom: 1px solid var(--card-border); }
.data-table th { color: var(--text-muted); font-weight: 500; background: rgba(0,0,0,0.2); }
.data-table tr:hover td { background: rgba(255,255,255,0.02); }

/* FOOTER */
.footer { background: var(--bg-card); border-top: 1px solid var(--card-border); padding: 50px 0 20px 0; margin-top: auto; }
.footer-container { max-width: 1200px; margin: 0 auto; padding: 0 20px; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 30px; margin-bottom: 30px; }
.footer-logo { color: var(--primary); font-size: 1.5rem; margin-bottom: 10px; }
.footer-logo span { color: #FFF; font-size: 1rem; font-weight: 400; }
.social-links { display: flex; gap: 15px; margin-top:10px; }
.social-btn { padding: 8px 16px; border-radius: 6px; color: #FFF; text-decoration: none; font-size: 0.9rem; font-weight: 500; }
.facebook { background: #1877F2; } .tiktok { background: #010101; border: 1px solid #333; }
.footer-bottom { text-align: center; border-top: 1px solid var(--card-border); padding-top: 20px; font-size: 0.85rem; color: var(--text-muted); }

/* POLICY & TERMS */
.policy-card { padding: 40px; }
.policy-item { margin-bottom: 20px; }
.policy-title { color: var(--primary); font-size: 1.3rem; margin-bottom: 15px; display: flex; align-items: center; gap: 10px; }
.badge { background: rgba(108, 77, 255, 0.2); color: #C4B5FD; padding: 4px 12px; border-radius: 8px; font-size: 1.1rem; font-weight: bold; border: 1px solid rgba(108, 77, 255, 0.4); }
.policy-item ul { list-style-type: none; padding-right: 15px; }
.policy-item ul li { position: relative; margin-bottom: 10px; color: var(--text-light); }
.policy-item ul li::before { content: '•'; color: var(--primary); font-size: 1.5rem; position: absolute; right: -20px; top: -5px; }
.policy-item p { color: var(--text-light); }
.policy-divider { height: 1px; background: var(--card-border); margin: 25px 0; border: none; opacity: 0.3; }

/* RESPONSIVE */
@media (max-width: 992px) {
    .charts-grid, .history-charts-grid { grid-template-columns: 1fr; }
    .kpi-grid, .history-kpi-grid { grid-template-columns: 1fr 1fr; }
    .hero-title { font-size: 2.2rem; }
    .timeline-container { flex-wrap: wrap; }
    .timeline-item { min-width: 100%; }
}

@media (max-width: 768px) {
    body { font-size: 0.95rem; }
    .hero-title { font-size: 1.8rem; }
    .hero-subtitle { font-size: 1.05rem; }
    
    .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .feed-list { gap: 15px; }
    .feed-post-card { padding: 18px; }
    .post-actions { flex-wrap: wrap; }
    .react-btn { flex: 1; min-width: 140px; }
    
    /* Navigation */
    .nav-links { display: none; flex-direction: column; position: absolute; top: 100%; left: 0; right: 0; background: var(--bg-card); padding: 20px; border-bottom: 2px solid var(--primary); z-index: 1100; box-shadow: 0 10px 20px rgba(0,0,0,0.5); }
    .nav-links.active { display: flex; }
    .hamburger { display: flex; }
    
    /* Layout Constraints */
    .hero-actions { flex-direction: column; width: 100%; gap: 10px; }
    .hero-actions .btn { width: 100%; }
    .form-row, .weekly-metrics-grid { grid-template-columns: 1fr; flex-direction: column; gap: 20px; }
    .charts-grid { grid-template-columns: 1fr; }
    .kpi-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
    
    /* Stats Optimizations */
    .tabs-container { flex-wrap: wrap; gap: 10px; }
    .tab-btn { flex: 1; min-width: 150px; text-align: center; }
    
    /* Vertical Timeline Override */
    .timeline-container { flex-direction: column; padding-right: 35px; margin-top: 20px; position: relative; }
    .timeline-container::before { width: 2px; height: 100%; left: auto; right: 10px; top: 10px; }
    .timeline-item { padding: 20px; }
    .timeline-dot { top: 25px; right: -36px; }
}

@media (max-width: 480px) {
    .kpi-grid { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: 1fr; }
    .tabs-container { flex-direction: column; width: 100%; }
    .tab-btn { width: 100%; padding: 10px; font-size: 0.95rem; }
    .kpi-value { font-size: 1.5rem; word-break: break-word; }
    .footer-links { flex-direction: column; gap: 10px !important; align-items: center; }
    .card { padding: 15px; }
    .chart-container { height: 250px; }
    .post-header { gap: 10px; }
    .post-avatar { width: 40px; height: 40px; font-size: 1rem; }
    .post-content { font-size: 0.95rem; }
    .post-actions { flex-direction: column; }
    .react-btn { width: 100%; }
}
