﻿:root {
    --primary: #67b795;
    --primary-700: #559e7e;
    --bg: #0b0f14;
    --card: #fff;
    --text: #1f2937;
    --muted: #6b7280;
    --radius: 16px;
}

@media (prefers-color-scheme:light) {
    :root {
        --bg: #f5f7fb;
        --text: #1f2937;
        --muted: #6b7280;
    }
}

* {
    box-sizing: border-box
}

html, body {
    height: 100%
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: 'Vazirmatn',system-ui,-apple-system,Segoe UI,Roboto,sans-serif;
}
/* فونت روی کنترل‌ها */
body, button, .btn, input, select, textarea {
    font-family: 'Vazirmatn',sans-serif !important;
    font-size: 16px; /* جلوگیری از زوم روی iOS */
}

.container {
    max-width: 560px;
    margin: 40px auto;
    padding: 0 12px
}

.card {
    background: var(--card);
    border-radius: 24px;
    overflow: hidden;
    box-shadow: 0 18px 40px rgba(0,0,0,.25);
}

.card-head {
    background: var(--primary);
    color: #fff;
    padding: 16px 18px;
    font-weight: 800;
    font-size: 1.05rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 56px; /* برای موبایل */
}

.card-title {
    letter-spacing: .2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}

.card-body {
    padding: 16px 18px
}

.card-foot {
    padding: 12px 18px;
    border-top: 1px dashed #e5e7eb
}

.section-title {
    margin: 12px 0 6px;
    font-weight: 700;
    color: #374151;
    opacity: .9
}

.row {
    display: grid;
    grid-template-columns: 110px 1fr;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid #eef2f7;
}

    .row:last-child {
        border-bottom: none
    }

.label {
    color: #6b7280;
    font-size: .92rem
}

.value {
    font-weight: 700
}

.list-card {
    background: #fff;
    border: 1px solid #eef2f7;
    border-radius: 14px;
    padding: 6px
}

    .list-card .row {
        padding: 10px 8px
    }

.empty {
    padding: 14px;
    text-align: center
}

.search-inline {
    display: flex;
    gap: 8px;
    align-items: center
}

.input {
    flex: 1;
    padding: 12px 14px;
    border: 1.5px solid #cfd8e3;
    border-radius: 12px;
    outline: none;
}

    .input:focus {
        border-color: var(--primary)
    }

.btn {
    border: none;
    border-radius: 12px;
    padding: 10px 12px;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none; /* برای <a class="btn"> */
    display: inline-block;
}
/* دکمه‌های اصلی */
.btn-fill,
.btn-primary { /* alias برای سازگاری با JS تب ضمائم */
    background: var(--primary);
    color: #fff;
}

    .btn-fill:hover,
    .btn-primary:hover {
        background: var(--primary-700);
        color: #fff;
    }
/* دکمه حاشیه‌دار */
.btn-primary-soft {
    background: transparent;
    border: 2px solid var(--primary);
    color: var(--primary);
}

    .btn-primary-soft:hover {
        background: var(--primary);
        color: #fff;
    }
/* CTA */
.btn-cta {
    width: 100%;
    margin-top: 12px;
    background: var(--primary);
    color: #fff;
    padding: 14px;
    border-radius: 16px;
    font-weight: 800;
}

    .btn-cta:hover {
        background: var(--primary-700)
    }

.suggest-list {
    margin-top: 6px;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 16px 30px rgba(0,0,0,.15);
    background: #fff;
    z-index: 10;
    position: relative;
}

.suggest-item {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    padding: 10px 12px;
    cursor: pointer
}

    .suggest-item:hover {
        background: #f5fbf8
    }

/* تب‌ها */
.card-tabs {
    margin-top: 12px
}

.tab-pills {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
    position: sticky;
    top: 0;
    z-index: 11;
    background: #fff;
    padding: 6px 0;
    border-bottom: 1px solid #eef2f7;
}

.pill {
    flex: 1;
    padding: 10px;
    border-radius: 999px;
    border: 1.5px solid #d1e7dd;
    background: #f3faf7;
    color: #0f5132;
    font-weight: 700;
}

    .pill.active {
        background: #d1fae5;
        border-color: #34d399
    }

/* نمایش تب‌ها فقط در حالت active + اسکرول داخلی */
.card-tabs .list-card {
    display: none;
    max-height: 65vh;
    overflow: auto;
    padding: 0
}

    .card-tabs .list-card.active {
        display: block
    }

.list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 4px;
    border-bottom: 1px dashed #e5e7eb;
}

    .list-item:last-child {
        border-bottom: none
    }

.badge {
    background: #e7f6f0;
    color: #0f5132;
    border-radius: 999px;
    padding: 4px 10px;
    font-size: .8rem
}

.muted {
    color: #6b7280;
    font-size: .86rem
}

/* پیام‌های سریع */
.toast {
    position: fixed;
    inset-inline: 0;
    bottom: 18px;
    margin: auto;
    max-width: 420px;
    background: #111827;
    color: #fff;
    padding: 12px 14px;
    border-radius: 12px;
    display: none;
}

    .toast.show {
        display: block
    }

/* جدول ریسپانسیو (برای مصرفی‌ها و ضمائم) */
.table {
    width: 100%;
    border-collapse: collapse;
    border-radius: 14px;
    overflow: hidden;
    font-size: .92rem
}

    .table thead th {
        background: #f5fbf8;
        border-bottom: 1px solid #e5e7eb;
        text-align: right;
        padding: 10px 12px;
        font-weight: 800;
        white-space: nowrap;
    }

    .table tbody td {
        border-bottom: 1px dashed #eef2f7;
        padding: 10px 12px;
        vertical-align: top
    }

    .table tbody tr:last-child td {
        border-bottom: none
    }

    .table .num {
        text-align: left;
        font-variant-numeric: tabular-nums
    }

/* کانتینر اسکرول برای جدول ضمائم */
.table-wrap {
    overflow: auto;
}

@media (max-width:640px) {
    .table thead {
        display: none
    }

    .table, .table tbody, .table tr, .table td {
        display: block;
        width: 100%
    }

        .table tbody tr {
            border-bottom: 1px solid #eef2f7;
            padding: 8px 0;
            background: #fff;
            border-radius: 12px;
            margin: 8px 0;
            box-shadow: 0 6px 16px rgba(0,0,0,.06);
        }

            .table tbody tr:last-child {
                border-bottom: none
            }

        .table td {
            padding: 6px 12px;
            border: none !important
        }

            .table td::before {
                content: attr(data-label);
                display: block;
                color: var(--muted);
                margin-bottom: 4px;
                font-weight: 600
            }

        .table .num {
            text-align: inherit
        }
}

/* --- Modal --- */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.45);
    display: none;
    z-index: 1000;
}

    .modal-backdrop.show {
        display: block;
    }

.modal {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 1001;
}

.modal-card {
    width: 100%;
    max-width: 640px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0,0,0,.25);
    overflow: hidden;
    animation: modalIn .15s ease-out;
}

@keyframes modalIn {
    from {
        transform: translateY(6px);
        opacity: 0
    }

    to {
        transform: translateY(0);
        opacity: 1
    }
}

.modal-head {
    padding: 12px 16px;
    background: #f5fbf8;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-title {
    font-weight: 800
}

.modal-close {
    border: none;
    background: transparent;
    font-size: 1.2rem;
    cursor: pointer
}

.modal-body {
    padding: 12px 16px;
    max-height: 70vh;
    overflow: auto
}

.modal-rows .mrow {
    display: grid;
    grid-template-columns: 140px 1fr;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px dashed #eef2f7;
}

    .modal-rows .mrow:last-child {
        border-bottom: none
    }

.mlabel {
    color: var(--muted)
}

.mvalue {
    font-weight: 700;
    white-space: pre-wrap;
    line-height: 1.6
}

.tag {
    background: #e7f6f0;
    color: #0f5132;
    border-radius: 999px;
    padding: 2px 8px;
    font-size: .8rem;
    font-weight: 700;
}

.color-dot {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 999px;
    border: 1px solid #e5e7eb;
    vertical-align: middle;
    margin-inline-start: 6px;
}

/* پیام خطا برای تب ضمائم/مصرفی‌ها */
.error {
    color: #b91c1c;
    background: #fee2e2;
    border: 1px solid #fecaca;
    border-radius: 10px;
    padding: 10px 12px;
    margin: 8px;
    text-align: center;
    font-weight: 700;
}

/* فیلتربار دستورکارها */
.filter-bar {
    display: flex;
    gap: 6px;
    margin-bottom: 8px;
}

.filter-btn.active {
    background: var(--primary);
    color: #fff;
}

/* پولیش مخصوص موبایل */
@media (max-width: 480px) {
    .search-inline {
        flex-wrap: wrap;
        gap: 6px;
    }

        .search-inline .input {
            flex: 1 1 100%;
            min-width: 0;
        }

        .search-inline .btn {
            flex: 1 1 calc(50% - 3px);
        }

    .container {
        margin: 20px auto;
        padding: 0 10px;
    }

    .card {
        border-radius: 20px;
        box-shadow: 0 12px 28px rgba(0,0,0,.22);
    }

    .btn-cta {
        border-radius: 14px;
    }
}
/* تب‌ها اسکرول‌پذیر در موبایل */
@media (max-width: 640px) {
    .tab-pills {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        white-space: nowrap;
        gap: 6px;
        padding-bottom: 8px;
        position: static;
    }

    .pill {
        flex: 0 0 auto;
        display: inline-flex;
        align-items: center;
        padding: 10px 14px;
    }
}

/* safe area */
@supports (padding: max(0px)) {
    body {
        padding-bottom: max(0px, env(safe-area-inset-bottom));
    }
}
