/* ========================================================
   متغیرها و تنظیمات پایه (Design Tokens & Reset)
======================================================== */
:root {
    --sky-50: #f1faff;
    --sky-100: #def4ff;
    --sky-200: #b9e8ff;
    --sky-400: #46b8ee;
    --sky-500: #159ddd;
    --sky-600: #087cb5;
    --sky-700: #08618d;

    --ink: #17324a;
    --muted: #627b8c;
    --border: #d7eaf3;
    --surface: #ffffff;

    --card-shadow: 0 22px 65px rgba(20, 105, 150, 0.12);
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
}

body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    margin: 0;
    color: var(--ink);
    background:
        radial-gradient(circle at 12% 8%, rgba(119, 213, 255, 0.26), transparent 28%),
        radial-gradient(circle at 88% 78%, rgba(160, 225, 255, 0.23), transparent 30%),
        linear-gradient(145deg, #f8fdff, #ecf8fe);
    font-family: Vazirmatn, Tahoma, Arial, sans-serif;
    line-height: 1.8;
    overflow-x: hidden; /* جلوگیری از اسکرول افقی در موبایل */
}

a {
    color: var(--sky-700);
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: var(--sky-600);
}

img {
    max-width: 100%;
    height: auto;
}

/* ========================================================
   هدر و منو (Site Header)
======================================================== */
.site-header {
    position: sticky;
    top: 0;
    z-index: 1020;
    border-bottom: 1px solid rgba(215, 234, 243, 0.9);
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(12px);
}

.site-header .navbar {
    min-height: 76px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    color: var(--ink);
    font-size: 1.2rem;
    font-weight: 800;
}

.brand:hover {
    color: var(--sky-700);
}

.brand-logo {
    display: block;
    width: 55px;
    height: 55px;
    object-fit: contain;
    border-radius: 12px;
}

.site-header .nav-link {
    color: var(--muted);
    font-weight: 600;
    transition: color 0.2s ease;
}

.site-header .nav-link:hover,
.site-header .nav-link.active {
    color: var(--sky-700);
}

/* ========================================================
   دکمه‌ها (Buttons)
======================================================== */
.btn {
    border-radius: 11px;
    font-weight: 700;
    padding: 0.65rem 1.1rem;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.btn-sm {
    padding: 0.4rem 0.85rem;
    font-size: 0.875rem;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn-sky {
    border: 1px solid var(--sky-600);
    color: #fff !important;
    background: linear-gradient(135deg, var(--sky-500), var(--sky-600));
    box-shadow: 0 7px 18px rgba(8, 124, 181, 0.17);
}

.btn-sky:hover,
.btn-sky:focus {
    border-color: var(--sky-700);
    background: linear-gradient(135deg, var(--sky-600), var(--sky-700));
}

.btn-outline-sky {
    border: 1px solid var(--sky-500);
    color: var(--sky-700);
    background: #fff;
}

.btn-outline-sky:hover,
.btn-outline-sky:focus {
    border-color: var(--sky-600);
    color: #fff !important;
    background: var(--sky-600);
}

/* ========================================================
   چیدمان اصلی (Site Main)
======================================================== */
.site-main {
    flex: 1;
    width: 100%;
    padding: 20px 0 40px;
}

/* ========================================================
   بخش‌های احراز هویت (Auth Sections)
======================================================== */
.auth-section {
    display: flex;
    min-height: min(720px, calc(100vh - 150px));
    align-items: center;
    justify-content: center;
    padding: 20px 0;
}

.auth-card {
    width: 100%;
    max-width: 470px;
    padding: 32px;
    border: 1px solid rgba(215, 234, 243, 0.9);
    border-radius: 24px;
    background: var(--surface);
    box-shadow: var(--card-shadow);
}

.auth-heading {
    margin-bottom: 24px;
    text-align: center;
}

.auth-icon,
.success-icon {
    display: grid;
    margin: 0 auto 16px;
    place-items: center;
    color: var(--sky-700);
    background: var(--sky-100);
    font-weight: 800;
}

.auth-icon {
    width: 54px;
    height: 54px;
    border-radius: 17px;
    font-size: 1.65rem;
}

.success-icon {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    color: #fff;
    background: linear-gradient(135deg, var(--sky-400), var(--sky-600));
    font-size: 2.25rem;
}

.eyebrow {
    display: block;
    margin-bottom: 5px;
    color: var(--sky-600);
    font-size: 0.8rem;
    font-weight: 800;
}

.auth-heading h1,
.auth-title {
    margin: 0 0 9px;
    color: var(--ink);
    font-size: 1.55rem;
    font-weight: 800;
    line-height: 1.5;
}

.auth-heading p,
.auth-description {
    margin: 0;
    color: var(--muted);
    font-size: 0.94rem;
}

/* فرم‌ها */
.auth-card .form-label {
    margin-bottom: 7px;
    color: var(--ink);
    font-size: 0.92rem;
    font-weight: 700;
}

.auth-card input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
.auth-card select,
.auth-card textarea {
    display: block;
    width: 100%;
    min-height: 47px;
    padding: 10px 13px;
    border: 1px solid var(--border);
    border-radius: 11px;
    outline: none;
    color: var(--ink);
    background: #fbfeff;
    font: inherit;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.auth-card textarea {
    min-height: 105px;
    resize: vertical;
}

.auth-card input:focus,
.auth-card select:focus,
.auth-card textarea:focus {
    border-color: var(--sky-500);
    box-shadow: 0 0 0 4px rgba(21, 157, 221, 0.12);
}

.auth-card input[type="checkbox"] {
    accent-color: var(--sky-600);
}

.auth-bottom {
    margin-top: 22px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
    color: var(--muted);
    font-size: 0.88rem;
    text-align: center;
}

.auth-bottom a,
.text-action {
    color: var(--sky-700);
    font-weight: 800;
    text-decoration: none;
}

.auth-bottom a:hover,
.text-action:hover {
    text-decoration: underline;
}

/* ========================================================
   کارت‌های محصول (Product Cards - داینامیک برای موبایل و دسکتاپ)
======================================================== */
.product-card {
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: var(--surface);
    box-shadow: 0 8px 24px rgba(20, 105, 150, 0.06);
    transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}

.product-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--card-shadow);
    border-color: var(--sky-200);
}

.product-card-img-wrapper {
    position: relative;
    display: block;
    width: 100%;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    background-color: #f6fbfe;
}

.product-card-img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 10px;
    transition: opacity 0.35s ease, transform 0.35s ease;
}

.product-card-img.product-card-img-primary {
    opacity: 1;
    z-index: 1;
}

.product-card-img.product-card-img-secondary {
    opacity: 0;
    z-index: 2;
}

.product-card.has-secondary-img:hover .product-card-img-primary {
    opacity: 0;
    transform: scale(1.04);
}

.product-card.has-secondary-img:hover .product-card-img-secondary {
    opacity: 1;
    transform: scale(1.04);
}

.product-card-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 14px;
}

.product-card-brand {
    color: var(--sky-600);
    font-size: 0.75rem;
    font-weight: 700;
    margin-bottom: 2px;
}

.product-card-title {
    margin: 0.2rem 0 0.8rem;
    font-size: 0.9rem;
    font-weight: 700;
    line-height: 1.5;
    flex-grow: 1;
}

.product-card-title a {
    color: var(--ink);
}

.product-card-title a:hover {
    color: var(--sky-600);
}

.product-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.4rem;
    margin-top: auto;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border);
}

/* ========================================================
   صفحه جزئیات محصول (Product Detail Grid)
======================================================== */
.product-detail-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
    align-items: start;
    gap: clamp(1rem, 3vw, 2.5rem);
}

.product-gallery,
.product-buy-panel,
.product-info-section {
    min-width: 0;
    border: 1px solid var(--border);
    border-radius: 24px;
    background: #fff;
    box-shadow: 0 14px 40px rgba(20, 105, 150, 0.07);
}

.product-gallery {
    padding: 1rem;
}

.product-gallery-viewport {
    position: relative;
    overflow: hidden;
    border-radius: 18px;
    background: #f5fafe;
}

.product-gallery-track {
    display: flex;
    direction: ltr;
    transition: transform 0.35s ease;
}

.product-gallery-slide {
    flex: 0 0 100%;
    min-width: 0;
    aspect-ratio: 1 / 1;
}

.product-gallery-slide img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.product-buy-panel {
    padding: clamp(1.1rem, 3vw, 2rem);
}

.product-detail-title {
    margin: 0.7rem 0 0.3rem;
    color: var(--ink);
    font-size: clamp(1.3rem, 2.5vw, 1.8rem);
    font-weight: 800;
    line-height: 1.5;
}

.product-specs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
    margin: 0;
}

.product-specs > div {
    padding: 0.75rem 0.9rem;
    border-radius: 12px;
    background: #f6fbfe;
}

.product-specs dt {
    color: var(--muted);
    font-size: 0.78rem;
    margin-bottom: 0.2rem;
}

.product-specs dd {
    margin: 0;
    color: var(--ink);
    font-weight: 700;
    overflow-wrap: anywhere;
}

/* ========================================================
   دسته‌بندی‌ها و گرید محصولات (Category Grids)
======================================================== */
.section-title {
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--ink);
    margin-bottom: 20px;
    position: relative;
    display: inline-block;
}

.section-title::after {
    content: "";
    position: absolute;
    bottom: -6px;
    right: 0;
    width: 40px;
    height: 3px;
    border-radius: 3px;
    background: linear-gradient(90deg, var(--sky-500), var(--sky-200));
}

.category-block {
    background: rgba(255, 255, 255, 0.75);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 18px;
    margin-bottom: 28px;
}

/* ========================================================
   سایدبار فیلترها (Filters Sidebar)
======================================================== */
.product-filters {
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: var(--surface);
    box-shadow: 0 8px 24px rgba(20, 105, 150, 0.06);
}

.filter-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--sky-100);
}

.filter-header-title {
    font-size: 1rem;
    font-weight: 800;
    color: var(--ink);
    margin: 0;
}

.filter-clear-all {
    font-size: 0.78rem;
    font-weight: 700;
    color: #e53e3e;
    text-decoration: none;
}

.filter-field {
    padding: 12px 0;
    border-top: 1px solid var(--border);
}

.filter-label {
    margin-bottom: 8px;
    color: var(--ink);
    font-weight: 800;
    font-size: 0.88rem;
}

/* پالت رنگ‌ها در فیلتر */
.filter-field > div.filter-color-grid {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 8px !important;
    max-height: 200px !important;
    overflow-y: auto !important;
}

.filter-color-item {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    padding: 4px 6px;
    border-radius: 8px;
    cursor: pointer;
}

.filter-color-item:hover {
    background: var(--sky-50);
}

.filter-color-swatch {
    flex-shrink: 0;
    width: 22px !important;
    height: 22px !important;
    border-radius: 50%;
    border: 1.5px solid #cbd5e1;
}

.filter-color-name {
    font-size: 0.8rem;
    color: var(--ink);
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ========================================================
   صفحه‌بندی (Pagination)
======================================================== */
.custom-pagination {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin-top: 30px;
}

.custom-pagination a,
.custom-pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 38px;
    height: 38px;
    padding: 0 10px;
    border-radius: 10px;
    font-size: 0.88rem;
    font-weight: 700;
    background: #ffffff;
    border: 1px solid var(--border);
    color: var(--ink);
}

.custom-pagination span.active {
    background: var(--sky-600);
    border-color: var(--sky-600);
    color: #ffffff;
}

/* ========================================================
   ریسپانسیو جامع موبایل و تبلت (Responsive Breakpoints)
======================================================== */
@media (max-width: 991.98px) {
    .product-detail-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
}

@media (max-width: 767.98px) {
    body {
        font-size: 0.92rem;
    }

    .site-header .navbar {
        min-height: 64px;
        padding: 0.5rem 1rem;
    }

    .brand-logo {
        width: 44px;
        height: 44px;
    }

    .brand {
        font-size: 1.05rem;
        gap: 8px;
    }

    .site-main {
        padding: 12px 0 32px;
    }

    .category-block {
        padding: 12px;
        border-radius: 14px;
        margin-bottom: 20px;
    }

    .product-specs {
        grid-template-columns: 1fr;
    }

    .auth-card {
        padding: 22px 16px;
        border-radius: 18px;
    }

    .auth-heading h1,
    .auth-title {
        font-size: 1.3rem;
    }
}

@media (max-width: 480px) {
    .product-card-body {
        padding: 10px;
    }

    .product-card-title {
        font-size: 0.85rem;
        margin: 0.1rem 0 0.5rem;
    }

    .product-card-price strong {
        font-size: 1rem;
    }
}
