/* ===== Font ===== */
@font-face {
    font-family: 'MainFont';
    src: url('../fonts/main.woff') format('woff'),
         url('../fonts/main.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

/* ===== Reset & Base ===== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --success: #16a34a;
    --warning: #f59e0b;
    --danger: #dc2626;
    --info: #0891b2;
    --dark: #1e293b;
    --gray: #64748b;
    --light: #f1f5f9;
    --white: #ffffff;
    --border: #e2e8f0;
    --shadow: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 25px rgba(0,0,0,0.1);
    --radius: 8px;
}

body {
    font-family: 'MainFont', 'Vazirmatn', 'Tahoma', sans-serif;
    background: var(--light);
    color: var(--dark);
    line-height: 1.6;
    font-size: 14px;
}

a {
    color: var(--primary);
    text-decoration: none;
}

/* ===== Login Page ===== */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 20px;
}

.login-box {
    background: var(--white);
    border-radius: var(--radius);
    padding: 40px 30px;
    box-shadow: var(--shadow-lg);
    text-align: center;
}

.login-box h1 {
    font-size: 1.5rem;
    margin-bottom: 5px;
    color: var(--dark);
}

.login-box p {
    color: var(--gray);
    margin-bottom: 25px;
}

/* ===== Admin Layout ===== */
.admin-wrapper {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 240px;
    background: var(--dark);
    color: var(--white);
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    overflow-y: auto;
    z-index: 100;
}

.sidebar-header {
    padding: 25px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-header h2 {
    font-size: 1.2rem;
    margin-bottom: 3px;
}

.sidebar-header p {
    font-size: 0.8rem;
    opacity: 0.7;
}

.nav-menu {
    list-style: none;
    padding: 15px 0;
}

.nav-menu li a {
    display: block;
    padding: 12px 25px;
    color: rgba(255,255,255,0.8);
    transition: all 0.2s;
}

.nav-menu li a:hover,
.nav-menu li.active a {
    background: rgba(255,255,255,0.1);
    color: var(--white);
}

.content {
    flex: 1;
    margin-right: 240px;
    padding: 30px;
}

.content-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 25px;
}

.content-header h1 {
    font-size: 1.4rem;
}

/* ===== Stats ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 25px;
    box-shadow: var(--shadow);
    border-right: 4px solid var(--primary);
}

.stat-card.stat-success { border-right-color: var(--success); }
.stat-card.stat-warning { border-right-color: var(--warning); }
.stat-card.stat-info { border-right-color: var(--info); }

.stat-number {
    font-size: 1.8rem;
    font-weight: bold;
    margin-bottom: 5px;
}

.stat-label {
    color: var(--gray);
    font-size: 0.85rem;
}

/* ===== Cards ===== */
.card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 20px;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 25px;
    border-bottom: 1px solid var(--border);
}

.card-header h3 {
    font-size: 1rem;
}

.card-body {
    padding: 25px;
}

/* ===== Table ===== */
.table-responsive {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th,
.table td {
    padding: 12px 15px;
    text-align: right;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.table th {
    background: var(--light);
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--gray);
}

.table tbody tr:hover {
    background: #f8fafc;
}

.text-center {
    text-align: center;
}

/* ===== Badges ===== */
.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-success { background: #dcfce7; color: #166534; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-danger { background: #fee2e2; color: #991b1b; }

/* ===== Forms ===== */
.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    font-size: 0.9rem;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-family: inherit;
    font-size: 0.9rem;
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

fieldset {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 20px;
}

legend {
    padding: 0 10px;
    font-weight: 600;
    color: var(--primary);
}

.invoice-form {
    padding: 25px;
}

/* ===== Buttons ===== */
.btn {
    display: inline-block;
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-family: inherit;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
    background: var(--light);
    color: var(--dark);
}

.btn:hover {
    opacity: 0.9;
}

.btn-primary {
    background: var(--primary);
    color: var(--white);
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.8rem;
}

.btn-lg {
    padding: 14px 30px;
    font-size: 1rem;
}

.btn-block {
    display: block;
    width: 100%;
}

/* ===== Alerts ===== */
.alert {
    padding: 12px 18px;
    border-radius: 6px;
    margin-bottom: 20px;
    font-size: 0.9rem;
}

.alert-danger {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.alert-success {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #bbf7d0;
}

/* ===== Pagination ===== */
.pagination {
    display: flex;
    gap: 5px;
    padding: 15px 20px;
    justify-content: center;
}

.pagination a {
    padding: 8px 14px;
    border-radius: 6px;
    background: var(--light);
    color: var(--dark);
    font-size: 0.85rem;
}

.pagination a.active {
    background: var(--primary);
    color: var(--white);
}

/* ===== Invoice Detail ===== */
.invoice-detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}

.detail-row:last-child {
    border-bottom: none;
}

.detail-row .label {
    color: var(--gray);
    font-weight: 500;
}

.detail-row .price {
    font-weight: bold;
    color: var(--primary);
    font-size: 1.1rem;
}

.payment-link-card {
    grid-column: 1 / -1;
}

.payment-link-box {
    display: flex;
    gap: 10px;
    margin: 15px 0;
}

.payment-link-box input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-family: inherit;
    font-size: 0.85rem;
    direction: ltr;
    text-align: left;
}

.qr-code {
    display: flex;
    justify-content: center;
    margin: 20px 0;
}

.hint {
    color: var(--gray);
    font-size: 0.85rem;
}

/* ===== Filters ===== */
.filters {
    display: flex;
    gap: 8px;
    margin-right: auto;
}

/* ===== Pay Page ===== */
.pay-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
}

.pay-container {
    width: 100%;
    max-width: 480px;
    padding: 20px;
}

.pay-card {
    background: var(--white);
    border-radius: 12px;
    padding: 40px 30px;
    box-shadow: var(--shadow-lg);
}

.pay-header {
    text-align: center;
    margin-bottom: 30px;
}

.pay-header .logo {
    width: 80px;
    margin-bottom: 10px;
}

.pay-header h1 {
    font-size: 1.3rem;
    color: var(--dark);
}

.invoice-summary {
    margin-bottom: 25px;
}

.invoice-summary h2 {
    font-size: 1rem;
    margin-bottom: 15px;
    color: var(--gray);
}

.summary-row {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}

.summary-row.total {
    border-bottom: none;
    padding-top: 15px;
    font-weight: bold;
    font-size: 1.1rem;
}

.summary-row .price {
    color: var(--primary);
}

.btn-pay {
    display: block;
    width: 100%;
    padding: 16px;
    background: linear-gradient(135deg, #7c3aed, #6d28d9);
    color: var(--white);
    border: none;
    border-radius: 8px;
    font-size: 1.1rem;
    font-family: inherit;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s;
}

.btn-pay:hover {
    transform: translateY(-1px);
    box-shadow: 0 5px 15px rgba(109,40,217,0.3);
}

.pay-hint {
    text-align: center;
    color: var(--gray);
    font-size: 0.8rem;
    margin-top: 12px;
}

/* ===== Payment Status ===== */
.pay-status {
    text-align: center;
    padding: 30px 0;
}

.status-icon {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 15px;
    font-size: 2rem;
}

.pay-success .status-icon {
    background: #dcfce7;
    color: var(--success);
}

.pay-failed .status-icon,
.pay-cancelled .status-icon {
    background: #fee2e2;
    color: var(--danger);
}

.pay-status h2 {
    font-size: 1.2rem;
    margin-bottom: 10px;
}

.pay-status p {
    color: var(--gray);
}

.ref-code {
    margin-top: 10px;
    font-family: monospace;
    background: var(--light);
    padding: 8px 15px;
    border-radius: 6px;
    display: inline-block;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        transform: translateX(100%);
        transition: transform 0.3s;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .content {
        margin-right: 0;
        padding: 20px 15px;
    }

    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .invoice-detail-grid {
        grid-template-columns: 1fr;
    }

    .content-header {
        flex-wrap: wrap;
    }

    .filters {
        width: 100%;
        margin-right: 0;
        flex-wrap: wrap;
    }
}


/* ===== Additional Styles ===== */
.action-buttons {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.search-form .form-row {
    grid-template-columns: repeat(4, 1fr);
    margin-bottom: 10px;
}

.badge-info-light {
    background: #e0f2fe;
    color: #0c4a6e;
}

.report-filters .form-row {
    grid-template-columns: repeat(4, 1fr);
}

code {
    font-family: monospace;
    background: var(--light);
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 0.8rem;
}

@media (max-width: 768px) {
    .search-form .form-row,
    .report-filters .form-row {
        grid-template-columns: 1fr 1fr;
    }

    .action-buttons {
        flex-wrap: wrap;
    }
}
