/* 
   -------------------------------------------------------------------
   FilterFit - Professional Design System
   Rebuild: Zero-based
   -------------------------------------------------------------------
*/

:root {
    /* --- Colors --- */
    /* Primary Brand: Deep Indigo/Blue */
    --primary-50: #eef2ff;
    --primary-100: #e0e7ff;
    --primary-500: #6366f1;
    --primary-600: #4f46e5;
    /* Main Brand Color */
    --primary-700: #4338ca;
    --primary-900: #312e81;

    /* Neutrals: Slate */
    --slate-50: #f8fafc;
    --slate-100: #f1f5f9;
    --slate-200: #e2e8f0;
    --slate-300: #cbd5e1;
    --slate-400: #94a3b8;
    --slate-500: #64748b;
    --slate-600: #475569;
    --slate-700: #334155;
    --slate-800: #1e293b;
    --slate-900: #0f172a;
    /* Main Text */

    /* Functional */
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --white: #ffffff;

    /* --- Typography --- */
    --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

    /* --- Spacing & Layout --- */
    --container-max: 1280px;
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    /* 8px */
    --radius-lg: 0.75rem;
    /* 12px */
    --radius-xl: 1rem;
    /* 16px */

    /* --- Shadows --- */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
}

/* --- Reset & Base --- */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-sans);
    background-color: var(--slate-50);
    color: var(--slate-900);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a {
    text-decoration: none;
    color: inherit;
    transition: all 0.2s ease;
}

ul {
    list-style: none;
}

img {
    max-width: 100%;
    display: block;
}

/* --- Utilities --- */
.container {
    width: 100%;
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 1.5rem;
}

.text-center {
    text-align: center;
}

.mb-1 {
    margin-bottom: 0.25rem;
}

.mb-2 {
    margin-bottom: 0.5rem;
}

.mb-3 {
    margin-bottom: 1rem;
}

.mb-4 {
    margin-bottom: 1.5rem;
}

.mb-5 {
    margin-bottom: 3rem;
}

/* --- Components: Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.625rem 1.25rem;
    font-weight: 600;
    font-size: 0.9375rem;
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.2s ease;
    gap: 0.5rem;
}

.btn-primary {
    margin-top: 10px;
    background-color: var(--primary-600);
    color: var(--white);
    box-shadow: 0 1px 2px 0 rgba(79, 70, 229, 0.4);
}

.btn-primary:hover {
    background-color: var(--primary-700);
    transform: translateY(-1px);
    box-shadow: 0 4px 6px -1px rgba(79, 70, 229, 0.4);
}

.btn-outline {
    background-color: transparent;
    border-color: var(--slate-200);
    color: var(--slate-700);
}

.btn-outline:hover {
    border-color: var(--slate-300);
    background-color: var(--slate-50);
    color: var(--slate-900);
}

.btn-text {
    background-color: transparent;
    color: var(--slate-600);
}

.btn-text:hover {
    color: var(--primary-600);
}

/* --- Navbar --- */
.navbar {
    background-color: var(--white);
    border-bottom: 1px solid var(--slate-100);
    height: 4.5rem;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.navbar-container {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.brand-icon {
    width: 2.5rem;
    height: 2.5rem;
    background: linear-gradient(135deg, var(--primary-600), var(--primary-900));
    color: var(--white);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.brand-text {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--slate-900);
    letter-spacing: -0.02em;
}

.navbar-menu {
    display: flex;
    align-items: center;
    gap: 2.5rem;
}

.nav-list {
    display: flex;
    gap: 2rem;
}

.nav-link {
    font-weight: 600;
    color: var(--slate-600);
    font-size: 0.9375rem;
}

.nav-link:hover {
    color: var(--primary-600);
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding-left: 2rem;
    border-left: 1px solid var(--slate-200);
}

.navbar-toggle {
    display: none;
}

/* --- Hero Section --- */
.hero {
    position: relative;
    padding: 6rem 0 8rem;
    background: var(--white);
    overflow: hidden;
}

/* Subtle Grid Pattern Background */
.hero::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image: linear-gradient(var(--slate-100) 1px, transparent 1px),
        linear-gradient(90deg, var(--slate-100) 1px, transparent 1px);
    background-size: 40px 40px;
    z-index: 0;
    opacity: 0.5;
    mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 1), rgba(0, 0, 0, 0));
}

.hero-content {
    position: relative;
    z-index: 1;
    max-width: 800px;
    margin: 0 auto;
    text-align: center;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background-color: var(--primary-50);
    color: var(--primary-700);
    font-size: 0.875rem;
    font-weight: 600;
    border-radius: 9999px;
    margin-bottom: 2rem;
    border: 1px solid var(--primary-100);
}

.hero-title {
    font-size: 3.5rem;
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: -0.03em;
    color: var(--slate-900);
    margin-bottom: 1.5rem;
}

.hero-title span {
    color: var(--primary-600);
    background: linear-gradient(135deg, var(--primary-600) 0%, var(--primary-500) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-subtitle {
    font-size: 1.25rem;
    color: var(--slate-500);
    margin-bottom: 3rem;
    line-height: 1.7;
}

/* --- Search Box Component --- */
.search-container {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(12px);
    border: 1px solid var(--white);
    box-shadow: var(--shadow-xl), 0 0 0 1px rgba(0, 0, 0, 0.05);
    border-radius: var(--radius-xl);
    padding: 2rem;
    transform: translateY(0);
    transition: transform 0.3s ease;
}

.search-form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)) auto;
    gap: 1.5rem;
    align-items: end;
}

.form-group {
    text-align: left;
}

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--slate-700);
    margin-bottom: 0.5rem;
}

.form-control {
    width: 100%;
    padding: 0.875rem 1rem;
    font-size: 1rem;
    font-family: var(--font-sans);
    color: var(--slate-900);
    background-color: var(--white);
    border: 1px solid var(--slate-200);
    border-radius: var(--radius-md);
    transition: all 0.2s ease;
}

.form-control:hover {
    border-color: var(--slate-300);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-500);
    box-shadow: 0 0 0 4px var(--primary-50);
}

.form-select {
    width: 100%;
    padding: 0.875rem 1rem;
    font-size: 1rem;
    font-family: var(--font-sans);
    color: var(--slate-900);
    background-color: var(--white);
    border: 1px solid var(--slate-200);
    border-radius: var(--radius-md);
    cursor: pointer;
    appearance: none;
    transition: all 0.2s ease;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2364748b'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 1.25rem;
}

.form-select:hover {
    border-color: var(--slate-300);
}

.form-select:focus {
    outline: none;
    border-color: var(--primary-500);
    box-shadow: 0 0 0 4px var(--primary-50);
}

.form-select:disabled {
    background-color: var(--slate-50);
    color: var(--slate-400);
    cursor: not-allowed;
}

.search-btn {
    width: 100%;
    padding: 0.875rem 2rem;
}

/* --- Results Section --- */
.results-section {
    padding: 5rem 0;
    background-color: var(--slate-50);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2.5rem;
}

.section-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--slate-900);
}

.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2rem;
}

.product-card {
    background: var(--white);
    border: 1px solid var(--slate-200);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: all 0.3s ease;
}

.product-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-100);
}

.card-img {
    height: 240px;
    background-color: var(--slate-50);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.card-img img {
    max-height: 100%;
    object-fit: contain;
    mix-blend-mode: multiply;
}

.card-body {
    padding: 1.5rem;
}

.card-tag {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background-color: var(--slate-100);
    color: var(--slate-600);
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 9999px;
    margin-bottom: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.card-title {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--slate-900);
    margin-bottom: 0.5rem;
}

.card-meta {
    font-size: 0.875rem;
    color: var(--slate-500);
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.card-footer {
    padding-top: 1rem;
    border-top: 1px solid var(--slate-100);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.price {
    font-weight: 700;
    color: var(--slate-900);
    font-size: 1.25rem;
}

/* --- Footer --- */
.footer {
    margin-top: auto;
    background-color: var(--white);
    border-top: 1px solid var(--slate-200);
    padding: 4rem 0 2rem;
}

.footer-content {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: 4rem;
    margin-bottom: 4rem;
}

.footer-brand {
    margin-bottom: 1.5rem;
}

.footer-desc {
    color: var(--slate-500);
    font-size: 0.9375rem;
    max-width: 300px;
}

.footer-heading {
    font-weight: 700;
    color: var(--slate-900);
    margin-bottom: 1.5rem;
}

.footer-links li {
    margin-bottom: 0.75rem;
}

.footer-links a {
    color: var(--slate-500);
    font-size: 0.9375rem;
}

.footer-links a:hover {
    color: var(--primary-600);
}

.footer-bottom {
    padding-top: 2rem;
    border-top: 1px solid var(--slate-100);
    text-align: center;
    color: var(--slate-400);
    font-size: 0.875rem;
}

/* --- Admin Panel Overrides --- */
.admin-layout {
    display: flex;
    min-height: calc(100vh - 4.5rem);
}

.admin-sidebar {
    width: 280px;
    background-color: var(--white);
    border-right: 1px solid var(--slate-200);
    padding: 1.5rem;
    flex-shrink: 0;
    /* Prevent sidebar from shrinking */
}

.admin-main {
    flex: 1;
    padding: 2rem;
    background-color: var(--slate-50);
    min-width: 0;
    /* Allow flex item to shrink below content size/overflow properly */
    overflow-x: hidden;
    /* Ensure unexpected horizontal overflow doesn't break layout */
}

/* Alerts */
.alert {
    padding: 1rem 1.5rem;
    margin-bottom: 2rem;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.alert-success {
    background-color: #f0fdf4;
    color: #15803d;
    border: 1px solid #bbf7d0;
    border-left: 4px solid #22c55e;
}

.alert-success::before {
    content: "\f00c";
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    font-size: 1.1rem;
}

.alert-danger {
    background-color: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fecaca;
    border-left: 4px solid #ef4444;
}

.alert-danger::before {
    content: "\f06a";
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    font-size: 1.1rem;
}

/* --- Mobile Responsiveness --- */
@media (max-width: 768px) {
    .navbar-menu {
        display: none;
        position: absolute;
        top: 4.5rem;
        left: 0;
        width: 100%;
        background-color: var(--white);
        flex-direction: column;
        align-items: flex-start;
        padding: 1.5rem;
        gap: 1.5rem;
        border-bottom: 1px solid var(--slate-200);
        box-shadow: var(--shadow-md);
    }

    .navbar-menu.active {
        display: flex;
    }

    .nav-list {
        flex-direction: column;
        gap: 1rem;
        width: 100%;
    }

    .nav-actions {
        padding-left: 0;
        border-left: none;
        width: 100%;
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
        padding-top: 1rem;
        border-top: 1px solid var(--slate-100);
    }

    .navbar-toggle {
        display: flex;
        flex-direction: column;
        gap: 4px;
        cursor: pointer;
    }

    .navbar-toggle .bar {
        width: 24px;
        height: 3px;
        background-color: var(--slate-700);
        transition: 0.3s;
        border-radius: 2px;
    }

    .hero-title {
        font-size: 2.5rem;
    }

    .search-form {
        grid-template-columns: 1fr;
    }

    .footer-content {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
}

/* Sidebar Toggle Styles */
.admin-sidebar {
    transition: width 0.3s ease, padding 0.3s ease;
    overflow: hidden;
}

.admin-sidebar.collapsed {
    width: 0;
    padding-left: 0;
    padding-right: 0;
    border-right: none;
}

/* --- Vertical Ads --- */
.vertical-ad {
    display: none;
    /* مخفي افتراضيًا للشاشات الصغيرة */
    position: fixed;
    top: 120px;
    width: 160px;
    bottom: 50px;
    background: var(--slate-100);
    border: 2px dashed var(--slate-300);
    border-radius: var(--radius-md);
    color: var(--slate-500);
    font-weight: 600;
    font-size: 0.9rem;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 1rem;
    z-index: 100;
}

/* Show on medium screens and up */
@media (min-width: 1024px) {
    .vertical-ad {
        display: flex;
        width: 120px;
        /* أنحف قليلاً لتناسب الشاشات المتوسطة */
    }

    .right-ad {
        right: 15px;
    }

    .left-ad {
        left: 15px;
    }
}

/* Show full width on large screens */
@media (min-width: 1280px) {
    .vertical-ad {
        width: 160px;
    }

    .right-ad {
        right: 20px;
    }

    .left-ad {
        left: 20px;
    }
}