/* =====================================================
   1. Font Definition & Global Variables
===================================================== */

/* فونت اصلی */
@font-face {
    font-family: 'Vazirmatn';
    src: url('fonts/shabnam/Shabnam-FD.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
}


:root {
    /* فونت */
    --font-main: 'Vazirmatn', Tahoma, Arial, sans-serif;

    /* رنگ‌ها */
    --color-primary: #1e293b;
    --color-secondary: #0ea5e9;
    --color-success: #22c55e;
    --color-warning: #f59e0b;
    --color-danger:  #ef4444;

    --color-bg: #f8fafc;
    --color-white: #ffffff;
    --color-border: #e2e8f0;
    --color-text: #1e293b;
    --color-text-light: #64748b;
}

/* =====================================================
   2. CSS Reset & Base Styles
===================================================== */

*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 14px;
}

body {
    font-family: var(--font-main);
    background-color: var(--color-bg);
    color: var(--color-text);
    line-height: 1.7;
    direction: rtl;
}

/* تایپوگرافی */
h1 { font-size: 1.6rem; }
h2 { font-size: 1.4rem; }
h3 { font-size: 1.2rem; }
h4 { font-size: 1.05rem; }

p {
    color: var(--color-text-light);
}

/* فرم‌ها و دکمه‌ها */
button,
input,
select,
textarea {
    font-family: var(--font-main);
    font-size: 0.95rem;
}

/* لینک‌ها */
a {
    text-decoration: none;
    color: inherit;
}

/* =====================================================
   3. Main Layout
===================================================== */

.app-container {
    display: flex;
    min-height: 100vh;
}

/* =====================================================
   4. Sidebar
===================================================== */

.sidebar a {
    display: block;
    width: 100%;
    color: inherit;
}

.sidebar {
    width: 250px;
    background-color: var(--color-primary);
    color: var(--color-white);
    padding: 20px 15px;
}

.logo {
    text-align: center;
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 30px;
}

.sidebar nav ul {
    list-style: none;
}

.sidebar nav ul li {
    padding: 12px 15px;
    margin-bottom: 6px;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.sidebar nav ul li:hover {
    background-color: rgba(255,255,255,0.1);
}

.sidebar nav ul li.active {
    background-color: var(--color-secondary);
}

/* =====================================================
   5. Main Content Area
===================================================== */

.main-content {
    flex: 1;
    padding: 25px 35px;
}

/* =====================================================
   6. Header
===================================================== */

.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 30px;
}

.user-info {
    color: var(--color-text-light);
    font-size: 0.9rem;
}

/* =====================================================
   7. Dashboard Stats Cards
===================================================== */

.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 20px;
    margin-bottom: 35px;
}

.stat-card {
    background-color: var(--color-white);
    border-radius: 12px;
    padding: 20px;
    border: 1px solid var(--color-border);
}

.stat-card h3 {
    font-size: 0.95rem;
    margin-bottom: 10px;
    color: var(--color-text-light);
}

.stat-card p {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-text);
}

/* وضعیت کارت‌ها */
.stat-card.success { border-right: 5px solid var(--color-success); }
.stat-card.warning { border-right: 5px solid var(--color-warning); }
.stat-card.danger  { border-right: 5px solid var(--color-danger); }
.stat-card.info    { border-right: 5px solid var(--color-secondary); }

/* =====================================================
   8. Buttons
===================================================== */

.btn {
    padding: 10px 20px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-size: 0.9rem;
    transition: opacity 0.2s ease;
}

.btn:hover {
    opacity: 0.9;
}

.btn.primary   { background-color: var(--color-secondary); color: #fff; }
.btn.secondary { background-color: var(--color-primary); color: #fff; }
.btn.success   { background-color: var(--color-success); color: #fff; }
.btn.warning   { background-color: var(--color-warning); color: #fff; }
.btn.danger    { background-color: var(--color-danger);  color: #fff; }

/* =====================================================
   9. Quick Actions
===================================================== */

.quick-actions {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

/* =====================================================
   10. Tables (Base – used everywhere)
===================================================== */

.table-wrapper {
    background-color: var(--color-white);
    border-radius: 12px;
    border: 1px solid var(--color-border);
    overflow: hidden;
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead {
    background-color: #f1f5f9;
}

th,
td {
    padding: 12px 15px;
    text-align: right;
    border-bottom: 1px solid var(--color-border);
    font-size: 0.9rem;
}

th {
    font-weight: 700;
    color: var(--color-text);
}

tbody tr:hover {
    background-color: #f8fafc;
}

/* =====================================================
   11. Forms (Base)
===================================================== */

.form-group {
    margin-bottom: 20px;
}

label {
    display: block;
    margin-bottom: 6px;
    font-size: 0.85rem;
    color: var(--color-text-light);
}

input,
select,
textarea {
    width: 100%;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid var(--color-border);
    outline: none;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--color-secondary);
}

/* =====================================================
   12. Utility Classes
===================================================== */

.text-center { text-align: center; }
.text-left   { text-align: left; }
.text-muted  { color: var(--color-text-light); }

.mt-20 { margin-top: 20px; }
.mb-20 { margin-bottom: 20px; }



/* ======================customer_view css=========================== */

/* =====================================================
   Tabs Style
===================================================== */
.tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.tab-link {
    background-color: #e2e8f0;
    border: none;
    border-radius: 8px;
    padding: 10px 20px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background-color 0.2s ease;
}

.tab-link:hover {
    background-color: #cbd5e1;
}

.tab-link.active {
    background-color: var(--color-secondary);
    color: #fff;
}

.tab-content {
    display: none;
    background-color: var(--color-white);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    padding: 20px;
}

.tab-content.active {
    display: block;
}


/* ======================customer_view css end======================= */



/* ======================purches_create css=============================== */

.section {
    margin-bottom: 32px;
}

.form-grid.wide {
    grid-template-columns: repeat(3, 1fr);
}

.installment-box {
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 16px;
    margin-bottom: 20px;
    background: #fafafa;
}

.installment-box h4 {
    margin-bottom: 12px;
    font-size: 15px;
}

.page-actions {
    text-align: left;
    margin-top: 30px;
}


/* ==================purches_create css end=============================== */

/* ===================customer_create====================== */

.phone-row {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

.phone-row input {
    flex: 1;
}

.btn.small {
    padding: 6px 10px;
    font-size: 12px;
}


/* ===================customer_create end====================== */




/* بک‌دراپ تار */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 98;
    display: none;
}

/* کانتینر مودال */
.modal {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 99;
}

/* محتوای مودال */
.modal-content {
    background: #fff;
    border-radius: 12px;
    max-width: 520px;
    width: 92%;
    padding: 24px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.25);
}

/* قفل اسکرول صفحه */
body.modal-open {
    overflow: hidden;
}


.btn.danger:disabled,
.btn.danger[disabled] {
    background-color: #fca5a5; /* تن قرمز خیلی کم‌رنگ‌تر */
    color: #fff;
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none; /* جلوگیری از کلیک */
}




/* =========================
   Persian Datepicker Fix
========================= */





/* =====================================================
   Sidebar - بازطراحی شده
===================================================== */

.sidebar {
    width: 260px;
    background-color: var(--color-primary);
    color: var(--color-white);
    display: flex;
    flex-direction: column;
    padding: 0;
    min-height: 100vh;
}

/* لوگو */
.logo {
    padding: 24px 20px 20px;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.logo span {
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: -0.3px;
}

/* ناوبری */
.sidebar nav {
    flex: 1;
    overflow-y: auto;
    padding: 12px 0;
}

.sidebar nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

/* عنوان بخش */
.nav-section {
    padding: 16px 20px 6px;
    pointer-events: none;
}

.nav-section span {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: rgba(255, 255, 255, 0.35);
}

/* آیتم‌های منو */
.sidebar nav ul li:not(.nav-section) {
    margin: 2px 12px;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.sidebar nav ul li:not(.nav-section) a {
    display: block;
    width: 100%;
    color: rgba(255, 255, 255, 0.75);
    text-decoration: none;
    padding: 10px 16px;
    font-size: 0.9rem;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.sidebar nav ul li:not(.nav-section):hover a {
    background-color: rgba(255, 255, 255, 0.08);
    color: #fff;
}

/* آیتم فعال */
.sidebar nav ul li.active a {
    background-color: var(--color-secondary);
    color: #fff;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(14, 165, 233, 0.3);
}

/* فوتر سایدبار */
.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.user-info {
    flex: 1;
    min-width: 0;
}

.user-name {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.7);
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.logout-btn {
    display: inline-block;
    padding: 8px 16px;
    background-color: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.8);
    border-radius: 8px;
    font-size: 0.85rem;
    text-decoration: none;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.logout-btn:hover {
    background-color: var(--color-danger);
    color: #fff;
}

/* اسکرول‌بار مخفی */
.sidebar nav::-webkit-scrollbar {
    width: 4px;
}

.sidebar nav::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar nav::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 4px;
}
