﻿/* =========================================
   1. تنظیمات متغیرها و رنگ‌ها (Variables)
   ========================================= */

@import url('css/fonts/fontiransanscss.css');

:root {
    /* پالت رنگی سبز رضوی */
    --primary-color: #1B5E20;
    --primary-dark: #003300;
    --primary-light: #4CAF50;
    --accent-color: #FFC107;
    /* رنگ‌های پایه */
    --bg-body: #F5F5F5;
    --bg-white: #FFFFFF;
    --text-main: #333333;
    --text-muted: #666666;
    --border-color: #E0E0E0;
    /* رنگ‌های وضعیت */
    --success-color: #2E7D32;
    --danger-color: #D32F2F;
    --warning-color: #F57C00;
    --info-color: #0288D1;
    /* ابعاد و فضاها */
    --header-height: 60px;
    --menu-height: 55px;
    --border-radius: 8px;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.1);
}

/* =========================================
   2. تنظیمات پایه و ریست (Base & Reset)
   ========================================= */
html, body {
    margin: 0;
    padding: 0;
    font-family: 'IRANSans', 'B Nazanin', Tahoma, sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
    direction: rtl;
    line-height: 1.6;
    font-size: 14px;
    overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6 {
    margin-top: 0;
    color: var(--primary-color);
    font-weight: 700;
}

a {
    text-decoration: none;
    color: var(--primary-color);
    transition: color 0.2s;
}

    a:hover {
        color: var(--primary-light);
    }

* {
    box-sizing: border-box;
}

/* =========================================
   3. چیدمان اصلی (Main Layout)
   ========================================= */
.aitayar-layout {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.aitayar-header {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    height: var(--header-height);
    position: fixed;
    top: 0;
    right: 0;
    left: 0;
    z-index: 1000;
    box-shadow: var(--shadow-md);
    display: flex;
    align-items: center;
}

.aitayar-content {
    margin-top: calc(var(--header-height) + var(--menu-height) + 20px);
    flex: 1;
    padding: 20px;
    width: 100%;
    max-width: 1000px;
    margin-left: auto;
    margin-right: auto;
}

.aitayar-footer {
    text-align: center;
    padding: 15px;
    background: var(--bg-white);
    border-top: 1px solid var(--border-color);
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* =========================================
   4. نویگیشن و منوها (Navigation)
   ========================================= */
.navbar-container {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 15px;
    max-width: 1200px;
    margin: 0 auto;
}

.navbar-brand-section {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-title {
    color: var(--bg-white);
    font-weight: bold;
    font-size: 1.3rem;
}

/* دکمه همبرگری - نمایش در همه دستگاه‌ها */
.hamburger-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 5px;
    margin-left: 10px;
}

.hamburger-line {
    width: 25px;
    height: 3px;
    background-color: var(--bg-white);
    border-radius: 2px;
    transition: 0.3s;
}

/* منوی افقی اصلی - شناور و وسط‌چین */
.aitayar-main-menu {
    position: fixed;
    top: var(--header-height);
    left: 0;
    right: 0;
    height: auto;
    background: transparent;
    z-index: 999;
    display: flex;
    justify-content: center;
    padding: 10px 15px;
    box-shadow: none;
}

.menu-scroll-wrapper {
    display: flex;
    gap: 8px;
    padding: 5px 10px;
    height: 100%;
    align-items: center;
    background: var(--bg-white);
    border-radius: 50px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
    max-width: 90%;
    width: fit-content;
    overflow-x: auto;
    white-space: nowrap;
}

    .menu-scroll-wrapper::-webkit-scrollbar {
        height: 4px;
    }

    .menu-scroll-wrapper::-webkit-scrollbar-thumb {
        background: var(--primary-light);
        border-radius: 4px;
    }

    .menu-scroll-wrapper::-webkit-scrollbar-track {
        background: #f1f1f1;
        border-radius: 4px;
    }

.menu-item {
    padding: 10px 20px;
    border-radius: 25px;
    font-size: 0.95rem;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
    font-weight: 500;
}

    .menu-item:hover, .menu-item.active {
        background-color: var(--primary-color);
        color: var(--bg-white);
        transform: translateY(-1px);
    }

.menu-divider {
    width: 1px;
    background-color: var(--border-color);
    margin: 0 5px;
    height: 20px;
    align-self: center;
}

.admin-item {
    color: var(--primary-color);
    font-weight: bold;
}

/* ✅ بخش کاربر در هدر - رنگ متن سفید برای خوانایی */
.navbar-user-section {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-greeting {
    color: var(--bg-white) !important;
    font-size: 0.9rem;
    font-weight: 500;
}

.btn-logout-sm {
    background: rgba(255, 255, 255, 0.2);
    color: var(--bg-white) !important;
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 6px 12px;
    border-radius: 20px;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.85rem;
    transition: all 0.2s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
}

    .btn-logout-sm:hover {
        background: var(--danger-color);
        border-color: var(--danger-color);
    }

/* =========================================
   5. منوی کشویی (Sidebar Drawer)
   ========================================= */
.sidebar-overlay {
    position: fixed;
    top: 0;
    right: 0;
    left: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1040;
    opacity: 0;
    visibility: hidden;
    transition: 0.3s;
    backdrop-filter: blur(2px);
}

    .sidebar-overlay.active {
        opacity: 1;
        visibility: visible;
    }

.sidebar-drawer {
    position: fixed;
    top: 0;
    right: -280px;
    width: 280px;
    height: 100vh;
    background: var(--bg-white);
    z-index: 1050;
    transition: right 0.3s ease-in-out;
    display: flex;
    flex-direction: column;
    box-shadow: -2px 0 8px rgba(0,0,0,0.1);
}

    .sidebar-drawer.open {
        right: 0;
    }

.drawer-header {
    background: var(--primary-color);
    color: var(--bg-white);
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.drawer-title {
    font-weight: bold;
    font-size: 1.1rem;
}

.drawer-close {
    background: none;
    border: none;
    color: var(--bg-white);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.drawer-body {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
}

.user-profile-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 10px;
}

.user-avatar {
    width: 45px;
    height: 45px;
    background: var(--bg-white);
    color: var(--primary-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1.2rem;
    flex-shrink: 0;
    border: 2px solid var(--primary-light);
}

.user-details {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

    .user-details strong {
        color: var(--text-main);
        font-size: 1rem;
    }

    .user-details small {
        color: var(--text-muted);
        font-size: 0.85rem;
    }

.drawer-menu-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.drawer-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 10px;
    color: var(--text-main);
    border-radius: 8px;
    transition: background 0.2s;
}

    .drawer-link:hover {
        background-color: #E8F5E9;
        color: var(--primary-color);
    }

    .drawer-link .icon {
        font-size: 1.2rem;
        width: 25px;
        text-align: center;
    }

.section-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin: 15px 10px 5px;
    display: block;
    font-weight: 600;
}

.drawer-footer {
    padding: 15px 20px;
    border-top: 1px solid var(--border-color);
}

.btn-logout-full {
    width: 100%;
    padding: 12px;
    background: var(--danger-color);
    color: var(--bg-white) !important;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 600;
    transition: background 0.2s;
}

    .btn-logout-full:hover {
        background: #b71c1c;
    }

.btn-login-full {
    width: 100%;
    padding: 12px;
    background: var(--primary-color);
    color: var(--bg-white) !important;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 600;
    transition: background 0.2s;
    text-decoration: none;
    display: block;
    text-align: center;
}

    .btn-login-full:hover {
        background: var(--primary-dark);
    }

.guest-profile-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 20px 0;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 10px;
}

.guest-avatar {
    width: 60px;
    height: 60px;
    background: #E0E0E0;
    color: var(--text-muted);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.guest-text {
    color: var(--text-muted);
    font-size: 0.9rem;
    text-align: center;
}

/* =========================================
   6. کامپوننت‌های عمومی (Components)
   ========================================= */

/* دکمه‌ها */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-family: inherit;
    font-size: 0.95rem;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-primary {
    background-color: var(--primary-color);
    color: var(--bg-white);
}

    .btn-primary:hover {
        background-color: var(--primary-dark);
        box-shadow: var(--shadow-sm);
    }

.btn-secondary {
    background-color: var(--primary-light);
    color: var(--bg-white);
}

    .btn-secondary:hover {
        background-color: var(--primary-color);
    }

.btn-danger {
    background-color: var(--danger-color);
    color: var(--bg-white);
}

    .btn-danger:hover {
        background-color: #b71c1c;
    }

.btn-success {
    background-color: var(--success-color);
    color: var(--bg-white);
}

    .btn-success:hover {
        background-color: #1B5E20;
    }

.btn-outline {
    background-color: transparent;
    border: 1px solid var(--primary-color);
    color: var(--primary-color);
}

    .btn-outline:hover {
        background-color: var(--primary-color);
        color: var(--bg-white);
    }

.btn-sm {
    padding: 6px 12px;
    font-size: 0.85rem;
}

.btn-lg {
    padding: 14px 28px;
    font-size: 1.1rem;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* فرم‌ها و اینپوت‌ها */
.form-group {
    margin-bottom: 15px;
}

.form-label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: var(--text-main);
    font-size: 0.95rem;
}

.form-control {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-family: inherit;
    font-size: 1rem;
    transition: border-color 0.2s, box-shadow 0.2s;
    background: var(--bg-white);
    color: var(--text-main);
}

    .form-control:focus {
        outline: none;
        border-color: var(--primary-color);
        box-shadow: 0 0 0 3px rgba(27, 94, 32, 0.1);
    }

    .form-control::placeholder {
        color: var(--text-muted);
    }

textarea.form-control {
    resize: vertical;
    min-height: 100px;
}

select.form-control {
    cursor: pointer;
}

.valid.modified:not([type=checkbox]) {
    border-color: var(--success-color);
}

.invalid {
    border-color: var(--danger-color);
}

    .invalid:focus {
        box-shadow: 0 0 0 3px rgba(211, 47, 47, 0.1);
    }

.validation-message {
    color: var(--danger-color);
    font-size: 0.85rem;
    margin-top: 4px;
    display: block;
}

/* کارت‌ها */
.card {
    background: var(--bg-white);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    padding: 20px;
    margin-bottom: 20px;
    border: 1px solid var(--border-color);
}

.card-header {
    font-weight: bold;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
    color: var(--primary-color);
    font-size: 1.1rem;
}

.card-body {
    padding: 0;
}

.card-footer {
    padding-top: 15px;
    margin-top: 15px;
    border-top: 1px solid var(--border-color);
}

/* جداول */
.table-responsive {
    overflow-x: auto;
    border-radius: var(--border-radius);
}

.table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-white);
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

    .table th, .table td {
        padding: 12px 15px;
        text-align: right;
        border-bottom: 1px solid var(--border-color);
    }

    .table th {
        background-color: #F1F8E9;
        color: var(--primary-color);
        font-weight: 600;
        font-size: 0.9rem;
    }

    .table tr:hover {
        background-color: #F9F9F9;
    }

    .table tr:last-child td {
        border-bottom: none;
    }

/* آلرت‌ها */
.alert {
    padding: 15px;
    border-radius: var(--border-radius);
    margin-bottom: 20px;
    border-right: 4px solid;
    display: flex;
    align-items: center;
    gap: 10px;
}

.alert-success {
    background-color: #E8F5E9;
    color: var(--success-color);
    border-color: var(--success-color);
}

.alert-danger {
    background-color: #FFEBEE;
    color: var(--danger-color);
    border-color: var(--danger-color);
}

.alert-warning {
    background-color: #FFF3E0;
    color: var(--warning-color);
    border-color: var(--warning-color);
}

.alert-info {
    background-color: #E3F2FD;
    color: var(--info-color);
    border-color: var(--info-color);
}

/* =========================================
   7. کلاس‌های کاربردی (Utilities)
   ========================================= */
.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.text-left {
    text-align: left;
}

.text-muted {
    color: var(--text-muted);
}

.text-primary {
    color: var(--primary-color);
}

.text-danger {
    color: var(--danger-color);
}

.text-success {
    color: var(--success-color);
}

.text-warning {
    color: var(--warning-color);
}

.fw-bold {
    font-weight: 700;
}

.fw-normal {
    font-weight: 400;
}

.fw-light {
    font-weight: 300;
}

.mt-1 {
    margin-top: 5px;
}

.mt-2 {
    margin-top: 10px;
}

.mt-3 {
    margin-top: 20px;
}

.mt-4 {
    margin-top: 30px;
}

.mb-1 {
    margin-bottom: 5px;
}

.mb-2 {
    margin-bottom: 10px;
}

.mb-3 {
    margin-bottom: 20px;
}

.mb-4 {
    margin-bottom: 30px;
}

.mx-auto {
    margin-left: auto;
    margin-right: auto;
}

.p-1 {
    padding: 5px;
}

.p-2 {
    padding: 10px;
}

.p-3 {
    padding: 20px;
}

.p-4 {
    padding: 30px;
}

.d-flex {
    display: flex;
}

.d-block {
    display: block;
}

.d-inline {
    display: inline;
}

.d-inline-block {
    display: inline-block;
}

.justify-between {
    justify-content: space-between;
}

.justify-center {
    justify-content: center;
}

.align-center {
    align-items: center;
}

.align-start {
    align-items: flex-start;
}

.gap-1 {
    gap: 5px;
}

.gap-2 {
    gap: 10px;
}

.gap-3 {
    gap: 20px;
}

.flex-column {
    flex-direction: column;
}

.flex-wrap {
    flex-wrap: wrap;
}

.flex-nowrap {
    flex-wrap: nowrap;
}

.w-100 {
    width: 100%;
}

.h-100 {
    height: 100%;
}

.d-none {
    display: none;
}

@media (max-width: 768px) {
    .d-md-none {
        display: none !important;
    }

    .d-mobile-block {
        display: block !important;
    }
}

@media (min-width: 769px) {
    .d-mobile-none {
        display: none !important;
    }

    .d-md-block {
        display: block !important;
    }
}

/* =========================================
   8. ریسپانسیو (Responsive)
   ========================================= */
@media (max-width: 768px) {
    .navbar-user-section {
        display: none !important;
    }

    .menu-scroll-wrapper {
        max-width: 95%;
        padding: 5px 8px;
    }

    .menu-item {
        padding: 8px 14px;
        font-size: 0.85rem;
    }

    .aitayar-content {
        margin-top: calc(var(--header-height) + var(--menu-height) + 10px);
        padding: 15px;
    }

    .table-responsive {
        border: 1px solid var(--border-color);
        border-radius: var(--border-radius);
    }

    .card {
        padding: 15px;
    }

    .sidebar-drawer {
        width: 260px;
    }
}

@media (min-width: 769px) {
    .hamburger-btn {
        display: flex;
    }

    .aitayar-content {
        max-width: 1000px;
        padding: 30px;
    }

    .menu-scroll-wrapper {
        max-width: 80%;
    }
}

@media (min-width: 1200px) {
    .menu-scroll-wrapper {
        max-width: 70%;
    }
}

/* =========================================
   9. استایل‌های خاص بلور (Blazor Specific)
   ========================================= */
#blazor-error-ui {
    background: #FFEBEE;
    bottom: 0;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    display: none;
    left: 0;
    padding: 15px 20px;
    position: fixed;
    width: 100%;
    z-index: 10000;
    color: var(--danger-color);
    text-align: left;
    direction: ltr;
    border-top: 3px solid var(--danger-color);
}

    #blazor-error-ui .reload {
        color: var(--primary-color);
        text-decoration: underline;
        margin-left: 15px;
    }

    #blazor-error-ui .dismiss {
        cursor: pointer;
        position: absolute;
        right: 20px;
        top: 50%;
        transform: translateY(-50%);
        font-size: 1.2rem;
    }

.loading-spinner {
    border: 4px solid rgba(0, 0, 0, 0.1);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border-left-color: var(--primary-color);
    animation: spin 1s linear infinite;
    margin: 40px auto;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.fullscreen-loader {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

    .fullscreen-loader .loading-text {
        margin-top: 15px;
        color: var(--primary-color);
        font-weight: 600;
    }

/* =========================================
   10. استایل‌های آپلود فایل (File Upload)
   ========================================= */
.file-upload-area {
    border: 2px dashed var(--border-color);
    border-radius: var(--border-radius);
    padding: 30px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    background: var(--bg-white);
}

    .file-upload-area:hover {
        border-color: var(--primary-color);
        background: #F1F8E9;
    }

    .file-upload-area.dragover {
        border-color: var(--primary-color);
        background: #E8F5E9;
    }

.file-upload-icon {
    font-size: 3rem;
    color: var(--text-muted);
    margin-bottom: 10px;
}

.file-upload-text {
    color: var(--text-muted);
    font-size: 0.95rem;
}

.file-preview-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 10px;
    margin-top: 15px;
}

.file-preview-item {
    position: relative;
    border-radius: var(--border-radius);
    overflow: hidden;
    aspect-ratio: 1;
    border: 1px solid var(--border-color);
}

    .file-preview-item img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }

.file-preview-remove {
    position: absolute;
    top: 5px;
    right: 5px;
    background: var(--danger-color);
    color: white;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
}

/* =========================================
   11. استایل‌های وضعیت (Status Badges)
   ========================================= */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}

.badge-success {
    background-color: #E8F5E9;
    color: var(--success-color);
}

.badge-danger {
    background-color: #FFEBEE;
    color: var(--danger-color);
}

.badge-warning {
    background-color: #FFF3E0;
    color: var(--warning-color);
}

.badge-info {
    background-color: #E3F2FD;
    color: var(--info-color);
}

.badge-primary {
    background-color: #E8F5E9;
    color: var(--primary-color);
}

/* =========================================
   12. انیمیشن‌ها (Animations)
   ========================================= */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.3s ease-out;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
    }

    to {
        transform: translateX(0);
    }
}

.slide-in-right {
    animation: slideInRight 0.3s ease-out;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

.pulse {
    animation: pulse 1.5s ease-in-out infinite;
}
