/* Zylon responsive system — mobile / tablet / desktop */

/* تنظیمات پایه ریسپانسیو */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* نمایش صحیح در موبایل */
html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

/* مدیا کوئری برای تبلت (عرض کمتر از 768px) */
@media screen and (max-width: 768px) {
    body {
        font-size: 14px;
    }
    
    .container {
        width: 95%;
        padding: 10px;
    }
    
    /* نوار ناوبری عمودی */
    nav ul {
        flex-direction: column;
        text-align: center;
    }
    
    nav li {
        margin: 5px 0;
    }
}

/* مدیا کوئری برای موبایل (عرض کمتر از 480px) */
@media screen and (max-width: 480px) {
    body {
        font-size: 12px;
    }
    
    h1 {
        font-size: 24px;
    }
    
    h2 {
        font-size: 20px;
    }
    
    /* ستون‌ها به صورت عمودی */
    .row {
        flex-direction: column;
    }
    
    .col {
        width: 100%;
        margin: 5px 0;
    }
    
    /* فرم‌ها در موبایل */
    input, select, textarea, button {
        width: 100%;
        padding: 8px;
        font-size: 16px; /* جلوگیری از زوم خودکار در iOS */
    }
    
    /* جدول‌ها در موبایل */
    table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }
}

/* مدیا کوئری برای موبایل‌های خیلی کوچک (عرض کمتر از 320px) */
@media screen and (max-width: 320px) {
    body {
        font-size: 11px;
    }
    
    .container {
        width: 100%;
        padding: 5px;
    }
}

/* تنظیمات تصاویر ریسپانسیو */
img, video, iframe {
    max-width: 100%;
    height: auto;
}

/* گرید ریسپانسیو */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

/* ناوبری همبرگری ساده */
.menu-toggle {
    display: none;
}

@media screen and (max-width: 768px) {
    .menu-toggle {
        display: block;
        cursor: pointer;
    }
    
    nav ul {
        display: none;
    }
    
    nav.active ul {
        display: flex;
    }
}

.hero-slide-img {
    max-width: 100%;
    height: auto;
    margin-top: 16px;
    border-radius: 12px;
    object-fit: cover;
    aspect-ratio: 2 / 1;
}

/* Product grid */
.product-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    margin-top: 1rem;
}

.product-grid-item {
    width: calc(33.333% - 14px);
    min-width: 210px;
}

@media (max-width: 1024px) {
    .product-grid-item {
        width: calc(50% - 14px);
    }
}

@media (max-width: 640px) {
    .product-grid-item {
        width: 100%;
        min-width: unset;
    }
}

.mobile-nav-toggle {
    display: none;
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 1001;
    width: var(--touch-min);
    height: var(--touch-min);
    border: none;
    border-radius: 10px;
    background: var(--primary, var(--accent));
    cursor: pointer;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.15);
}

.mobile-nav-toggle span {
    display: block;
    width: 22px;
    height: 2px;
    background: #fff;
    border-radius: 2px;
    transition: transform 0.2s, opacity 0.2s;
}

.mobile-nav-toggle.is-open span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.mobile-nav-toggle.is-open span:nth-child(2) {
    opacity: 0;
}

.mobile-nav-toggle.is-open span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

.mobile-nav-drawer {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(4px);
}

.mobile-nav-drawer.is-open {
    display: block;
}

.mobile-nav-drawer-inner {
    position: absolute;
    top: 0;
    right: 0;
    width: min(280px, 85vw);
    height: 100%;
    background: var(--surface, #fff);
    padding: 72px 20px 24px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    box-shadow: -8px 0 32px rgba(0, 0, 0, 0.12);
    animation: slideInRtl 0.25s ease;
}

@keyframes slideInRtl {
    from { transform: translateX(100%); }
    to { transform: translateX(0); }
}

.mobile-nav-drawer-inner a {
    padding: 12px 16px;
    border-radius: 10px;
    font-weight: 600;
    min-height: var(--touch-min);
    display: flex;
    align-items: center;
    transition: background 0.15s;
}

.mobile-nav-drawer-inner a:hover {
    background: rgba(15, 118, 110, 0.08);
    color: var(--industrial);
}

/* Touch-friendly forms */
input, select, textarea, button, .btn {
    min-height: var(--touch-min);
}

/* Product card hover animation */
.box-slides {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.box-slides:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 28px rgba(30, 30, 60, 0.12);
}

/* Admin login */
.admin-login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
    background: linear-gradient(135deg, #0f766e 0%, #115e59 40%, #1e3a5f 100%);
}

.admin-login-card {
    width: min(420px, 100%);
    background: rgba(255, 255, 255, 0.97);
    backdrop-filter: blur(12px);
    border-radius: 20px;
    padding: 36px 28px;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.2);
    animation: fadeUp 0.4s ease;
}

@keyframes fadeUp {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}

.admin-login-card h1 {
    margin: 0 0 8px;
    font-size: 1.5rem;
    color: var(--industrial);
}

.admin-login-card .subtitle {
    color: var(--muted, #81858b);
    margin: 0 0 24px;
    font-size: 0.9rem;
}

.admin-login-card form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.admin-login-card input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--line, #e0e0e2);
    border-radius: 12px;
    font-size: 1rem;
}

.admin-login-card .btn-primary {
    background: linear-gradient(135deg, var(--industrial), #115e59);
    color: #fff;
    border: none;
    border-radius: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
}

.admin-login-card .btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 20px rgba(15, 118, 110, 0.35);
}

.admin-login-error {
    background: #fef2f2;
    color: #b91c1c;
    padding: 10px 14px;
    border-radius: 10px;
    margin-bottom: 16px;
    font-size: 0.9rem;
}

/* Admin tables responsive */
.admin-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 12px;
}

.admin-table-wrap table {
    min-width: 640px;
}

/* KPI cards */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.kpi-card {
    background: var(--surface, #fff);
    border-radius: 16px;
    padding: 20px;
    box-shadow: var(--shadow, 0 10px 30px rgba(30, 30, 60, 0.08));
    border-right: 4px solid var(--industrial);
    transition: transform 0.2s;
}

.kpi-card:hover {
    transform: translateY(-2px);
}

.kpi-card strong {
    display: block;
    font-size: 1.75rem;
    color: var(--industrial);
}

.kpi-card span {
    color: var(--muted, #81858b);
    font-size: 0.85rem;
}

/* Toast flash */
.admin-flash {
    padding: 12px 16px;
    border-radius: 10px;
    margin-bottom: 16px;
    animation: fadeUp 0.3s ease;
}

.admin-flash.ok {
    background: #ecfdf5;
    color: #047857;
}

.admin-flash.err {
    background: #fef2f2;
    color: #b91c1c;
}

/* Tablet: 641px – 1024px */
@media (max-width: 1024px) {
    .m-page {
        grid-template-columns: 1fr !important;
    }

    .m-page-left {
        order: 2;
    }

    .admin-wrap {
        grid-template-columns: 1fr !important;
    }

    .admin-sidebar {
        position: static !important;
        flex-direction: row !important;
        flex-wrap: wrap;
        gap: 8px;
        padding: 12px !important;
    }

    .admin-sidebar a {
        flex: 1 1 auto;
        min-width: 120px;
        text-align: center;
    }

    .slider-specials .container {
        padding-inline: 12px;
    }
}

/* Mobile: < 640px */
@media (max-width: 640px) {
    .mobile-nav-toggle {
        display: flex;
    }

    .container {
        width: min(1360px, 96%) !important;
    }

    .t-header-left .t-header-account {
        font-size: 0.85rem;
    }

    .hero-strip {
        flex-direction: column;
        gap: 8px;
    }

    .hero-slide-card h2 {
        font-size: 1.25rem !important;
    }

    .banner-specials {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 12px;
    }

    .slider-specials .next,
    .slider-specials .prev {
        display: none;
    }

    .c-footer__feature-innerbox {
        flex-direction: column !important;
        gap: 12px;
    }

    .c-footer__middlebar {
        flex-direction: column !important;
    }

    .admin-form {
        grid-template-columns: 1fr !important;
    }

    .admin-form input,
    .admin-form select,
    .admin-form button {
        width: 100%;
    }

    .kpi-grid {
        grid-template-columns: 1fr 1fr;
    }

    .admin-table-wrap table {
        min-width: 520px;
    }

    .password-cell {
        font-family: monospace;
        font-size: 0.85rem;
        word-break: break-all;
    }
}

@media (max-width: 400px) {
    .kpi-grid {
        grid-template-columns: 1fr;
    }
}
