/* Reset ساده */

*,
*::before,
*::after {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
}

/* بدنه اصلی */

body.app-body {
    font-family: 'Pinar', system-ui, sans-serif;
    background: #020617;
    color: #e5e7eb;
}

/* شِل کلی اپ */

.app-shell {
    display: flex;
    min-height: calc(100vh - 56px); /* چون هدر بالاست */
}

/* سایدبار */

.app-sidebar {
    width: 230px;
    background: #020617;
    border-left: 1px solid #111827;
    padding: 16px 10px;
    position: relative;
    z-index: 20;
}

.menu {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 10px;
    color: #9ca3af;
    text-decoration: none;
    font-size: 14px;
    transition: background .15s, color .15s, transform .1s;
}

.menu-item:hover {
    background: #0f172a;
    color: #e5e7eb;
    transform: translateX(-1px);
}

.menu-item.is-active {
    background: linear-gradient(135deg,#6366f1,#8b5cf6);
    color: #f9fafb;
}

.menu-icon {
    font-size: 16px;
}

/* هدر بالا */

.app-header {
    position: sticky;
    top: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    background: rgba(15,23,42,0.96);
    border-bottom: 1px solid #111827;
    backdrop-filter: blur(16px);
}

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

.header-right {
    display: flex;
    align-items: center;
}

.brand-title {
    font-size: 15px;
    font-weight: 600;
    color: #f9fafb;
}

.btn-icon {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    border: 1px solid #1f2937;
    background: #020617;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    cursor: pointer;
}

.icon-bar {
    width: 16px;
    height: 2px;
    border-radius: 999px;
    background: #e5e7eb;
    display: block;
    margin: 2px 0;
}

.user-chip {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #020617;
    border-radius: 999px;
    padding: 4px 8px;
    border: 1px solid #1f2937;
}

.user-name {
    font-size: 13px;
    color: #e5e7eb;
}

.user-avatar {
    width: 22px;
    height: 22px;
    border-radius: 999px;
    background: #6366f1;
    color: #f9fafb;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    text-decoration: none;
}

/* محتوای اصلی */

.app-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    background: radial-gradient(circle at top, #0b1120, #020617 55%);
}

.main-inner {
    padding: 16px 18px 20px;
}

.page-title {
    font-size: 18px;
    font-weight: 600;
    margin: 0 0 4px;
    color: #f9fafb;
}

.page-subtitle {
    font-size: 13px;
    color: #9ca3af;
    margin: 0 0 16px;
}

/* کارت‌ها */

.card {
    background: #020617;
    border-radius: 16px;
    border: 1px solid #111827;
    padding: 14px 14px 12px;
    box-shadow: 0 18px 45px rgba(15,23,42,0.7);
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

/* کارت‌های آمار داشبورد */

.stat-value {
    font-size: 18px;
    font-weight: 600;
    color: #f9fafb;
}

.stat-label {
    font-size: 12px;
    color: #9ca3af;
}

/* فیلدها و فرم‌ها */

.field {
    margin-bottom: 12px;
}

.field label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    color: #d1d5db;
}

.field-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.field-row .field {
    flex: 1;
    min-width: 0;
}

/* اینپوت / سلکت / تکست‌اریا */

.input,
input[type="text"],
input[type="password"],
input[type="email"],
input[type="number"],
select,
textarea {
    width: 100%;
    padding: 8px 10px;
    border-radius: 10px;
    border: 1px solid #1f2937;
    background: #020617;
    color: #e5e7eb;
    font-size: 13px;
    box-sizing: border-box;
    outline: none;
    transition: border-color .15s, box-shadow .15s, background-color .15s;
}

.input-sm {
    padding: 6px 8px;
    font-size: 12px;
}

textarea {
    min-height: 72px;
    resize: vertical;
}

.input:focus,
input:focus,
select:focus,
textarea:focus {
    border-color: #6366f1;
    box-shadow: 0 0 0 1px rgba(99,102,241,0.5);
    background-color: #020617;
}

/* placeholder */

::placeholder {
    color: #6b7280;
}

/* چک‌باکس / رادیو */

input[type="checkbox"],
input[type="radio"] {
    accent-color: #6366f1;
}

/* دکمه‌ها */

.btn-primary,
.btn-small,
.btn-small.btn-outline {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    padding: 7px 12px;
    font-size: 13px;
    text-decoration: none;
    cursor: pointer;
    border: 1px solid transparent;
}

.btn-primary {
    background: linear-gradient(135deg,#6366f1,#8b5cf6);
    color: #f9fafb;
}

.btn-primary:hover {
    filter: brightness(1.05);
}

.btn-small {
    background: #111827;
    color: #e5e7eb;
    border-color: #1f2937;
}

.btn-small.btn-outline {
    background: transparent;
    color: #9ca3af;
    border-color: #374151;
}

.btn-small:hover {
    border-color: #6366f1;
    color: #e5e7eb;
}

/* فلوها (Flow Cards) */

.flow-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.flow-card {
    background: #020617;
    border-radius: 16px;
    border: 1px solid #111827;
    padding: 12px 12px 10px;
}

.flow-card-header {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    align-items: flex-start;
    margin-bottom: 6px;
}

.flow-title {
    font-size: 15px;
    margin: 0 0 4px;
    color: #f9fafb;
}

.flow-meta-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    font-size: 12px;
    color: #9ca3af;
}

.flow-card-body {
    display: flex;
    gap: 10px;
    font-size: 12px;
    color: #9ca3af;
    margin-bottom: 8px;
}

.flow-card-actions {
    display: flex;
    gap: 8px;
}

.flow-steps,
.flow-post {
    background: #020617;
    border-radius: 999px;
    padding: 3px 8px;
    border: 1px solid #1f2937;
}

/* سوییچ فعال/غیرفعال */

.switch {
    position: relative;
    display: inline-block;
    width: 38px;
    height: 20px;
}
.switch input { display:none; }
.slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background-color: #111827;
    transition: .2s;
    border-radius: 999px;
}
.slider:before {
    position: absolute;
    content: "";
    height: 14px;
    width: 14px;
    inset-block-start: 3px;
    inset-inline-end: 3px;
    background-color: #9ca3af;
    transition: .2s;
    border-radius: 50%;
}
.switch input:checked + .slider {
    background-color: #4ade80;
}
.switch input:checked + .slider:before {
    transform: translateX(-16px);
    background-color: #022c22;
}

/* Stepها در صفحه flow_edit */

.step-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 6px;
}

.step-title {
    font-size: 14px;
    font-weight: 600;
    color: #f9fafb;
}

.step-caption {
    font-size: 11px;
    color: #9ca3af;
}

.buttons-container {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.button-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

/* ریسپانسیو */

@media (max-width: 960px) {
    .app-shell {
        flex-direction: column;
        min-height: 0;
    }

    .app-sidebar {
        position: fixed;
        inset-inline-start: 0;
        top: 0;
        bottom: 0;
        width: 240px;
        transform: translateX(100%);
        transition: transform .2s ease-out;
        box-shadow: -18px 0 40px rgba(15,23,42,0.8);
    }

    .app-sidebar.sidebar-open {
        transform: translateX(0);
    }

    body.sidebar-open {
        overflow: hidden;
    }

    .app-main {
        min-height: calc(100vh - 56px);
    }

    .main-inner {
        padding: 14px 12px 16px;
    }

    .card-grid {
        grid-template-columns: 1fr;
    }

    .flow-card {
        border-radius: 14px;
        padding: 10px 10px 8px;
    }
}

@media (min-width: 961px) and (max-width: 1280px) {
    .card-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* فرم‌ها در موبایل */

@media (max-width: 640px) {
    .field-row {
        flex-direction: column;
    }
}
