﻿/* ===== Spiza Management - Responsive Optimized ===== */
:root {
    --spiza-gold: #F4A300;
    --spiza-gold-dark: #D18B00;
    --sidebar-bg: #1F2937;
    --sidebar-hover: #2D3748;
    --sidebar-active: #F4A300;
    --body-bg: #F3F4F6;
    --card-bg: #FFFFFF;
    --text-dark: #1F2937;
    --text-muted: #6B7280;
    --border-color: #E5E7EB;
    --success: #10B981;
    --danger: #EF4444;
    --info: #3B82F6;
    --warning: #F59E0B;
    --sidebar-width: 250px;
    --header-height: 64px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Vazirmatn', 'Segoe UI', Tahoma, sans-serif;
    background-color: var(--body-bg);
    color: var(--text-dark);
    direction: rtl;
    text-align: right;
    line-height: 1.6;
    overflow-x: hidden;
}

a {
    text-decoration: none;
    color: inherit;
}

/* ===== Sidebar ===== */
.sidebar {
    position: fixed;
    top: 0;
    right: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--sidebar-bg);
    color: #D1D5DB;
    display: flex;
    flex-direction: column;
    z-index: 1100;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 20px;
    font-size: 1.4rem;
    font-weight: 700;
    color: #fff;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-nav {
    flex: 1;
    padding: 15px 0;
    overflow-y: auto;
}

    .sidebar-nav a {
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 12px 20px;
        color: #D1D5DB;
        font-size: 0.95rem;
        border-right: 3px solid transparent;
        transition: all 0.2s;
    }

        .sidebar-nav a:hover {
            background: var(--sidebar-hover);
            color: #fff;
        }

        .sidebar-nav a.active {
            background: var(--sidebar-hover);
            color: var(--spiza-gold);
            border-right-color: var(--spiza-gold);
        }

.sidebar-footer {
    padding: 15px 20px;
    font-size: 0.8rem;
    color: #6B7280;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    text-align: center;
}

/* ===== Sidebar Close Button (فقط موبایل) ===== */
.sidebar-close {
    display: none; /* پیش‌فرض: مخفی در دسکتاپ */
    position: absolute;
    top: 15px;
    left: 15px;
    background: transparent;
    border: none;
    color: #fff;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    line-height: 1;
    transition: background 0.2s;
    z-index: 10;
}

    .sidebar-close:hover {
        background: rgba(255, 255, 255, 0.12);
    }

/* ===== Sidebar Toggle (همبرگری - فقط موبایل) ===== */
.sidebar-toggle {
    display: none; /* پیش‌فرض: مخفی در دسکتاپ */
    background: transparent;
    border: none;
    font-size: 1.6rem;
    color: var(--text-dark);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 8px;
    line-height: 1;
    transition: background 0.2s;
}

    .sidebar-toggle:hover {
        background: #F3F4F6;
    }

/* ===== Overlay ===== */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1050;
    opacity: 0;
    transition: opacity 0.3s ease;
}

    .sidebar-overlay.show {
        display: block;
        opacity: 1;
    }

/* ===== Main Content ===== */
.main-content {
    margin-right: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin 0.3s ease;
}

.topbar {
    height: var(--header-height);
    background: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    position: sticky;
    top: 0;
    z-index: 900;
}

.page-content {
    padding: 20px;
    flex: 1;
}

/* ===== Stats & Cards ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    border: 1px solid var(--border-color);
}

/* ===== Tables ===== */
.panel {
    background: var(--card-bg);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    margin-bottom: 25px;
    overflow: hidden;
}

.admin-table-container {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 600px;
}

    .admin-table th,
    .admin-table td {
        padding: 12px 15px;
        text-align: right;
        border-bottom: 1px solid var(--border-color);
    }

    .admin-table thead {
        background: #F9FAFB;
    }

    .admin-table th {
        font-weight: 600;
        color: var(--text-muted);
        font-size: 0.85rem;
        text-transform: uppercase;
        letter-spacing: 0.03em;
    }

    .admin-table tbody tr:hover {
        background: #F9FAFB;
    }

    .admin-table td {
        vertical-align: middle;
        font-size: 0.9rem;
    }

/* ===== Page Header ===== */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 10px;
}

    .page-header h1 {
        font-size: 1.5rem;
        font-weight: 700;
        color: var(--text-dark);
        margin: 0;
    }

/* ===== Buttons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 8px;
    border: 1px solid transparent;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.btn-primary {
    background: var(--spiza-gold);
    color: #fff;
}

    .btn-primary:hover {
        background: var(--spiza-gold-dark);
        color: #fff;
    }

.btn-sm {
    padding: 5px 12px;
    font-size: 0.8rem;
}

.btn-warning {
    background: var(--warning);
    color: #fff;
}

    .btn-warning:hover {
        background: #d97706;
        color: #fff;
    }

.btn-danger {
    background: var(--danger);
    color: #fff;
}

    .btn-danger:hover {
        background: #dc2626;
        color: #fff;
    }

.btn-secondary {
    background: #6B7280;
    color: #fff;
}

    .btn-secondary:hover {
        background: #4B5563;
        color: #fff;
    }

/* ===== Panel Header / Title ===== */
.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid var(--border-color);
}

.panel-title {
    font-size: 1.1rem;
    font-weight: 600;
}

/* ===== Badge ===== */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-success {
    background: #D1FAE5;
    color: #065F46;
}

.badge-warning {
    background: #FEF3C7;
    color: #92400E;
}

.badge-danger {
    background: #FEE2E2;
    color: #991B1B;
}

/* ===== Empty State ===== */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
}

/* ===== Avatar (Topbar) ===== */
.avatar-circle {
    width: 38px;
    height: 38px;
    background: #0d6efd;
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

/* ===== Profile Card ===== */
.profile-card {
    border: none;
    border-radius: 12px;
    transition: transform 0.2s ease;
}

    .profile-card:hover {
        transform: translateY(-4px);
    }

.avatar-placeholder {
    width: 80px;
    height: 80px;
    background-color: #e9ecef;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: #6c757d;
}

/* ===== Responsive: موبایل و تبلت (زیر 900px) ===== */
@media (max-width: 900px) {
    :root {
        --sidebar-width: 280px;
    }

    /* سایدبار به‌صورت پیش‌فرض بیرون از صفحه (راست) */
    .sidebar {
        transform: translateX(100%);
        box-shadow: -5px 0 15px rgba(0, 0, 0, 0.15);
    }

        .sidebar.open {
            transform: translateX(0);
        }

    /* محتوا بدون مارجین سایدبار */
    .main-content {
        margin-right: 0;
    }

    /* نمایش دکمه‌های مخصوص موبایل */
    .sidebar-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .sidebar-close {
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    /* گرید تک‌ستونه */
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .page-header h1 {
        font-size: 1.3rem;
    }

    .topbar-title {
        font-size: 1rem;
    }

    .form-actions {
        flex-direction: column;
    }

    .btn {
        width: 100%;
        justify-content: center;
    }
}

/* ===== Responsive: موبایل‌های خیلی کوچک (زیر 480px) ===== */
@media (max-width: 480px) {
    .page-content {
        padding: 15px;
    }

    .topbar-user .user-info {
        display: none;
    }

    .stat-card {
        padding: 15px;
    }

    .stat-icon {
        width: 40px;
        height: 40px;
        font-size: 1.2rem;
    }
}
