/* ============================================================
   style.css - قالب رسمی، ریسپانسیو، مینیمال
   رنگ: آبی نفتی + خاکستری + کهربایی
   ============================================================ */

@import url('https://cdn.jsdelivr.net/gh/rastikerdar/vazirmatn@v33.003/Vazirmatn-font-face.css');

:root {
    --bg:         #f4f6f9;
    --card:       #ffffff;
    --border:     #e3e8ef;
    --text:       #1f2937;
    --muted:      #6b7280;
    --primary:    #1e3a5f;
    --primary-d:  #152a45;
    --primary-l:  #2d5182;
    --accent:     #d97706;
    --accent-l:   #f59e0b;
    --danger:     #b91c1c;
    --success:    #15803d;
    --warn:       #b45309;
    --info:       #1d4ed8;
    --radius:     10px;
    --radius-sm:  6px;
    --shadow:     0 1px 2px rgba(0,0,0,.04), 0 1px 3px rgba(0,0,0,.06);
    --shadow-md:  0 4px 6px -1px rgba(0,0,0,.07), 0 2px 4px -2px rgba(0,0,0,.06);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
    font-family: Vazirmatn, Tahoma, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.7;
    direction: rtl;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; transition: color .15s; }
a:hover { color: var(--primary-l); }

img { max-width: 100%; }

.container {
    width: 100%;
    max-width: 1180px;
    margin: 0 auto;
    padding: 0 14px;
}

/* ============================================================
   Topbar
   ============================================================ */
.topbar {
    background: var(--card);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 50;
}
.topbar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 60px;
    gap: 14px;
    padding: 8px 0;
    flex-wrap: wrap;
}
.brand {
    font-weight: 700;
    font-size: 16px;
    color: var(--primary);
    letter-spacing: -.2px;
    white-space: nowrap;
}
.brand:hover { color: var(--primary); text-decoration: none; }

.menu {
    display: flex;
    gap: 2px;
    align-items: center;
    flex-wrap: wrap;
    flex: 1;
    justify-content: flex-end;
}
.menu a {
    padding: 7px 12px;
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 13px;
    font-weight: 500;
    transition: all .15s;
    white-space: nowrap;
}
.menu a:hover { background: #eef2f7; text-decoration: none; }
.menu a.active {
    background: var(--primary);
    color: #fff;
}
.btn-logout {
    color: var(--danger) !important;
    border: 1px solid var(--border);
}
.btn-logout:hover { background: #fef2f2 !important; }

/* ============================================================
   Main
   ============================================================ */
.main-area { padding: 22px 14px 50px; min-height: 65vh; }

.page-head { margin-bottom: 18px; }
.page-head h1 {
    font-size: 19px;
    font-weight: 700;
    color: var(--primary-d);
    margin-bottom: 3px;
}
.page-head p { font-size: 13px; }

.muted { color: var(--muted); font-size: 13px; }

h3 {
    font-size: 15px;
    font-weight: 700;
    color: var(--primary-d);
    margin-bottom: 10px;
}

/* ============================================================
   Card
   ============================================================ */
.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: var(--shadow);
    margin-bottom: 14px;
}

/* ============================================================
   Grids — با ریسپانسیو خودکار
   ============================================================ */
.grid-2, .grid-3 {
    display: grid;
    gap: 14px;
    margin-bottom: 14px;
}
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }

/* ============================================================
   Stat
   ============================================================ */
.stat { text-align: center; padding: 18px 12px; margin: 0; }
.stat-label {
    color: var(--muted);
    font-size: 12.5px;
    margin-bottom: 6px;
    font-weight: 500;
}
.stat-value {
    font-size: 18px;
    font-weight: 700;
    color: var(--primary-d);
    line-height: 1.3;
}

/* ============================================================
   Buttons
   ============================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all .15s;
    text-align: center;
    line-height: 1.5;
    white-space: nowrap;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-l); color: #fff; }
.btn-outline {
    background: #fff;
    border-color: var(--border);
    color: var(--text);
}
.btn-outline:hover { background: #f9fafb; border-color: #cbd5e1; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #991b1b; color: #fff; }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #166534; color: #fff; }
.btn-block { display: flex; width: 100%; }
.btn-sm { padding: 5px 10px; font-size: 12px; }

.quick-actions {
    display: flex;
    gap: 8px;
    margin-top: 6px;
    flex-wrap: wrap;
}

/* ============================================================
   Alerts
   ============================================================ */
.alert {
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid;
    margin-bottom: 12px;
    font-size: 13px;
    line-height: 1.6;
}
.alert-success { background: #f0fdf4; border-color: #bbf7d0; color: #14532d; }
.alert-error   { background: #fef2f2; border-color: #fecaca; color: #7f1d1d; }
.alert-info    { background: #eff6ff; border-color: #bfdbfe; color: #1e3a8a; }
.alert-warn    { background: #fffbeb; border-color: #fde68a; color: #78350f; }

/* ============================================================
   Form
   ============================================================ */
.form-card label {
    display: block;
    margin: 12px 0 5px;
    font-size: 12.5px;
    color: var(--muted);
    font-weight: 500;
}
.form-card label:first-child { margin-top: 0; }

input[type=text], input[type=number], input[type=password],
input[type=tel], input[type=email], input[type=file],
select, textarea {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: #fff;
    font-family: inherit;
    font-size: 13.5px;
    color: var(--text);
    transition: border-color .15s, box-shadow .15s;
    line-height: 1.6;
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary-l);
    box-shadow: 0 0 0 3px rgba(45,81,130,.1);
}
textarea { resize: vertical; min-height: 80px; }

.svc-info {
    margin-top: 8px;
    font-size: 12.5px;
    background: #f8fafc;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    border-right: 3px solid var(--primary-l);
    color: var(--muted);
}
.svc-info:empty { display: none; }

.total-box {
    margin-top: 14px;
    padding: 12px 14px;
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    text-align: center;
    font-size: 13.5px;
}
.total-box strong { color: var(--primary-d); font-size: 15px; }

/* ============================================================
   Table — بدون اسلاید، کاملاً فشرده
   ============================================================ */
.table-wrap {
    padding: 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12.5px;
    min-width: 100%;
}
th, td {
    padding: 9px 10px;
    text-align: right;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
th {
    background: #f8fafc;
    color: var(--muted);
    font-weight: 600;
    font-size: 12px;
    white-space: nowrap;
}
td { white-space: nowrap; }
td.wrap { white-space: normal; word-break: break-all; }
tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #fafbfc; }

/* ============================================================
   Progress
   ============================================================ */
.progress {
    display: inline-block;
    width: 70px;
    height: 6px;
    background: #e5e7eb;
    border-radius: 99px;
    overflow: hidden;
    vertical-align: middle;
    margin-left: 5px;
}
.progress span {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, var(--primary-l), var(--primary));
    transition: width .4s;
}

/* ============================================================
   Wallet
   ============================================================ */
.wallet-balance {
    text-align: center;
    padding: 22px 16px;
    background: linear-gradient(135deg, var(--primary), var(--primary-d));
    color: #fff;
    border: none;
}
.wallet-balance .muted { color: rgba(255,255,255,.75) !important; }
.wallet-balance .big {
    font-size: 24px;
    font-weight: 700;
    color: #fff;
    margin-top: 4px;
}

.plan-card {
    text-align: center;
    padding: 16px 12px;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.plan-amount {
    font-size: 16px;
    font-weight: 700;
    color: var(--primary-d);
}
.plan-gift {
    display: inline-block;
    background: var(--accent);
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 10px;
    border-radius: 99px;
    align-self: center;
}

.custom-amount summary {
    cursor: pointer;
    font-weight: 600;
    color: var(--primary);
    user-select: none;
}
.custom-amount summary:hover { color: var(--primary-l); }

/* ============================================================
   Tickets
   ============================================================ */
.ticket-list { list-style: none; }
.ticket-list li { border-bottom: 1px solid var(--border); }
.ticket-list li:last-child { border: none; }
.ticket-list a {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    padding: 9px 2px;
    color: var(--text);
    font-size: 13px;
}
.ticket-list a:hover { color: var(--primary); }
.tag {
    background: #eef2f7;
    font-size: 11px;
    padding: 2px 9px;
    border-radius: 99px;
    color: var(--muted);
    white-space: nowrap;
}

.ticket-chat { margin-top: 14px; }
.tmsg {
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
    border: 1px solid var(--border);
    font-size: 13px;
}
.tmsg-user  { background: #f8fafc; }
.tmsg-admin { background: #eff6ff; border-color: #bfdbfe; }
.tmsg-head  { font-size: 11.5px; color: var(--muted); margin-bottom: 4px; }

/* ============================================================
   Footer
   ============================================================ */
.footer {
    text-align: center;
    padding: 18px 0;
    color: var(--muted);
    font-size: 12px;
    border-top: 1px solid var(--border);
    background: var(--card);
}

/* ============================================================
   Admin — تم تیره‌تر
   ============================================================ */
.admin-body { background: #eef1f6; }
.admin-topbar {
    background: var(--primary-d);
    border-bottom: none;
}
.admin-topbar .brand { color: #fff; }
.admin-topbar .menu a { color: #dbe4f0; }
.admin-topbar .menu a:hover { background: rgba(255,255,255,.1); color: #fff; }
.admin-topbar .menu a.active { background: rgba(255,255,255,.2); color: #fff; }
.admin-topbar .btn-logout { color: #fecaca !important; border-color: rgba(255,255,255,.2); }
.admin-topbar .btn-logout:hover { background: rgba(255,255,255,.1) !important; color: #fff !important; }

.badge {
    display: inline-block;
    padding: 2px 9px;
    border-radius: 99px;
    font-size: 11.5px;
    font-weight: 600;
    white-space: nowrap;
}
.badge-pending  { background: #fffbeb; color: #78350f; }
.badge-approved { background: #f0fdf4; color: #14532d; }
.badge-rejected { background: #fef2f2; color: #7f1d1d; }

.receipt-img {
    max-width: 70px;
    max-height: 70px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    cursor: pointer;
    transition: transform .15s;
}
.receipt-img:hover { transform: scale(1.05); }

/* ============================================================
   Auth (ورود/ثبت‌نام)
   ============================================================ */
.auth-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: linear-gradient(135deg, #eef1f6, #dfe5ec);
}
.auth-box {
    width: 100%;
    max-width: 380px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px 24px;
    box-shadow: var(--shadow-md);
}
.auth-box h1 {
    text-align: center;
    color: var(--primary-d);
    font-size: 18px;
    margin-bottom: 3px;
}
.auth-box .sub {
    text-align: center;
    color: var(--muted);
    font-size: 12.5px;
    margin-bottom: 20px;
}

/* ============================================================
   Responsive — موبایل
   ============================================================ */
@media (max-width: 700px) {
    html, body { font-size: 13.5px; }
    .container { padding: 0 10px; }

    .topbar-inner {
        min-height: auto;
        flex-direction: column;
        align-items: stretch;
        padding: 10px 0;
        gap: 8px;
    }
    .brand { text-align: center; font-size: 15px; }
    .menu {
        justify-content: center;
        flex-wrap: wrap;
        gap: 3px;
    }
    .menu a {
        font-size: 12px;
        padding: 6px 10px;
    }

    .main-area { padding: 16px 10px 40px; }
    .page-head h1 { font-size: 17px; }

    .card { padding: 13px; }

    .stat { padding: 14px 10px; }
    .stat-value { font-size: 16px; }

    h3 { font-size: 14px; }

    th, td {
        padding: 7px 8px;
        font-size: 11.5px;
    }
    th { font-size: 11px; }

    .btn { padding: 8px 14px; font-size: 12.5px; }
    .btn-sm { padding: 4px 8px; font-size: 11px; }

    .wallet-balance { padding: 18px 12px; }
    .wallet-balance .big { font-size: 20px; }

    .plan-amount { font-size: 14.5px; }
}

@media (max-width: 400px) {
    .menu a { padding: 5px 8px; font-size: 11.5px; }
    .grid-2, .grid-3 { gap: 10px; }
}