/* style.css */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&family=Poppins:wght@600;700;800&display=swap');

:root {
    --bg-color: #f4f7f6;
    --text-color: #2b2b2b;
    --text-muted: #6b6b6b;
    --accent-color: #eb2510;
    --accent-hover: #c41c0b;
    --card-bg: #ffffff;
    --nav-bg: #ffffff;
    --border-color: #e0e0e0;
    --modal-overlay: rgba(0, 0, 0, 0.5);
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    --admin-sidebar-bg: rgba(255, 255, 255, 0.65);
    --admin-sidebar-text: #4b5563;
    --admin-sidebar-hover: rgba(0, 0, 0, 0.05);
    --admin-sidebar-active: #eb2510;
}

[data-theme="dark"] {
    --bg-color: #121212;
    --text-color: #f1f1f1;
    --text-muted: #a0a0a0;
    --card-bg: #1e1e1e;
    --nav-bg: #181818;
    --border-color: #333333;
    --modal-overlay: rgba(0, 0, 0, 0.8);
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    --admin-sidebar-bg: rgba(21, 21, 33, 0.85);
    --admin-sidebar-text: #a1a1b5;
    --admin-sidebar-hover: rgba(255, 255, 255, 0.05);
}

/* STRICT MOBILE WIDTH ENFORCEMENT */
html, body { max-width: 100vw; overflow-x: hidden; margin: 0; padding: 0; box-sizing: border-box; }
* { margin: 0; padding: 0; box-sizing: inherit; }

body { font-family: 'Inter', sans-serif; background-color: var(--bg-color); color: var(--text-color); transition: background-color 0.3s, color 0.3s; line-height: 1.6; }
h1, h2, h3, h4 { font-family: 'Poppins', sans-serif; line-height: 1.2; }

/* Preloader */
#preloader { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: var(--bg-color); display: flex; flex-direction: column; align-items: center; justify-content: center; z-index: 99999; transition: opacity 0.4s ease, visibility 0.4s ease; }
.loader-content { width: 80%; max-width: 250px; text-align: center; }
.loader-logo { max-width: 140px; margin-bottom: 2rem; height: auto; }
.progress-container { width: 100%; height: 4px; background-color: var(--border-color); border-radius: 4px; overflow: hidden; }
.progress-bar { height: 100%; width: 0%; background-color: var(--accent-color); transition: width 0.1s linear; }

/* Floating Toast Messages */
.toast-alert { position: fixed; top: 20px; left: 50%; transform: translateX(-50%); z-index: 999999; padding: 1rem 2rem; border-radius: 30px; font-weight: 600; font-size: 0.95rem; box-shadow: 0 10px 30px rgba(0,0,0,0.2); animation: slideDown 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275); }
.toast-success { background-color: #dcfce7; color: #16a34a; border: 1px solid #bbf7d0; }
.toast-error { background-color: #fee2e2; color: #dc2626; border: 1px solid #fca5a5; }
@keyframes slideDown { from { top: -60px; opacity: 0; } to { top: 20px; opacity: 1; } }

/* Form Elements */
.error-highlight { border: 2px solid #ef4444 !important; border-radius: 8px; transition: border 0.3s; padding: 4px; }
input.form-input.error-highlight, textarea.form-input.error-highlight, select.form-input.error-highlight { padding: 0.8rem 1rem; }

.form-input { width: 100%; padding: 0.8rem 1rem; margin-top: 0.3rem; margin-bottom: 1.2rem; border: 1px solid var(--border-color); border-radius: 8px; background: var(--bg-color); color: var(--text-color); font-family: inherit; font-size: 0.95rem; transition: border-color 0.2s; }
.form-input:focus { outline: none; border-color: var(--accent-color); }
.form-label { font-weight: 600; font-size: 0.85rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; display: block; margin-bottom: 0.2rem; }

.form-heading { font-size: 1.4rem; margin-top: 1rem; margin-bottom: 0.5rem; color: var(--text-color); }
.form-paragraph { font-size: 0.9rem; color: var(--text-muted); margin-bottom: 1.5rem; }

.custom-check-group { display: flex; flex-direction: column; gap: 0.5rem; margin-top: 0.3rem; margin-bottom: 1.2rem; }
.custom-check { display: flex; align-items: center; gap: 12px; background: var(--bg-color); border: 1px solid var(--border-color); padding: 0.8rem 1rem; border-radius: 8px; cursor: pointer; transition: all 0.2s; font-size: 0.95rem; font-weight: 500; }
.custom-check:hover { border-color: var(--accent-color); }
.custom-check input { width: 18px; height: 18px; accent-color: var(--accent-color); cursor: pointer; flex-shrink: 0; }

/* iOS Pill Toggle */
.theme-switch-wrapper { display: flex; align-items: center; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.theme-switch { position: relative; width: 60px; height: 32px; background: #e2e8f0; border-radius: 32px; display: flex; align-items: center; justify-content: space-between; padding: 0 6px; box-shadow: inset 0 2px 4px rgba(0,0,0,0.1); transition: background 0.3s; }
[data-theme="dark"] .theme-switch { background: #374151; box-shadow: inset 0 2px 4px rgba(0,0,0,0.4); }
.theme-switch svg { width: 15px; height: 15px; z-index: 1; fill: none; stroke-width: 2.5; transition: stroke 0.3s; }
.sun-icon { stroke: #f59e0b; }
.moon-icon { stroke: #94a3b8; }
[data-theme="dark"] .moon-icon { stroke: #60a5fa; }
[data-theme="dark"] .sun-icon { stroke: #6b7280; }
.theme-switch-puck { position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; background: #ffffff; border-radius: 50%; box-shadow: 0 2px 5px rgba(0,0,0,0.2); transition: transform 0.3s cubic-bezier(0.4, 0.0, 0.2, 1); z-index: 2; }
[data-theme="dark"] .theme-switch-puck { transform: translateX(28px); background: #1e293b; box-shadow: 0 2px 5px rgba(0,0,0,0.5); }

.settings-row { display: flex; align-items: center; gap: 15px; margin-bottom: 1rem; background: var(--bg-color); padding: 1rem; border-radius: 8px; border: 1px solid var(--border-color); }
.settings-row-text strong { display: block; font-size: 0.95rem; }
.settings-row-text span { font-size: 0.8rem; color: var(--text-muted); }

/* Layouts */
.app-container { display: flex; min-height: 100vh; max-width: 100vw; overflow-x: hidden; }
.mobile-topbar { display: none; }

.sidebar { width: 260px; background-color: var(--admin-sidebar-bg); backdrop-filter: blur(15px); -webkit-backdrop-filter: blur(15px); border-right: 1px solid var(--border-color); display: flex; flex-direction: column; position: fixed; height: 100vh; z-index: 100; transition: transform 0.3s ease; overflow-y: auto; overflow-x: hidden; padding-bottom: 2rem; }
.brand { padding: 1.5rem; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--border-color); }
.brand-logo { max-width: 120px; height: auto; transition: opacity 0.3s; }

.nav-links { list-style: none; padding: 1rem 0; flex: 1; }
.nav-group-title { color: var(--text-muted); font-size: 0.7rem; text-transform: uppercase; font-weight: 700; padding: 1rem 1.5rem 0.5rem; letter-spacing: 1px; opacity: 0.7; }
.nav-item { margin-bottom: 0.2rem; }
.nav-link { display: flex; align-items: center; padding: 0.7rem 1.5rem; color: var(--admin-sidebar-text); text-decoration: none; font-weight: 500; cursor: pointer; transition: background-color 0.2s, color 0.2s; border-left: 3px solid transparent; font-size: 0.95rem; }
.nav-link:hover { background-color: var(--admin-sidebar-hover); color: var(--text-color); }
.nav-link.active { background-color: var(--admin-sidebar-hover); color: var(--text-color); border-left-color: var(--admin-sidebar-active); font-weight: 600; }

.main-content { flex: 1; margin-left: 260px; padding: 2rem 3rem; display: flex; flex-direction: column; max-width: 100%; overflow-x: hidden; }
.bottom-nav { display: none; }

/* Buttons & Action Pills */
.btn { display: inline-flex; align-items: center; justify-content: center; padding: 0.8rem 1.5rem; border: none; border-radius: 8px; font-family: 'Inter', sans-serif; font-weight: 600; cursor: pointer; text-decoration: none; transition: background-color 0.2s, transform 0.1s; }
.btn:active { transform: scale(0.98); }
.btn-primary { background-color: var(--accent-color); color: #fff; }
.btn-primary:hover { background-color: var(--accent-hover); }
.btn-primary:disabled { background-color: var(--text-muted); cursor: not-allowed; }
.btn-outline { background-color: transparent; border: 2px solid var(--border-color); color: var(--text-color); }
.btn-outline:hover { border-color: var(--accent-color); color: var(--accent-color); }

/* Colorful Admin Action Buttons */
.btn-sm { padding: 0.4rem 0.8rem; font-size: 0.8rem; border-radius: 20px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; }
.btn-edit { background-color: #e0f2fe; color: #0284c7; border: 1px solid #bae6fd; }
.btn-edit:hover { background-color: #bae6fd; }
[data-theme="dark"] .btn-edit { background-color: rgba(2, 132, 199, 0.2); border-color: rgba(2, 132, 199, 0.4); color: #7dd3fc; }

.btn-danger { background-color: #fee2e2; color: #dc2626; border: 1px solid #fca5a5; }
.btn-danger:hover { background-color: #fca5a5; }
[data-theme="dark"] .btn-danger { background-color: rgba(220, 38, 38, 0.2); border-color: rgba(220, 38, 38, 0.4); color: #fca5a5; }

.action-btns { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }

/* Hero & Services */
.hero { background-color: var(--card-bg); padding: 4rem 2rem; border-radius: 16px; text-align: center; margin-bottom: 3rem; box-shadow: var(--shadow); border: 1px solid var(--border-color); }
.hero h1 { font-size: 3rem; margin-bottom: 1rem; }
.hero p { font-size: 1.1rem; color: var(--text-muted); margin-bottom: 2rem; max-width: 600px; margin-left: auto; margin-right: auto; }
.services-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1.5rem; margin-bottom: 3rem; }
.service-card { background-color: var(--card-bg); padding: 2rem; border-radius: 16px; box-shadow: var(--shadow); border: 1px solid var(--border-color); cursor: pointer; transition: transform 0.2s, border-color 0.2s; text-align: left; }
.service-card:hover { transform: translateY(-5px); border-color: var(--accent-color); }
.service-card h3 { margin-bottom: 0.5rem; font-size: 1.4rem; }
.service-card p { color: var(--text-muted); font-size: 0.95rem; }

/* Modals */
.modal-backdrop { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: var(--modal-overlay); display: flex; align-items: center; justify-content: center; z-index: 2000; opacity: 0; pointer-events: none; transition: opacity 0.3s; }
.modal-backdrop.open { opacity: 1; pointer-events: auto; }
.modal-card { background-color: var(--card-bg); width: 95%; max-width: 600px; max-height: 90vh; overflow-y: auto; overflow-x: hidden; border-radius: 16px; padding: 2.5rem 2rem; position: relative; transform: translateY(20px); transition: transform 0.3s; box-shadow: 0 10px 40px rgba(0,0,0,0.2); border: 1px solid var(--border-color); }
.modal-backdrop.open .modal-card { transform: translateY(0); }
.modal-close { position: absolute; top: 1.2rem; right: 1.5rem; background: none; border: none; font-size: 1.8rem; color: var(--text-muted); cursor: pointer; line-height: 1; z-index: 10; }

/* Panes */
.admin-pane { display: none; animation: fadeIn 0.3s ease-in; }
.admin-pane.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }

.sub-tabs { display: flex; gap: 1rem; margin-bottom: 1.5rem; border-bottom: 2px solid var(--border-color); overflow-x: auto; white-space: nowrap; padding-bottom: 5px; max-width: 100%; }
.sub-tab { background: none; border: none; padding: 0.8rem 1.2rem; cursor: pointer; color: var(--text-muted); font-weight: 600; font-family: inherit; border-bottom: 2px solid transparent; margin-bottom: -7px; transition: color 0.2s, border-color 0.2s; }
.sub-tab.active { color: var(--accent-color); border-bottom-color: var(--accent-color); }
.sub-pane { display: none; }
.sub-pane.active { display: block; animation: fadeIn 0.3s ease-in; }

.auth-tabs { display: flex; gap: 1rem; margin-bottom: 1.5rem; border-bottom: 2px solid var(--border-color); }
.auth-tab { background: none; border: none; padding: 0.8rem 1.2rem; cursor: pointer; color: var(--text-muted); font-weight: 600; font-family: inherit; border-bottom: 2px solid transparent; margin-bottom: -2px; transition: color 0.2s, border-color 0.2s; }
.auth-tab.active { color: var(--accent-color); border-bottom-color: var(--accent-color); }
.auth-pane { display: none; }
.auth-pane.active { display: block; animation: fadeIn 0.3s ease-in; }

/* Admin Tables */
.data-table-container { background: var(--card-bg); border: 1px solid var(--border-color); border-radius: 12px; overflow-x: auto; box-shadow: var(--shadow); max-width: 100%; }
.data-table { width: 100%; border-collapse: collapse; text-align: left; }
.data-table th, .data-table td { padding: 1rem 1.2rem; border-bottom: 1px solid var(--border-color); font-size: 0.95rem; }
.data-table th { background-color: rgba(0,0,0,0.02); font-weight: 600; color: var(--text-muted); text-transform: uppercase; font-size: 0.75rem; letter-spacing: 0.5px; }
[data-theme="dark"] .data-table th { background-color: rgba(255,255,255,0.02); }
.data-table tr:last-child td { border-bottom: none; }

.status-pill { padding: 0.3rem 0.8rem; border-radius: 30px; font-size: 0.75rem; font-weight: 600; text-transform: uppercase; display: inline-block; }
.status-scheduled { background: #e0f2fe; color: #0284c7; }
.status-completed { background: #dcfce7; color: #16a34a; }
.status-pending { background: #fef08a; color: #ca8a04; }
.status-cancelled { background: #fee2e2; color: #dc2626; }
.status-new { background: #f3e8ff; color: #9333ea; }
.status-contacted { background: #ffedd5; color: #ea580c; }
.status-resolved { background: #f1f5f9; color: #475569; }
[data-theme="dark"] .status-resolved { background: #334155; color:#cbd5e1; }

.admin-header { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 2rem; padding-bottom: 1rem; border-bottom: 1px solid var(--border-color); }

/* Colorful Admin Stat Cards */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1.5rem; margin-bottom: 2rem; }
.stat-card { border-radius: 16px; padding: 1.5rem; box-shadow: var(--shadow); position: relative; overflow: hidden; color: #fff; }
.stat-card h3 { font-size: 2.5rem; margin-bottom: 0.2rem; position: relative; z-index: 2; }
.stat-card p { font-size: 0.85rem; font-weight: 700; text-transform: uppercase; margin:0; opacity: 0.9; position: relative; z-index: 2;}

.stat-card:nth-child(1) { background: linear-gradient(135deg, #f43f5e 0%, #be123c 100%); }
.stat-card:nth-child(2) { background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%); }
.stat-card:nth-child(3) { background: linear-gradient(135deg, #10b981 0%, #047857 100%); }
.stat-card:nth-child(4) { background: linear-gradient(135deg, #8b5cf6 0%, #6d28d9 100%); }

.builder-card { background: var(--card-bg); padding: 2rem; border-radius: 12px; border: 1px solid var(--border-color); box-shadow: var(--shadow); margin-bottom: 2rem; }
.builder-card h2 { margin-bottom: 0.5rem; font-size: 1.3rem; }
.builder-card p.desc { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 1.5rem; }

/* Wizard Elements */
.pill-grid { display: flex; flex-wrap: wrap; gap: 0.8rem; margin: 0.5rem 0 1.5rem 0; }
.pill { padding: 0.6rem 1.2rem; background-color: var(--bg-color); border: 2px solid var(--border-color); border-radius: 30px; cursor: pointer; font-weight: 500; user-select: none; transition: all 0.2s; }
.pill.selected { background-color: var(--accent-color); border-color: var(--accent-color); color: #fff; }

.wizard-step { display: none; }
.wizard-step.active { display: block; animation: fadeIn 0.3s ease-in; }

.wizard-footer { display: flex; align-items: center; justify-content: space-between; margin-top: 2rem; width: 100%; gap: 1rem; }
.submit-group { display: flex; align-items: center; justify-content: flex-end; flex: 1; gap: 10px; flex-wrap: wrap; }
.or-divider { display: flex; align-items: center; color: var(--text-muted); font-size: 0.8rem; font-weight: 700; margin: 0 5px; }
.submit-btn-wa { background-color: #25D366; color: #fff; }
.submit-btn-wa:hover { background-color: #1ebc59; }

.site-footer { text-align: center; padding: 2rem; color: var(--text-muted); font-size: 0.9rem; margin-top: auto; }
.footer-logo { max-width: 100px; margin-bottom: 1rem; transition: opacity 0.3s; }
.site-footer a { color: var(--accent-color); text-decoration: none; }

/* ================= RESPONSIVE MOBILE APP ARCHITECTURE ================= */
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.mobile-open { transform: translateX(0); }
    
    .mobile-topbar {
        display: flex; justify-content: space-between; align-items: center;
        position: fixed; top: 0; left: 0; width: 100%; height: 75px; 
        background-color: var(--nav-bg); border-bottom: 1px solid var(--border-color); 
        padding: 0 1.5rem; z-index: 1000; box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    }
    .mobile-topbar .brand-logo { max-width: 90px; }

    /* ABSOLUTE MOBILE PADDING FIX */
    .main-content { margin-left: 0; padding: 1rem; padding-top: 100px !important; padding-bottom: 100px !important; max-width: 100vw; overflow-x: hidden; }
    
    .bottom-nav {
        display: flex; position: fixed; bottom: 0; left: 0; width: 100%;
        background-color: var(--nav-bg); border-top: 1px solid var(--border-color);
        z-index: 1000; padding: 0.5rem 0; justify-content: space-around;
        box-shadow: 0 -2px 10px rgba(0,0,0,0.05);
    }
    .bottom-nav-item {
        display: flex; flex-direction: column; align-items: center; text-decoration: none;
        color: var(--text-muted); font-size: 0.7rem; font-weight: 600; cursor: pointer;
        border: none; background: none; font-family: inherit; flex: 1; padding: 0 2px;
    }
    .bottom-nav-item svg { width: 22px; height: 22px; margin-bottom: 4px; fill: currentColor; }
    .bottom-nav-item.active, .bottom-nav-item:hover { color: var(--accent-color); }
    
    .admin-header { flex-direction: column; align-items: flex-start; gap: 1rem; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .hero { padding: 3rem 1.5rem; }
    .hero h1 { font-size: 2.2rem; }

    .wizard-footer { flex-direction: column-reverse; }
    .wizard-footer > button { width: 100%; } 
    .submit-group { flex-direction: column; width: 100%; gap: 15px; }
    .submit-group > button { width: 100%; }
    .or-divider { width: 100%; justify-content: center; gap: 10px; }
    .or-divider::before, .or-divider::after { content: ""; flex: 1; border-bottom: 1px solid var(--border-color); }

    .data-table-container { border: none; background: transparent; box-shadow: none; overflow: visible; max-width: 100%; }
    .data-table thead { display: none; }
    .data-table, .data-table tbody, .data-table tr, .data-table td { display: block; width: 100%; }
    .data-table tr { margin-bottom: 1rem; border: 1px solid var(--border-color); border-radius: 12px; background: var(--card-bg); box-shadow: var(--shadow); }
    .data-table td {
        text-align: right; padding: 0.8rem 1rem; border-bottom: 1px solid var(--border-color);
        position: relative; padding-left: 40%; min-height: 50px; display: flex;
        justify-content: flex-end; align-items: center; word-break: break-word;
    }
    .data-table td::before {
        content: attr(data-label); position: absolute; left: 1rem; width: 35%; text-align: left;
        font-weight: 600; color: var(--text-muted); font-size: 0.75rem; text-transform: uppercase;
    }
    .data-table td:last-child { border-bottom: none; }
    .action-btns { justify-content: flex-end; width: 100%; }
}