/* ========================================
   style.css - نسخه مدرن و کاملاً ریسپانسیو
   طراحی شده برای عطا گلد
   ======================================== */

/* ========== فونت ========== */
@font-face {
    font-family: 'Yekan';
    src: url('fonts/Yekan.woff2') format('woff2'),
         url('fonts/Yekan.woff') format('woff');
    font-weight: normal;
    font-style: normal;
}

/* ========== CSS Variables (پالت رنگ مدرن) ========== */
:root {
    --primary: #6C5CE7;
    --primary-dark: #5A4BD1;
    --primary-light: #A29BFE;
    --primary-bg: #F8F7FF;
    
    --secondary: #00B894;
    --secondary-light: #55EFC4;
    
    --accent: #FDCB6E;
    --accent-light: #FFEAA7;
    
    --success: #00B894;
    --danger: #FF7675;
    --warning: #FDCB6E;
    --info: #74B9FF;
    
    --dark: #2D3436;
    --gray: #636E72;
    --light-gray: #DFE6E9;
    --bg: #F8F9FA;
    --white: #FFFFFF;
    
    --shadow: 0 2px 16px rgba(108, 92, 231, 0.10);
    --shadow-hover: 0 8px 30px rgba(108, 92, 231, 0.18);
    --shadow-lg: 0 12px 48px rgba(0, 0, 0, 0.10);
    --radius: 16px;
    --radius-sm: 10px;
    --radius-full: 50px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    
    --header-height: 60px;
    --bottom-nav-height: 64px;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Yekan', -apple-system, BlinkMacSystemFont, Tahoma, sans-serif;
    background: var(--bg);
    color: var(--dark);
    font-size: 15px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    padding-bottom: 85px; /* فضای خالی برای منوی پایین */
}

a {
    text-decoration: none;
    color: inherit;
}

/* ========== اسکرول بار سفارشی ========== */
::-webkit-scrollbar {
    width: 4px;
    height: 4px;
}
::-webkit-scrollbar-track {
    background: var(--bg);
}
::-webkit-scrollbar-thumb {
    background: var(--primary-light);
    border-radius: 10px;
}

/* ========== هدر (Desktop & Mobile) ========== */
.header {
    background: var(--white);
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    height: var(--header-height);
    border-bottom: 1px solid rgba(0, 0, 0, 0.04);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.03);
    backdrop-filter: blur(12px);
    background: rgba(255, 255, 255, 0.92);
}

.logo {
    display: flex;
    align-items: center;
    gap: 8px;
}
.logo img {
    height: 32px;
    width: auto;
}
.logo-text {
    font-weight: 700;
    font-size: 16px;
    color: var(--dark);
}
.logo-text span {
    color: var(--primary);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-left .user-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--dark);
}

.header-left .user-name .badge {
    background: var(--primary-bg);
    color: var(--primary);
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 10px;
    margin-right: 4px;
}

.header-left a {
    color: var(--gray);
    font-size: 13px;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}
.header-left a:hover,
.header-left a:active {
    background: var(--primary-bg);
    color: var(--primary);
}

.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    color: var(--dark);
    font-size: 22px;
    cursor: pointer;
    padding: 8px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}
.mobile-menu-btn:active {
    background: var(--primary-bg);
}

/* ========== منوی کناری (دسکتاپ) ========== */
.sidebar {
    position: fixed;
    top: var(--header-height);
    right: 0;
    width: 260px;
    height: calc(100% - var(--header-height));
    background: var(--white);
    padding: 16px 0;
    overflow-y: auto;
    z-index: 999;
    transition: var(--transition);
    transform: translateX(0);
    border-left: 1px solid rgba(0, 0, 0, 0.04);
}

.sidebar-logo {
    padding: 0 20px 16px;
    border-bottom: 1px solid var(--light-gray);
    margin-bottom: 8px;
}

.sidebar a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 20px;
    color: var(--gray);
    font-size: 14px;
    transition: var(--transition);
    margin: 2px 10px;
    border-radius: var(--radius-sm);
}

.sidebar a:hover,
.sidebar a:active,
.sidebar a.active {
    background: var(--primary-bg);
    color: var(--primary);
}

.sidebar a .icon {
    width: 24px;
    font-size: 18px;
    opacity: 0.7;
}

/* منوی کشویی */
.dropdown {
    margin: 2px 0;
}
.dropdown-title {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 20px;
    cursor: pointer;
    font-size: 14px;
    color: var(--gray);
    margin: 2px 10px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}
.dropdown-title:hover {
    background: var(--primary-bg);
}
.dropdown-title .arrow {
    margin-right: auto;
    font-size: 12px;
    transition: transform 0.3s;
}
.dropdown-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.35s ease;
    padding-right: 44px;
}
.dropdown-content.open {
    max-height: 400px;
}
.dropdown-content a {
    padding: 8px 16px;
    font-size: 13px;
}

/* ========== محتوای اصلی ========== */
.main-content {
    margin-right: 260px;
    margin-top: var(--header-height);
    padding: 24px;
    min-height: calc(100vh - var(--header-height));
    max-width: 1200px;
    margin-left: auto;
    margin-right: 260px;
}

/* ========== کارت‌ها (مدرن) ========== */
.card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 20px 24px;
    margin-bottom: 16px;
    border: none;
    box-shadow: var(--shadow);
    transition: var(--transition);
}
.card:active {
    transform: scale(0.99);
}
.card:hover {
    box-shadow: var(--shadow-hover);
}

.card h2,
.card h3 {
    font-weight: 700;
    margin-bottom: 12px;
    font-size: 18px;
}
.card h2 .subtitle,
.card h3 .subtitle {
    font-size: 13px;
    font-weight: 400;
    color: var(--gray);
    display: block;
    margin-top: 2px;
}

/* ========== گرید ========== */
.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}
.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}
.grid-4 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

/* ========== دکمه‌ها (مدرن) ========== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius-full);
    font-family: 'Yekan', sans-serif;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    min-height: 44px;
    min-width: 44px;
}

.btn-primary {
    background: var(--primary);
    color: var(--white);
}
.btn-primary:hover,
.btn-primary:active {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(108, 92, 231, 0.35);
}

.btn-secondary {
    background: var(--secondary);
    color: var(--white);
}
.btn-secondary:hover,
.btn-secondary:active {
    background: #00A381;
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(0, 184, 148, 0.35);
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--light-gray);
    color: var(--gray);
}
.btn-outline:hover,
.btn-outline:active {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-bg);
}

.btn-danger {
    background: var(--danger);
    color: var(--white);
}
.btn-danger:hover,
.btn-danger:active {
    background: #E17055;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 12px;
    min-height: 36px;
}
.btn-block {
    width: 100%;
    justify-content: center;
}

/* ========== فرم‌ها ========== */
.form-group {
    margin-bottom: 16px;
}
.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    font-size: 13px;
    color: var(--gray);
}
.form-group .hint {
    display: block;
    font-size: 11px;
    color: var(--gray);
    margin-top: 4px;
}

input,
select,
textarea {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--light-gray);
    border-radius: var(--radius-sm);
    font-family: 'Yekan', sans-serif;
    font-size: 14px;
    transition: var(--transition);
    background: var(--white);
    color: var(--dark);
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(108, 92, 231, 0.12);
}

input:disabled,
select:disabled,
textarea:disabled {
    background: var(--bg);
    opacity: 0.7;
}

/* ========== پیام‌ها (Alert) ========== */
.alert {
    padding: 14px 18px;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    font-size: 14px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    border: none;
}
.alert-success {
    background: #E8F8F5;
    color: #0A5C47;
    border-right: 3px solid var(--success);
}
.alert-error {
    background: #FDEDEC;
    color: #8B1A1A;
    border-right: 3px solid var(--danger);
}
.alert-warning {
    background: #FEF9E7;
    color: #8D6E0F;
    border-right: 3px solid var(--warning);
}
.alert-info {
    background: #EBF5FB;
    color: #1A5276;
    border-right: 3px solid var(--info);
}

/* ========== وضعیت‌ها ========== */
.status {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}
.status-pending {
    background: #FEF9E7;
    color: #8D6E0F;
}
.status-completed,
.status-success {
    background: #E8F8F5;
    color: #0A5C47;
}
.status-failed,
.status-error {
    background: #FDEDEC;
    color: #8B1A1A;
}
.status-approved {
    background: #E8F8F5;
    color: #0A5C47;
}
.status-rejected {
    background: #FDEDEC;
    color: #8B1A1A;
}

/* ========== قیمت‌ها ========== */
.price-gold {
    color: var(--primary);
    font-size: 24px;
    font-weight: 700;
}
.price-silver {
    color: var(--info);
    font-size: 24px;
    font-weight: 700;
}

/* ========== آمار کارت‌ها (Stat Cards) ========== */
.stat-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 20px;
    text-align: center;
    border: none;
    box-shadow: var(--shadow);
    transition: var(--transition);
}
.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-hover);
}
.stat-icon {
    font-size: 32px;
    margin-bottom: 8px;
}
.stat-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--dark);
}
.stat-label {
    font-size: 13px;
    color: var(--gray);
    margin-top: 4px;
}
.stat-trend {
    font-size: 12px;
    margin-top: 6px;
}
.trend-up {
    color: var(--success);
}
.trend-down {
    color: var(--danger);
}

/* ========== جدول (Desktop only - در موبایل کارت می‌شود) ========== */
.table-wrapper {
    overflow-x: auto;
}
.table {
    width: 100%;
    border-collapse: collapse;
}
.table th,
.table td {
    padding: 12px 14px;
    text-align: center;
    border-bottom: 1px solid var(--light-gray);
    font-size: 13px;
}
.table th {
    background: var(--bg);
    font-weight: 600;
    color: var(--gray);
    border-bottom: 2px solid var(--light-gray);
}
.table tr:hover {
    background: var(--primary-bg);
}
.table tr:last-child td {
    border-bottom: none;
}

/* ========== منوی پایین (Bottom Navigation) ========== */
.bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--bottom-nav-height);
    background: var(--white);
    border-top: 1px solid rgba(0, 0, 0, 0.06);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.06);
    z-index: 1000;
    padding: 4px 0 env(safe-area-inset-bottom, 0);
    backdrop-filter: blur(12px);
    background: rgba(255, 255, 255, 0.95);
    padding-bottom: env(safe-area-inset-bottom, 16px);
}

.bottom-nav .nav-items {
    display: flex;
    justify-content: space-around;
    align-items: center;
    height: 100%;
    max-width: 500px;
    margin: 0 auto;
}

.bottom-nav .nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 4px 12px;
    border: none;
    background: none;
    color: var(--gray);
    font-size: 10px;
    font-family: 'Yekan', sans-serif;
    cursor: pointer;
    transition: var(--transition);
    min-width: 44px;
    min-height: 44px;
    border-radius: var(--radius-sm);
    position: relative;
}
.bottom-nav .nav-item .icon {
    font-size: 22px;
    line-height: 1;
}
.bottom-nav .nav-item .label {
    font-size: 9px;
    font-weight: 500;
}
.bottom-nav .nav-item:active {
    background: var(--primary-bg);
}
.bottom-nav .nav-item.active {
    color: var(--primary);
}
.bottom-nav .nav-item.active .icon {
    transform: scale(1.05);
}
.bottom-nav .nav-item .badge-dot {
    position: absolute;
    top: 4px;
    right: 8px;
    width: 8px;
    height: 8px;
    background: var(--danger);
    border-radius: 50%;
    border: 2px solid var(--white);
}

/* ========== انیمیشن‌ها ========== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
.card,
.stat-card,
.announcement-item,
.ticket-item {
    animation: fadeIn 0.3s ease-out;
}

@keyframes pulse {
    0%,
    100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}
.pulse {
    animation: pulse 2s infinite;
}

/* ========================================
   RESPONSIVE - MOBILE FIRST
   ======================================== */

/* ===== موبایل (تا 768px) ===== */
@media (max-width: 768px) {
    body {
        font-size: 14px;
        padding-bottom: 90px; /* فضای خالی بیشتر برای منو در موبایل */
    }

    /* هدر موبایل */
    .header {
        padding: 0 12px;
        height: 56px;
    }
    .logo img {
        height: 28px;
    }
    .logo-text {
        font-size: 14px;
    }
    .header-left .user-name {
        font-size: 12px;
    }
    .header-left a:not(.admin-link):not(.logout-link) {
        display: none;
    }

    /* دکمه هامبرگر */
    .mobile-menu-btn {
        display: block;
    }

    /* منوی کناری - تبدیل به شلف (از راست) */
    .sidebar {
        transform: translateX(280px);
        box-shadow: none;
        width: 280px;
        border-left: none;
    }
    .sidebar.open {
        transform: translateX(0);
        box-shadow: -8px 0 40px rgba(0, 0, 0, 0.12);
    }

    /* محتوای اصلی */
    .main-content {
        margin-right: 0;
        padding: 12px 14px;
        margin-top: 56px;
    }

    /* کارت‌ها */
    .card {
        padding: 16px 18px;
        border-radius: var(--radius-sm);
    }

    /* گریدها -> تک ستونی */
    .grid-2,
    .grid-3,
    .grid-4 {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    /* دکمه‌ها */
    .btn {
        padding: 10px 18px;
        font-size: 13px;
        min-height: 44px;
    }

    /* فرم‌ها */
    input,
    select,
    textarea {
        padding: 10px 14px;
        font-size: 13px;
    }

    /* آمار کارت‌ها */
    .stat-value {
        font-size: 20px;
    }
    .stat-icon {
        font-size: 28px;
    }

    /* قیمت‌ها */
    .price-gold,
    .price-silver {
        font-size: 20px;
    }

    /* ===== جداول به کارت تبدیل شوند ===== */
    .table-wrapper .table {
        display: none;
    }
    .table-wrapper .table-card {
        display: block;
    }

    /* کارت جایگزین جدول */
    .table-card {
        background: var(--white);
        border-radius: var(--radius-sm);
        padding: 14px 16px;
        margin-bottom: 10px;
        box-shadow: var(--shadow);
        border: none;
        transition: var(--transition);
    }
    .table-card:active {
        transform: scale(0.98);
    }
    .table-card .row {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 6px 0;
        border-bottom: 1px solid var(--light-gray);
    }
    .table-card .row:last-child {
        border-bottom: none;
    }
    .table-card .label {
        font-size: 12px;
        color: var(--gray);
    }
    .table-card .value {
        font-size: 13px;
        font-weight: 500;
        text-align: left;
    }
    .table-card .value .highlight {
        color: var(--primary);
    }

    /* ===== منوی پایین ===== */
    .bottom-nav {
        display: block;
        height: 72px;
        padding-bottom: 16px;
    }

    /* ===== منوی کشویی در موبایل ===== */
    .dropdown-content {
        padding-right: 20px;
    }

    /* ===== دکمه‌های سریع در کارت‌ها ===== */
    .card .btn {
        min-height: 44px;
    }
}

/* ===== موبایل خیلی کوچک (تا 400px) ===== */
@media (max-width: 400px) {
    body {
        font-size: 13px;
        padding-bottom: 80px;
    }
    .main-content {
        padding: 10px 10px;
    }
    .card {
        padding: 14px 14px;
        border-radius: 12px;
    }
    .btn {
        padding: 8px 14px;
        font-size: 12px;
        min-height: 40px;
    }
    .stat-value {
        font-size: 18px;
    }
    .bottom-nav .nav-item .label {
        font-size: 8px;
    }
    .bottom-nav .nav-item .icon {
        font-size: 20px;
    }
    .bottom-nav {
        height: 68px;
        padding-bottom: 12px;
    }
    .header-left .user-name {
        font-size: 11px;
    }
}

/* ===== تبلت (769px - 1024px) ===== */
@media (min-width: 769px) and (max-width: 1024px) {
    .main-content {
        margin-right: 220px;
        padding: 20px;
    }
    .sidebar {
        width: 220px;
    }
    .grid-3 {
        grid-template-columns: repeat(2, 1fr);
    }
    .grid-4 {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ===== دسکتاپ بزرگ (بیشتر از 1024px) ===== */
@media (min-width: 1025px) {
    .main-content {
        max-width: 1200px;
        margin-right: 260px;
    }
    .grid-4 {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* ========================================
   DARK MODE (اختیاری - بر اساس سیستم)
   ======================================== */
@media (prefers-color-scheme: dark) {
    :root {
        --bg: #0D1117;
        --white: #161B22;
        --dark: #F0F6FC;
        --gray: #8B949E;
        --light-gray: #21262D;
        --shadow: 0 2px 16px rgba(0, 0, 0, 0.3);
        --shadow-hover: 0 8px 30px rgba(108, 92, 231, 0.25);
        --primary-bg: #1C1A2E;
    }

    body {
        background: var(--bg);
    }

    .header,
    .sidebar,
    .card,
    .stat-card,
    .bottom-nav {
        background: var(--white);
        border-color: var(--light-gray);
    }

    .header {
        background: rgba(22, 27, 34, 0.92);
        backdrop-filter: blur(12px);
    }

    .bottom-nav {
        background: rgba(22, 27, 34, 0.95);
        backdrop-filter: blur(12px);
    }

    input,
    select,
    textarea {
        background: var(--white);
        border-color: var(--light-gray);
        color: var(--dark);
    }

    input:focus,
    select:focus,
    textarea:focus {
        border-color: var(--primary);
        box-shadow: 0 0 0 4px rgba(108, 92, 231, 0.2);
    }

    .table th {
        background: var(--white);
    }
    .table td {
        border-color: var(--light-gray);
    }
    .table tr:hover {
        background: var(--primary-bg);
    }

    .sidebar a:hover,
    .sidebar a.active {
        background: var(--primary-bg);
    }

    .alert-success {
        background: #0A2E24;
        color: #7FE9D8;
    }
    .alert-error {
        background: #2E0A0A;
        color: #F5A3A3;
    }
    .alert-warning {
        background: #2E260A;
        color: #F5D67A;
    }
    .alert-info {
        background: #0A1A2E;
        color: #7AB8F5;
    }

    .status-pending {
        background: #2E260A;
        color: #F5D67A;
    }
    .status-completed,
    .status-success {
        background: #0A2E24;
        color: #7FE9D8;
    }
    .status-failed,
    .status-error {
        background: #2E0A0A;
        color: #F5A3A3;
    }

    .table-card {
        background: var(--white);
    }
    .table-card .row {
        border-color: var(--light-gray);
    }

    .btn-outline {
        border-color: var(--light-gray);
        color: var(--gray);
    }
    .btn-outline:hover {
        border-color: var(--primary);
        color: var(--primary);
        background: var(--primary-bg);
    }
}