/* =============================================
   DIZER دايزر - Slim Design System
   Tailwind CSS CDN handles most styling.
   This file: design tokens, custom animations,
   fallback styles, admin/dashboard, overrides.
   ============================================= */

@import url('https://fonts.googleapis.com/css2?family=Tajawal:wght@300;400;500;700;800;900&display=swap');

/* ===================== DESIGN TOKENS ===================== */
:root {
    --primary: #c0392b; --primary-hover: #a93226; --primary-dark: #8e2a1e;
    --primary-light: #fdf2f2; --primary-soft: #f9e8e8; --primary-rgb: 192,57,43;
    --accent: #2c3e50; --accent-hover: #1a252f; --accent-light: #ecf0f1; --accent-rgb: 44,62,80;
    --gold: #d4a017; --gold-light: #fef9e7; --gold-rgb: 212,160,23;
    --success: #27ae60; --success-light: #eafaf1;
    --warning: #f39c12; --warning-light: #fef5e7;
    --danger: #e74c3c; --danger-light: #fdedec;
    --info: #2980b9; --info-light: #ebf5fb;
    --dark: #1a1a2e;
    --text-primary: #2c3e50; --text-secondary: #6b7c8d; --text-muted: #a0aec0;
    --border: #e2e8f0; --border-light: #f0f3f7;
    --bg-body: #f4f6fb; --bg-white: #ffffff; --bg-card: #ffffff; --bg-hover: #fafbfc;
    --shadow-xs: 0 1px 2px rgba(0,0,0,0.04);
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.05), 0 1px 2px rgba(0,0,0,0.03);
    --shadow: 0 4px 6px -1px rgba(0,0,0,0.06), 0 2px 4px -1px rgba(0,0,0,0.04);
    --shadow-md: 0 6px 16px -3px rgba(0,0,0,0.08), 0 4px 6px -2px rgba(0,0,0,0.04);
    --shadow-lg: 0 12px 32px -4px rgba(0,0,0,0.1), 0 8px 16px -4px rgba(0,0,0,0.06);
    --shadow-xl: 0 20px 48px -8px rgba(0,0,0,0.12), 0 12px 24px -6px rgba(0,0,0,0.08);
    --shadow-primary: 0 8px 24px -4px rgba(var(--primary-rgb),0.3);
    --shadow-gold: 0 8px 24px -4px rgba(var(--gold-rgb),0.3);
    --radius-xs: 6px; --radius-sm: 8px; --radius: 12px; --radius-lg: 16px;
    --radius-xl: 20px; --radius-2xl: 24px; --radius-full: 9999px;
    --transition-fast: all 0.15s ease; --transition: all 0.25s ease;
    --transition-slow: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    --nav-height: 68px; --bottom-nav-height: 64px;
    --font: 'Tajawal', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* ===================== BASE RESET ===================== */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
    font-family: var(--font); background: var(--bg-body); color: var(--text-primary);
    direction: rtl; line-height: 1.7; min-height: 100vh;
    padding-bottom: calc(var(--bottom-nav-height) + env(safe-area-inset-bottom, 0px) + 20px);
    -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; overflow-x: hidden;
}
/* Font Awesome compatibility */
i, .fas, .far, .fab, .fa { font-family: 'Font Awesome 6 Free', 'Font Awesome 6 Brands', inherit !important; }
/* Material Symbols filled state */
.material-symbols-outlined.filled { font-variation-settings: 'FILL' 1; }
a { text-decoration: none; color: inherit; transition: var(--transition-fast); }
img { max-width: 100%; display: block; }
button { font-family: var(--font); }
input, select, textarea { font-family: var(--font); }
/* Smooth transitions for all interactive elements */
a, button, input, select, textarea, [role="button"], [tabindex] { transition: var(--transition); }

/* ===================== ANIMATIONS ===================== */
@keyframes fadeIn { from { opacity:0; transform:translateY(12px); } to { opacity:1; transform:translateY(0); } }
@keyframes fadeInUp { from { opacity:0; transform:translateY(24px); } to { opacity:1; transform:translateY(0); } }
@keyframes slideDown { from { transform:translateY(-12px); opacity:0; } to { transform:translateY(0); opacity:1; } }
@keyframes pulse { 0%,100% { transform:scale(1); } 50% { transform:scale(1.05); } }
@keyframes float { 0%,100% { transform:translateY(0); } 50% { transform:translateY(-8px); } }
@keyframes shimmer { 0% { background-position:-200% center; } 100% { background-position:200% center; } }
@keyframes goldShimmer { 0% { background-position:-200% center; } 100% { background-position:200% center; } }
@keyframes glow {
    0%,100% { box-shadow: 0 0 8px rgba(var(--primary-rgb),0.3); }
    50% { box-shadow: 0 0 20px rgba(var(--primary-rgb),0.5), 0 0 40px rgba(var(--primary-rgb),0.2); }
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes countUp { from { opacity:0; transform:scale(0.5); } to { opacity:1; transform:scale(1); } }

/* Animation utility classes */
.fade-in { animation: fadeIn 0.4s ease both; }
.fade-in-up { animation: fadeInUp 0.5s ease both; }
.animate-float { animation: float 6s ease-in-out infinite; }
.animate-pulse { animation: pulse 2s ease-in-out infinite; }
.animate-glow { animation: glow 2s ease-in-out infinite; }
.animate-spin { animation: spin 1s linear infinite; }
.animate-shimmer { animation: shimmer 1.5s ease-in-out infinite; }
.animate-gold-shimmer { animation: goldShimmer 2.5s linear infinite; }
.animate-count-up { animation: countUp 0.6s ease both; }
/* Staggered card loading fallback */
.services-grid .service-card:nth-child(1) { animation-delay:.05s; }
.services-grid .service-card:nth-child(2) { animation-delay:.1s; }
.services-grid .service-card:nth-child(3) { animation-delay:.15s; }
.services-grid .service-card:nth-child(4) { animation-delay:.2s; }
.services-grid .service-card:nth-child(5) { animation-delay:.25s; }
.services-grid .service-card:nth-child(6) { animation-delay:.3s; }

/* ===================== UTILITIES ===================== */
.line-clamp-1 { display:-webkit-box; -webkit-line-clamp:1; -webkit-box-orient:vertical; overflow:hidden; }
.line-clamp-2 { display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden; }
.line-clamp-3 { display:-webkit-box; -webkit-line-clamp:3; -webkit-box-orient:vertical; overflow:hidden; }
.no-scrollbar { scrollbar-width:none; -ms-overflow-style:none; }
.no-scrollbar::-webkit-scrollbar { display:none; }
.stars .fa-star.active, .stars .fas.fa-star,
.stars-interactive i.active, .stars-interactive i:hover { color:#f39c12; }

/* ===================== SCROLLBAR ===================== */
::-webkit-scrollbar { width:6px; height:6px; }
::-webkit-scrollbar-track { background:var(--bg-body); }
::-webkit-scrollbar-thumb { background:var(--border); border-radius:3px; }
::-webkit-scrollbar-thumb:hover { background:var(--text-muted); }
::selection { background:rgba(var(--primary-rgb),0.12); color:var(--primary); }
:focus-visible { outline:2px solid var(--primary); outline-offset:2px; }

/* ===================== SKELETON LOADING ===================== */
.skeleton {
    background:linear-gradient(90deg, var(--border-light) 25%, var(--bg-body) 50%, var(--border-light) 75%);
    background-size:200% 100%; animation:shimmer 1.5s ease-in-out infinite; border-radius:var(--radius-sm);
}

/* ===================== LAYOUT FALLBACKS ===================== */
.container { max-width:1200px; margin:0 auto; padding:0 16px; }

/* ===================== ALERTS ===================== */
.alert {
    padding:14px 20px; margin:12px 16px; border-radius:var(--radius);
    display:flex; justify-content:space-between; align-items:center;
    font-size:0.88rem; font-weight:500; animation:slideDown 0.35s ease; box-shadow:var(--shadow);
}
.alert-success { background:var(--success-light); color:#1b7a43; border:1px solid #a9dfbf; }
.alert-danger  { background:var(--danger-light);  color:#c0392b; border:1px solid #f5b7b1; }
.alert-warning { background:var(--warning-light); color:#b7791f; border:1px solid #f9e79f; }
.close-alert { background:none; border:none; font-size:1.2rem; cursor:pointer; color:inherit; opacity:0.5; transition:var(--transition-fast); }
.close-alert:hover { opacity:1; }

/* ===================== BUTTONS (fallback) ===================== */
.btn {
    display:inline-flex; align-items:center; justify-content:center; gap:6px;
    padding:11px 22px; border:none; border-radius:var(--radius-sm);
    font-size:0.88rem; font-weight:600; cursor:pointer; transition:var(--transition); font-family:var(--font);
}
.btn:active { transform:scale(0.97); }
.btn-primary { background:linear-gradient(135deg,var(--primary) 0%,var(--primary-dark) 100%); color:var(--bg-white); box-shadow:0 2px 8px rgba(var(--primary-rgb),0.2); }
.btn-primary:hover { box-shadow:0 4px 16px rgba(var(--primary-rgb),0.3); transform:translateY(-1px); }
.btn-secondary { background:var(--bg-body); color:var(--text-secondary); border:1px solid var(--border); }
.btn-secondary:hover { background:var(--accent-light); }
.btn-danger { background:var(--danger); color:var(--bg-white); }
.btn-gold { background:var(--gold); color:var(--bg-white); }
.btn-whatsapp { background:#25D366; color:var(--bg-white); box-shadow:0 2px 8px rgba(37,211,102,0.2); }
.btn-success { background:var(--success); color:var(--bg-white); }
.btn-block { width:100%; }
.btn-sm { padding:8px 16px; font-size:0.82rem; }

/* ===================== FORMS (fallback) ===================== */
.form-group { margin-bottom:12px; }
.form-group label { display:block; margin-bottom:6px; font-weight:600; font-size:0.84rem; color:var(--text-secondary); }
.form-group input, .form-group select, .form-group textarea {
    width:100%; padding:12px 16px; border:1.5px solid var(--border); border-radius:var(--radius-sm);
    font-size:0.92rem; direction:rtl; transition:var(--transition); font-family:var(--font);
    background:var(--bg-white); color:var(--text-primary);
}
.form-group input::placeholder, .form-group textarea::placeholder { color:var(--text-muted); }
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    outline:none; border-color:var(--primary); box-shadow:0 0 0 4px rgba(var(--primary-rgb),0.08);
}
.form-group select option { background:var(--bg-white); }
.form-group textarea { resize:vertical; min-height:80px; }
.form-row { display:grid; grid-template-columns:1fr; gap:12px; margin-bottom:12px; }

/* ===================== AUTH (fallback) ===================== */
.auth-page { display:flex; align-items:center; justify-content:center; min-height:calc(100vh - 200px); padding:20px; }
.auth-card {
    background:var(--bg-white); border-radius:var(--radius-xl); padding:36px 28px;
    width:100%; max-width:420px; border:1px solid var(--border); box-shadow:var(--shadow-lg);
}
.auth-card h2 { text-align:center; margin-bottom:24px; color:var(--text-primary); font-size:1.3rem; }
.logo-auth { text-align:center; margin-bottom:16px; font-size:2.4rem; color:var(--primary); }
.auth-footer { text-align:center; margin-top:18px; font-size:0.82rem; color:var(--text-secondary); }
.auth-footer a { color:var(--primary); font-weight:600; }

/* ===================== SERVICE CARD (fallback) ===================== */
.service-card {
    background:var(--bg-white); border-radius:var(--radius-lg); overflow:hidden;
    transition:var(--transition); position:relative; cursor:pointer;
    border:1px solid var(--border); animation:fadeIn 0.4s ease both;
}
.service-card:hover { transform:translateY(-4px); box-shadow:var(--shadow-lg); border-color:transparent; }
.service-card.featured { border:2px solid var(--gold); }
.service-card.promoted { border:2px solid var(--gold); box-shadow:0 4px 20px rgba(var(--gold-rgb),0.15); position:relative; }
.service-card.promoted::after {
    content:''; position:absolute; top:0; left:-200%; width:200%; height:100%;
    background:linear-gradient(90deg,transparent,rgba(212,160,23,0.06),transparent);
    animation:goldShimmer 3s ease-in-out infinite; pointer-events:none; z-index:1;
}
.featured-badge {
    position:absolute; top:10px; right:10px; background:var(--gold); color:var(--bg-white);
    padding:3px 12px; border-radius:var(--radius-full); font-size:0.68rem; font-weight:700;
    z-index:2; box-shadow:0 2px 8px rgba(var(--gold-rgb),0.3);
}
.gold-badge {
    background:linear-gradient(135deg,#d4a017 0%,#f1c40f 50%,#d4a017 100%) !important;
    background-size:200% auto !important; animation:goldShimmer 2.5s linear infinite !important;
    box-shadow:0 2px 10px rgba(var(--gold-rgb),0.4);
}
.gold-star-badge {
    background:linear-gradient(135deg,#d4a017 0%,#f1c40f 100%) !important; color:white !important;
    border:none !important; padding:3px 12px !important; border-radius:var(--radius-full) !important;
    font-weight:700 !important; font-size:0.78rem !important;
}

/* ===================== BREADCRUMB ===================== */
.breadcrumb { display:flex; align-items:center; gap:8px; padding:12px 16px; font-size:0.82rem; color:var(--text-muted); }
.breadcrumb a { color:var(--text-secondary); transition:var(--transition-fast); }
.breadcrumb a:hover { color:var(--primary); }
.breadcrumb .separator { color:var(--border); }

/* ===================== BADGES ===================== */
.badge { display:inline-block; padding:3px 10px; border-radius:var(--radius-full); font-size:0.72rem; font-weight:600; }
.badge-success { background:var(--success-light); color:var(--success); }
.badge-danger  { background:var(--danger-light);  color:var(--danger); }
.badge-warning { background:var(--warning-light); color:#b7791f; }
.badge-info    { background:var(--info-light);    color:var(--info); }

/* ===================== DASHBOARD ===================== */
.dashboard-grid { display:grid; grid-template-columns:1fr; gap:16px; }
.dashboard-sidebar { display:none; }
.dashboard-sidebar-mobile {
    background:var(--bg-white); border-radius:var(--radius); padding:8px; margin-bottom:16px;
    overflow-x:auto; border:1px solid var(--border); box-shadow:var(--shadow-sm);
}
.sidebar-menu-mobile { display:flex; gap:4px; min-width:max-content; }
.sidebar-menu-mobile a {
    display:flex; align-items:center; gap:6px; padding:8px 14px; border-radius:var(--radius-sm);
    color:var(--text-secondary); font-size:0.78rem; white-space:nowrap;
    transition:var(--transition); font-weight:500; border:1.5px solid transparent;
}
.sidebar-menu-mobile a.active { background:var(--primary-light); color:var(--primary); border-color:var(--primary); }
.stat-cards { display:grid; grid-template-columns:repeat(2,1fr); gap:12px; margin-bottom:16px; }
.stat-card {
    background:var(--bg-white); border-radius:var(--radius); padding:18px;
    text-align:center; border:1px solid var(--border); transition:var(--transition);
}
.stat-card:hover { box-shadow:var(--shadow-md); transform:translateY(-2px); }
.stat-card .stat-number { font-size:1.5rem; font-weight:800; color:var(--primary); }
.stat-card .stat-label  { font-size:0.72rem; color:var(--text-secondary); margin-top:2px; }

/* ===================== ADMIN ===================== */
.admin-header {
    background:linear-gradient(135deg,var(--accent) 0%,var(--dark) 100%); color:var(--bg-white);
    padding:12px 16px; display:flex; justify-content:space-between; align-items:center; overflow-x:auto;
}
.admin-header .logo { color:var(--bg-white); font-size:1.05rem; }
.admin-header .logo i { color:#e74c3c; }
.admin-nav { display:flex; gap:4px; overflow-x:auto; }
.admin-nav a {
    padding:6px 12px; border-radius:var(--radius-xs); color:rgba(255,255,255,0.7);
    font-size:0.78rem; white-space:nowrap; transition:var(--transition);
}
.admin-nav a:hover, .admin-nav a.active { background:rgba(255,255,255,0.1); color:var(--bg-white); }
.admin-content { padding:16px; }
.action-btns { display:flex; gap:4px; }
.action-btns .btn { padding:5px 10px; font-size:0.72rem; }
.table-responsive { overflow-x:auto; margin:0 -16px; padding:0 16px; }
.data-table {
    width:100%; border-collapse:collapse; background:var(--bg-white);
    border-radius:var(--radius); overflow:hidden; border:1px solid var(--border); box-shadow:var(--shadow-sm);
}
.data-table th, .data-table td { padding:12px 16px; text-align:right; font-size:0.84rem; }
.data-table th { background:var(--accent); color:var(--bg-white); font-weight:600; font-size:0.78rem; }
.data-table tr:nth-child(even) { background:var(--bg-body); }
.data-table tr:hover { background:var(--primary-light); }
.data-table td { border-bottom:1px solid var(--border-light); color:var(--text-secondary); }

/* ===================== REVIEWS (fallback) ===================== */
.stars-interactive { display:flex; gap:4px; direction:ltr; }
.stars-interactive i { font-size:1.3rem; cursor:pointer; color:var(--border); transition:var(--transition); }

/* ===================== MOBILE BOTTOM NAV ===================== */
.bottom-nav { padding-bottom:env(safe-area-inset-bottom, 0px); }

/* ===================== DESKTOP OVERRIDES ===================== */
@media (min-width:768px) {
    body { padding-bottom:0; }
    .container { padding:0 24px; }
    .form-row { grid-template-columns:repeat(auto-fit,minmax(200px,1fr)); }
    .dashboard-grid { grid-template-columns:240px 1fr; }
    .dashboard-sidebar {
        display:block; background:var(--bg-white); border-radius:var(--radius); padding:20px;
        border:1px solid var(--border); box-shadow:var(--shadow-sm);
        height:fit-content; position:sticky; top:88px;
    }
    .dashboard-sidebar-mobile { display:none; }
    .sidebar-menu a {
        display:flex; align-items:center; gap:10px; padding:10px 14px;
        border-radius:var(--radius-sm); color:var(--text-secondary);
        transition:var(--transition); margin-bottom:3px; font-weight:500; font-size:0.88rem;
    }
    .sidebar-menu a:hover, .sidebar-menu a.active { background:var(--primary-light); color:var(--primary); }
    .sidebar-menu a i { width:18px; text-align:center; }
    .service-detail-header { flex-direction:row; }
    .service-detail-image { width:380px; }
    .profile-header { flex-direction:row; text-align:right; }
}

/* ===================== PRICE RANGE SLIDER ===================== */
input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: #e5e7eb;
    outline: none;
    transition: opacity 0.2s;
}
input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #e60000;
    cursor: pointer;
    border: 3px solid #fff;
    box-shadow: 0 2px 6px rgba(230,0,0,0.3);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.15);
    box-shadow: 0 3px 10px rgba(230,0,0,0.4);
}
input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #e60000;
    cursor: pointer;
    border: 3px solid #fff;
    box-shadow: 0 2px 6px rgba(230,0,0,0.3);
}
input[type="range"]:focus {
    outline: none;
}

/* ===================== RATING FILTER ===================== */
input[type="radio"].accent-primary {
    accent-color: #e60000;
}
input[type="checkbox"].accent-primary {
    accent-color: #e60000;
}

/* ===================== HEADER SCROLL EFFECT ===================== */
header {
    transition: box-shadow 0.3s ease, background-color 0.3s ease, backdrop-filter 0.3s ease;
}
header.shadow-lg {
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
}

/* ===================== HERO BANNER ===================== */
.hero-banner {
    background: linear-gradient(135deg, #10b981 0%, #0ea5e9 100%);
    min-height: 200px;
    position: relative;
    overflow: hidden;
}
@media (max-width: 768px) {
    .hero-banner {
        min-height: 150px;
    }
}

/* ===================== CATEGORY CARD HOVER ===================== */
.category-card-hover {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.category-card-hover:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

/* ===================== SERVICE CARD ANIMATIONS ===================== */
.service-card-new {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.service-card-new:hover {
    transform: translateY(-4px);
}

/* ===================== MOBILE FILTER OVERLAY ===================== */
@media (max-width: 1023px) {
    #filterPanel:not(.hidden) {
        animation: slideDown 0.3s ease;
    }
}

/* ===================== FILTER SIDEBAR STICKY ===================== */
@media (min-width: 1024px) {
    #filterSidebar {
        position: sticky;
        top: 100px;
        align-self: flex-start;
    }
}

/* ===================== SAFE AREA FOR BOTTOM NAV ===================== */
.safe-area-inset-bottom {
    padding-bottom: env(safe-area-inset-bottom, 0px);
}

/* ===================== NEWSLETTER FORM ===================== */
.newsletter-input:focus {
    ring: 2px;
    ring-color: rgba(230, 0, 0, 0.2);
}

/* ===================== PRINT STYLES ===================== */
@media print {
    body { background:#fff !important; color:#000 !important; direction:rtl; font-size:12pt; padding:0 !important; }
    .navbar, .bottom-nav, .admin-header, .btn, .cta-provider,
    .footer, .ad-banner-section, .ad-banner, .hero-search, .no-results { display:none !important; }
    .container { max-width:100% !important; padding:0 !important; }
    .service-card {
        break-inside:avoid; border:1px solid #ccc !important;
        box-shadow:none !important; animation:none !important; transform:none !important;
    }
    .data-table { box-shadow:none !important; }
    .data-table th { background:#333 !important; color:#fff !important; -webkit-print-color-adjust:exact; print-color-adjust:exact; }
    a[href]::after { content:" (" attr(href) ")"; font-size:0.8em; color:#666; }
    a[href^="#"]::after, a[href^="javascript"]::after { content:""; }
    .alert { border:2px solid !important; box-shadow:none !important; }
    .alert-success { border-color:var(--success) !important; }
    .alert-danger  { border-color:var(--danger)  !important; }
    .alert-warning { border-color:var(--warning) !important; }
    img { max-width:100% !important; }
    * { color-adjust:exact; -webkit-print-color-adjust:exact; }
}
