/* استایل کلی */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.6;
    direction: rtl;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* هدر */
.main-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 15px 0;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    margin-bottom: 30px;
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
    width: 100%;
}

.logo {
    flex: 0 0 auto;
}

.logo h2 {
    font-size: 24px;
    margin: 0;
}


.main-nav {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    padding-top: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.main-nav a {
    color: white;
    text-decoration: none;
    padding: 8px 15px;
    border-radius: 5px;
    transition: background-color 0.3s;
    min-height: 44px; /* حداقل touch target برای موبایل */
    display: flex;
    align-items: center;
    justify-content: center;
}

.main-nav a:hover,
.main-nav a.active {
    background-color: rgba(255,255,255,0.2);
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 15px;
    flex: 0 0 auto;
    flex-wrap: wrap;
    justify-content: flex-end;
}

/* فوتر */
.main-footer {
    background-color: #333;
    color: white;
    text-align: center;
    padding: 20px 0;
    margin-top: 50px;
}

/* صفحه لاگین */
.login-page {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 20px;
}

.login-box {
    background: white;
    padding: 40px;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

.login-box h1 {
    text-align: center;
    margin-bottom: 30px;
    color: #667eea;
}

.login-info {
    margin-top: 20px;
    padding: 15px;
    background-color: #f8f9fa;
    border-radius: 5px;
    font-size: 14px;
    text-align: center;
}

.login-info p {
    margin: 5px 0;
}

/* فرم‌ها */
.form {
    background: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
    color: #555;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
    font-family: inherit;
}

.form-group textarea {
    resize: vertical;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.form-actions {
    display: flex;
    gap: 10px;
    margin-top: 30px;
}

/* دکمه‌ها */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    font-size: 14px;
    transition: all 0.3s;
    font-family: inherit;
    min-height: 44px; /* حداقل touch target برای موبایل */
}

.btn-primary {
    background-color: #667eea;
    color: white;
}

.btn-primary:hover {
    background-color: #5568d3;
}

.btn-secondary {
    background-color: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background-color: #5a6268;
}

.btn-warning {
    background-color: #ffc107;
    color: #333;
}

.btn-warning:hover {
    background-color: #e0a800;
}

.btn-danger {
    background-color: #dc3545;
    color: white;
}

.btn-danger:hover {
    background-color: #c82333;
}

.btn-info {
    background-color: #17a2b8;
    color: white;
}

.btn-info:hover {
    background-color: #138496;
}

.btn-sm {
    padding: 5px 10px;
    font-size: 12px;
}

/* هشدار */
.alert {
    padding: 15px;
    border-radius: 5px;
    margin-bottom: 20px;
}

.alert-success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* صفحه */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    flex-wrap: wrap;
    gap: 15px;
}

.page-header h1 {
    color: #333;
    font-size: 28px;
}

/* بخش */
.section {
    background: white;
    padding: 25px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    margin-bottom: 20px;
}

.section h2 {
    margin-bottom: 20px;
    color: #667eea;
    font-size: 22px;
}

/* آمار */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: white;
    padding: 25px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    text-align: center;
}

.stat-card h3 {
    color: #666;
    font-size: 16px;
    margin-bottom: 10px;
}

.stat-number {
    font-size: 32px;
    font-weight: bold;
    color: #667eea;
}

/* جدول */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    width: 100%;
}

.table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    min-width: 600px;
}

.table thead {
    background-color: #667eea;
    color: white;
}

.table th,
.table td {
    padding: 12px;
    text-align: right;
    border-bottom: 1px solid #ddd;
}

.table tbody tr:hover {
    background-color: #f8f9fa;
}

.table tbody tr:last-child td {
    border-bottom: none;
}

.text-center {
    text-align: center;
}

.text-muted {
    color: #6c757d;
}

/* اطلاعات */
.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.info-item {
    padding: 15px;
    background-color: #f8f9fa;
    border-radius: 5px;
}

.info-item.full-width {
    grid-column: 1 / -1;
}

.info-item strong {
    display: block;
    margin-bottom: 5px;
    color: #667eea;
}

/* جستجو و فیلتر */
.search-form,
.filter-form {
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    margin-bottom: 20px;
}

.search-form input,
.filter-form input,
.filter-form select {
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
}

.search-form input {
    width: 100%;
    max-width: 500px;
}

/* صفحه‌بندی */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 5px;
    margin-top: 30px;
    flex-wrap: wrap;
}

.pagination-btn {
    padding: 8px 15px;
    border: 1px solid #ddd;
    border-radius: 5px;
    text-decoration: none;
    color: #333;
    background-color: white;
    transition: all 0.3s;
    font-size: 14px;
    min-height: 36px; /* حداقل touch target */
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.pagination-btn:hover {
    background-color: #667eea;
    color: white;
    border-color: #667eea;
}

.pagination-btn.active {
    background-color: #667eea;
    color: white;
    border-color: #667eea;
    font-weight: bold;
}

.pagination-ellipsis {
    padding: 8px 5px;
    color: #666;
}

/* Date Picker شمسی */
.persian-date-wrapper {
    position: relative;
}

.persian-date-input {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
    cursor: pointer;
}

.persian-date-input:focus {
    outline: none;
    border-color: #667eea;
}

.persian-calendar {
    background: white;
    border: 1px solid #ddd;
    border-radius: 5px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    z-index: 9999;
    direction: rtl;
    width: 100%;
    max-width: 320px;
    min-width: 280px;
    padding: 10px;
}

.persian-calendar .cal-day {
    min-height: 32px;
    font-size: 12px;
    padding: 6px;
}

.persian-calendar .cal-day:hover {
    background-color: #f0f0f0 !important;
    transform: scale(1.05);
}

.persian-calendar .cal-day.selected {
    background-color: #667eea !important;
    color: white !important;
    font-weight: bold;
}

.persian-calendar .cal-nav {
    transition: background-color 0.2s;
}

.persian-calendar .cal-nav:hover {
    background-color: #5568d3 !important;
}

.persian-calendar .cal-header {
    margin-bottom: 10px;
}

.persian-calendar .cal-weekdays {
    margin-bottom: 5px;
}

.persian-calendar .cal-days {
    gap: 3px;
}

/* رسپانسیو */
@media (max-width: 768px) {
    /* بهبود فونت برای موبایل */
    body {
        font-size: 15px;
        line-height: 1.7;
    }
    
    .container {
        padding: 10px;
    }
    
    /* هدر */
    .main-header {
        padding: 10px 0;
        margin-bottom: 20px;
    }
    
    .header-content {
        padding: 0 10px;
    }
    
    .header-top {
        flex-direction: column;
        align-items: center;
        gap: 15px;
    }
    
    .logo {
        order: 1;
        width: 100%;
        text-align: center;
    }
    
    .logo h2 {
        font-size: 20px;
        font-weight: 600;
    }
    
    .user-menu {
        order: 3;
        width: 100%;
        justify-content: center;
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
    
    .user-menu span {
        font-size: 15px;
        font-weight: 500;
    }
    
    .main-nav {
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
        gap: 5px;
        padding-top: 10px;
    }
    
    .main-nav a {
        flex: 1 1 auto;
        min-width: calc(50% - 5px);
        text-align: center;
        padding: 8px 10px;
        font-size: 14px;
        font-weight: 500;
    }
    
    /* صفحه */
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
        margin-bottom: 20px;
    }
    
    .page-header h1 {
        font-size: 22px;
        width: 100%;
        font-weight: 600;
    }
    
    .page-header > div {
        width: 100%;
        display: flex;
        flex-direction: column;
        gap: 10px;
    }
    
    /* بخش */
    .section {
        padding: 15px;
        margin-bottom: 15px;
    }
    
    .section h2 {
        font-size: 18px;
        margin-bottom: 15px;
        font-weight: 600;
    }
    
    /* فرم‌ها */
    .form {
        padding: 20px 15px;
    }
    
    .form-group {
        margin-bottom: 15px;
    }
    
    .form-group label {
        font-size: 15px;
        font-weight: 500;
    }
    
    .form-group input,
    .form-group select,
    .form-group textarea {
        padding: 10px;
        font-size: 16px; /* جلوگیری از zoom در iOS */
        font-weight: 400;
    }
    
    .form-row {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .form-actions {
        flex-direction: column;
        gap: 10px;
        margin-top: 20px;
    }
    
    .form-actions .btn {
        width: 100%;
    }
    
    /* دکمه‌ها */
    .btn:not(.btn-sm) {
        padding: 12px 18px;
        font-size: 15px;
        font-weight: 500;
        width: 100%;
        text-align: center;
    }
    
    .btn-sm {
        padding: 7px 12px;
        font-size: 13px;
        font-weight: 500;
        width: auto;
        display: inline-block;
    }
    
    /* دکمه‌های page-header */
    .page-header .btn {
        width: auto;
        min-width: 100px;
        font-weight: 500;
    }
    
    /* آمار */
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 15px;
        margin-bottom: 20px;
    }
    
    .stat-card {
        padding: 20px;
    }
    
    .stat-card h3 {
        font-size: 15px;
        font-weight: 500;
    }
    
    .stat-number {
        font-size: 28px;
        font-weight: 600;
    }
    
    /* جدول */
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .table {
        font-size: 14px;
        min-width: 600px;
    }
    
    .table th,
    .table td {
        padding: 10px 8px;
        white-space: nowrap;
        font-weight: 400;
    }
    
    .table th {
        font-size: 13px;
        font-weight: 600;
    }
    
    /* جدول در موبایل - نمایش بهتر */
    .table td:last-child {
        white-space: normal;
    }
    
    /* دکمه‌های داخل جدول در موبایل */
    .table .btn-sm {
        display: inline-block;
        margin: 2px;
        width: auto;
        min-width: 60px;
    }
    
    /* عملیات در جدول */
    .table td:last-child > div {
        flex-direction: column;
        gap: 5px;
    }
    
    .table td:last-child > div .btn-sm {
        width: 100%;
        margin: 2px 0;
    }
    
    .table td:last-child form {
        width: 100%;
    }
    
    .table td:last-child form .btn-sm {
        width: 100%;
    }
    
    /* وضعیت در جدول */
    .table td span[style*="color"] {
        font-size: 12px;
        padding: 4px 8px;
        display: inline-block;
        font-weight: 500;
    }
    
    /* اطلاعات */
    .info-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .info-item {
        padding: 12px;
        font-size: 15px;
    }
    
    .info-item strong {
        font-size: 14px;
        font-weight: 600;
    }
    
    /* جستجو و فیلتر */
    .search-form,
    .filter-form {
        padding: 15px;
    }
    
    .search-form input {
        max-width: 100%;
        margin-bottom: 10px;
        font-size: 16px;
        font-weight: 400;
    }
    
    .filter-form .form-row {
        gap: 10px;
    }
    
    .filter-form .form-group {
        margin-bottom: 10px;
    }
    
    .filter-form input,
    .filter-form select {
        font-size: 16px;
        font-weight: 400;
    }
    
    /* صفحه‌بندی */
    .pagination {
        gap: 3px;
        margin-top: 20px;
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .pagination-btn {
        padding: 8px 12px;
        font-size: 13px;
        font-weight: 500;
        min-width: 38px;
    }
    
    /* هشدار */
    .alert {
        padding: 14px;
        font-size: 15px;
        font-weight: 400;
        line-height: 1.6;
    }
    
    /* Date Picker */
    .persian-calendar {
        max-width: 100%;
        min-width: auto;
        padding: 10px;
    }
    
    .persian-calendar .cal-day {
        min-height: 28px;
        font-size: 11px;
        padding: 4px;
    }
    
    /* Login */
    .login-container {
        padding: 15px;
    }
    
    .login-box {
        padding: 30px 20px;
    }
    
    .login-box h1 {
        font-size: 24px;
        margin-bottom: 20px;
    }
}

/* رسپانسیو برای صفحه‌های کوچک‌تر */
@media (max-width: 480px) {
    body {
        font-size: 14px;
    }
    
    .container {
        padding: 8px;
    }
    
    .logo h2 {
        font-size: 18px;
        font-weight: 600;
    }
    
    .main-nav a {
        font-size: 13px;
        padding: 8px 10px;
        font-weight: 500;
    }
    
    .page-header h1 {
        font-size: 20px;
        font-weight: 600;
    }
    
    .section {
        padding: 12px;
    }
    
    .section h2 {
        font-size: 17px;
        font-weight: 600;
    }
    
    .table {
        font-size: 13px;
    }
    
    .table th,
    .table td {
        padding: 8px 6px;
        font-weight: 400;
    }
    
    .table th {
        font-size: 12px;
        font-weight: 600;
    }
    
    .btn:not(.btn-sm) {
        padding: 10px 15px;
        font-size: 14px;
        font-weight: 500;
    }
    
    .btn-sm {
        padding: 6px 10px;
        font-size: 12px;
        font-weight: 500;
    }
    
    .stat-number {
        font-size: 26px;
        font-weight: 600;
    }
    
    .stat-card h3 {
        font-size: 14px;
        font-weight: 500;
    }
    
    .pagination-btn {
        padding: 7px 10px;
        font-size: 12px;
        font-weight: 500;
        min-width: 35px;
    }
    
    /* بهبود نمایش در صفحه‌های کوچک */
    .search-form input,
    .filter-form input {
        font-size: 16px; /* جلوگیری از zoom در iOS */
        font-weight: 400;
    }
    
    .form-group input,
    .form-group select,
    .form-group textarea {
        font-size: 16px; /* جلوگیری از zoom در iOS */
        font-weight: 400;
    }
    
    .form-group label {
        font-size: 14px;
        font-weight: 500;
    }
    
    .info-item {
        font-size: 14px;
    }
    
    .info-item strong {
        font-size: 13px;
        font-weight: 600;
    }
    
    .alert {
        font-size: 14px;
        font-weight: 400;
    }
}

