/* assets/css/style.css */

/* ریست استایل‌ها */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

:root {
    --primary-color: #2c3e50;
    --secondary-color: #3498db;
    --success-color: #27ae60;
    --danger-color: #e74c3c;
    --warning-color: #f39c12;
    --light-color: #ecf0f1;
    --dark-color: #2c3e50;
    --sidebar-width: 250px;
    --header-height: 70px;
}

body {
    background-color: #f5f7fa;
    color: #333;
    line-height: 1.6;
    direction: rtl;
    text-align: right;
}

.badge {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: bold;
    color: white;
}

.badge-info {
    background-color: var(--secondary-color);
}

.badge-success {
    background-color: var(--success-color);
}

.badge-danger {
    background-color: var(--danger-color);
}

.badge-warning {
    background-color: var(--warning-color);
}

/* استایل صفحه ورود */
.login-page {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.login-container {
    background: white;
    border-radius: 15px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.2);
    width: 100%;
    max-width: 450px;
    overflow: hidden;
}

.login-header {
    background: var(--primary-color);
    color: white;
    padding: 30px 20px;
    text-align: center;
}

.login-header h1 {
    font-size: 1.5rem;
    margin: 15px 0 10px;
}

.login-header p {
    opacity: 0.9;
    font-size: 0.9rem;
}

.logo {
    width: 80px;
    height: 80px;
    background: white;
    border-radius: 50%;
    padding: 10px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: bold;
    color: var(--primary-color);
}

.login-box {
    padding: 30px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--dark-color);
    font-weight: 600;
}

.form-group input {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.form-group input:focus {
    border-color: var(--secondary-color);
    outline: none;
}

.btn-login {
    background: var(--secondary-color);
    color: white;
    border: none;
    padding: 12px 20px;
    width: 100%;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.btn-login:hover {
    background: #2980b9;
}

.alert {
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 20px;
    text-align: center;
}

.alert-danger {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.login-info {
    margin-top: 25px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    border-right: 4px solid var(--secondary-color);
}

.login-info h3 {
    margin-bottom: 10px;
    color: var(--primary-color);
}

.login-info p {
    margin-bottom: 5px;
    font-size: 0.9rem;
}

.login-footer {
    text-align: center;
    padding: 15px;
    background: #f8f9fa;
    border-top: 1px solid #dee2e6;
    font-size: 0.8rem;
    color: #666;
}

/* استایل داشبورد */
.dashboard-page {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar-width);
    background: var(--primary-color);
    color: white;
    position: fixed;
    right: 0;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    transition: all 0.3s;
    z-index: 1000;
}

.sidebar-header {
    padding: 20px;
    background: rgba(0, 0, 0, 0.2);
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
}

.user-info i {
    font-size: 1.5rem;
}

.user-details h4 {
    font-size: 0.9rem;
    margin-bottom: 2px;
}

.user-details span {
    font-size: 0.8rem;
    opacity: 0.8;
}

.sidebar-menu {
    padding: 20px 0;
}

.menu-item {
    display: block;
    padding: 12px 20px;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    transition: all 0.3s;
    border-right: 3px solid transparent;
}

.menu-item:hover, .menu-item.active {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border-right-color: var(--secondary-color);
}

.menu-item i {
    margin-left: 10px;
    width: 20px;
    text-align: center;
}

.main-content {
    flex: 1;
    margin-right: var(--sidebar-width);
    padding: 20px;
    transition: all 0.3s;
}

.header {
    background: white;
    padding: 15px 20px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.header h1 {
    color: var(--primary-color);
    font-size: 1.5rem;
}

.hamburger-btn {
    display: none;
    background: none;
    border: none;
    color: var(--primary-color);
    font-size: 1.5rem;
    cursor: pointer;
}

/* استایل کارت‌ها */
.card {
    background: white;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #f0f0f0;
}

.card-header h2 {
    color: var(--primary-color);
    font-size: 1.3rem;
}

.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    text-decoration: none;
}

.btn-primary {
    background: var(--secondary-color);
    color: white;
}

.btn-primary:hover {
    background: #2980b9;
}

.btn-success {
    background: var(--success-color);
    color: white;
}

.btn-success:hover {
    background: #219653;
}

.btn-danger {
    background: var(--danger-color);
    color: white;
}

.btn-danger:hover {
    background: #c0392b;
}

.btn-warning {
    background: var(--warning-color);
    color: white;
}

.btn-warning:hover {
    background: #e67e22;
}

/* استایل فرم‌ها */
.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
    margin-bottom: 15px;
}

.form-control {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 1rem;
}

.form-control:focus {
    border-color: var(--secondary-color);
    outline: none;
}

select.form-control {
    height: 42px;
}

textarea.form-control {
    min-height: 100px;
    resize: vertical;
}

/* استایل جدول‌ها */
.table-responsive {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
}

table th, table td {
    padding: 12px 15px;
    text-align: right;
    border-bottom: 1px solid #eee;
}

table th {
    background: #f8f9fa;
    color: var(--primary-color);
    font-weight: 600;
    white-space: nowrap;
}

table tr:hover {
    background: #f8f9fa;
}

table .actions {
    display: flex;
    gap: 5px;
}

/* استایل داشبورد شعب */
.branches-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.branch-card {
    background: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s;
    cursor: pointer;
}

.branch-card:hover {
    transform: translateY(-5px);
}

.branch-header {
    background: var(--primary-color);
    color: white;
    padding: 20px;
    text-align: center;
}

.branch-header h3 {
    font-size: 1.2rem;
    margin-bottom: 5px;
}

.branch-body {
    padding: 20px;
}

.branch-info {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
}

.branch-info i {
    color: var(--secondary-color);
    font-size: 1.2rem;
}

.branch-footer {
    padding: 15px 20px;
    background: #f8f9fa;
    border-top: 1px solid #eee;
    text-align: center;
}

.branch-link {
    color: var(--secondary-color);
    text-decoration: none;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

/* استایل موبایل */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(100%);
    }
    
    .sidebar.active {
        transform: translateX(0);
        width: 100%;
    }
    
    .main-content {
        margin-right: 0;
        padding: 15px;
    }
    
    .hamburger-btn {
        display: block;
    }
    
    .branches-container {
        grid-template-columns: 1fr;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .header {
        padding: 10px 15px;
    }
    
    .header h1 {
        font-size: 1.1rem;
    }
    
    .user-menu {
        width: 100%;
        display: flex;
        justify-content: space-between;
        align-items: center;
        font-size: 0.85rem;
        margin-top: 5px;
        padding-top: 5px;
        border-top: 1px solid #eee;
    }
    
    table th, table td {
        padding: 8px 10px;
        font-size: 0.9rem;
    }
}

/* استایل‌های اضافی */
.text-success {
    color: var(--success-color);
}

.text-danger {
    color: var(--danger-color);
}

.text-warning {
    color: var(--warning-color);
}

.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.mt-3 {
    margin-top: 1rem;
}

.mb-3 {
    margin-bottom: 1rem;
}

.p-3 {
    padding: 1rem;
}

/* استایل برای datepicker */
.datepicker {
    direction: rtl;
}

/* بهبود ظاهر فیلد تاریخ و دکمه تقویم */
.datepicker-wrapper {
    position: relative;
    display: inline-block;
    width: 100%;
}
.datepicker-wrapper .form-control.datepicker {
    padding-left: 40px; /* فضای برای آیکون (چپ به دلیل RTL) */
}
.datepicker-toggle {
    position: absolute;
    left: 10px; /* در سمت چپ ورودی (RTL) قرار می‌گیرد */
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    color: var(--secondary-color);
    font-size: 1.05rem;
    cursor: pointer;
    padding: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.datepicker-toggle:focus {
    outline: none;
}
.pdp-modal, .pwt-datepicker, .datepicker-dropdown {
    z-index: 99999 !important; /* مطمئن شویم تقویم روی تمام لایه‌ها نمایش داده شود */
}

/* Flatpickr RTL adjustments */
.flatpickr-calendar {
    direction: rtl;
}
.flatpickr-months {
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.flatpickr-current-month {
    direction: rtl;
    text-align: right;
}
.flatpickr-weekdays {
    direction: rtl;
}
.flatpickr-days {
    direction: rtl;
    text-align: center;
}

.datepicker-clear {
    position: absolute;
    left: 42px; /* کنار آیکون */
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    color: #999;
    font-size: 1rem;
    cursor: pointer;
    padding: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.datepicker-clear:hover {
    color: var(--danger-color);
}
.datepicker-wrapper input[readonly] {
    background-color: #fff; /* مشخص بودن اینکه readonly است */
    cursor: pointer;
}

/* استایل‌های خاص برای چاپ */
@media print {
    .sidebar, .hamburger-btn, .btn {
        display: none !important;
    }
    
    .main-content {
        margin-right: 0 !important;
    }
    
    .card {
        box-shadow: none !important;
        border: 1px solid #ddd;
        page-break-inside: avoid;
    }
    
    .card-header {
        background: #f8f9fa !important;
        color: #000 !important;
    }
    
    table {
        page-break-inside: auto;
    }
    
    tr {
        page-break-inside: avoid;
        page-break-after: auto;
    }
}