/**
 * سامانه مکاتبات اداری - استایل‌های عمومی
 */

/* ========== کانتینر اصلی ========== */
.mkh-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    font-family: Tahoma, 'Segoe UI', sans-serif;
    direction: rtl;
}

/* ========== فرم‌ها ========== */
.mkh-form-group {
    margin-bottom: 20px;
}

.mkh-form-row {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
}

.mkh-form-row .mkh-form-group {
    flex: 1;
    margin-bottom: 0;
}

.mkh-form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
    color: #333;
}

.mkh-form-group input[type="text"],
.mkh-form-group input[type="email"],
.mkh-form-group input[type="date"],
.mkh-form-group select,
.mkh-form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.3s;
}

.mkh-form-group input:focus,
.mkh-form-group select:focus,
.mkh-form-group textarea:focus {
    border-color: #2271b1;
    outline: none;
    box-shadow: 0 0 0 1px #2271b1;
}

.mkh-form-group input[type="file"] {
    padding: 10px 0;
}

/* ========== دکمه‌ها ========== */
.mkh-btn {
    display: inline-block;
    padding: 10px 20px;
    background: #f0f0f0;
    color: #333;
    text-decoration: none;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s;
}

.mkh-btn:hover {
    background: #e0e0e0;
}

.mkh-btn-primary {
    background: #2271b1;
    color: #fff;
}

.mkh-btn-primary:hover {
    background: #135e96;
}

.mkh-btn-danger {
    background: #d63638;
    color: #fff;
}

.mkh-btn-danger:hover {
    background: #b32d2e;
}

.mkh-btn-sm {
    padding: 5px 12px;
    font-size: 12px;
}

.mkh-btn-block {
    display: block;
    width: 100%;
}

/* ========== جدول‌ها ========== */
.mkh-table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    font-size: 14px;
}

.mkh-table th,
.mkh-table td {
    padding: 12px 15px;
    text-align: right;
    border-bottom: 1px solid #ddd;
}

.mkh-table th {
    background: #f5f5f5;
    font-weight: bold;
    color: #333;
}

.mkh-table tr:hover {
    background: #f9f9f9;
}

.mkh-table-small th,
.mkh-table-small td {
    padding: 8px 12px;
}

/* ========== اولویت‌ها ========== */
.mkh-priority {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: bold;
}

.mkh-priority-low {
    background: #d9edf7;
    color: #31708f;
}

.mkh-priority-normal {
    background: #dff0d8;
    color: #3c763d;
}

.mkh-priority-high {
    background: #fcf8e3;
    color: #8a6d3b;
}

.mkh-priority-urgent {
    background: #f2dede;
    color: #a94442;
}

/* ========== وضعیت‌ها ========== */
.mkh-status {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 12px;
}

.mkh-status-draft {
    background: #f5f5f5;
    color: #666;
}

.mkh-status-sent {
    background: #dff0d8;
    color: #3c763d;
}

.mkh-status-archived {
    background: #d9edf7;
    color: #31708f;
}

/* ========== آلرت‌ها ========== */
.mkh-alert {
    padding: 15px 20px;
    border-radius: 4px;
    margin: 20px 0;
}

.mkh-alert-success {
    background: #dff0d8;
    color: #3c763d;
    border: 1px solid #d6e9c6;
}

.mkh-alert-error {
    background: #f2dede;
    color: #a94442;
    border: 1px solid #ebccd1;
}

.mkh-alert-warning {
    background: #fcf8e3;
    color: #8a6d3b;
    border: 1px solid #faebcc;
}

.mkh-alert-info {
    background: #d9edf7;
    color: #31708f;
    border: 1px solid #bce8f1;
}

/* ========== داشبورد استاتس ========== */
.mkh-stats-grid {
    display: flex;
    gap: 20px;
    margin: 20px 0;
    flex-wrap: wrap;
}

.mkh-stat-card {
    flex: 1;
    background: #fff;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: transform 0.3s;
}

.mkh-stat-card:hover {
    transform: translateY(-3px);
}

.mkh-stat-number {
    font-size: 36px;
    font-weight: bold;
    color: #2271b1;
}

.mkh-stat-label {
    color: #666;
    margin-top: 10px;
    font-size: 14px;
}

.mkh-stat-urgent .mkh-stat-number {
    color: #d63638;
}

/* ========== بج‌ها ========== */
.mkh-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: bold;
}

.mkh-badge-new {
    background: #d63638;
    color: #fff;
}

.mkh-badge-read {
    background: #dff0d8;
    color: #3c763d;
}

.mkh-badge-success {
    background: #dff0d8;
    color: #3c763d;
}

/* ========== درخت سازمانی ========== */
.mkh-tree {
    list-style: none;
    padding-right: 0;
}

.mkh-tree li {
    padding: 8px 0;
    border-bottom: 1px solid #eee;
}

.mkh-tree .mkh-manager {
    color: #666;
    font-size: 12px;
    margin-right: 10px;
}

/* ========== لودینگ ========== */
.mkh-loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    margin-right: 10px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #2271b1;
    border-radius: 50%;
    animation: mkh-spin 1s linear infinite;
}

@keyframes mkh-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ========== صفحه مشاهده نامه ========== */
.mkh-letter-view {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.mkh-letter-header {
    padding: 20px;
    border-bottom: 2px solid #2271b1;
}

.mkh-letter-header h2 {
    margin: 0 0 10px 0;
    color: #2271b1;
}

.mkh-letter-meta {
    color: #666;
    font-size: 13px;
}

.mkh-meta-item {
    margin-left: 15px;
}

.mkh-letter-info {
    padding: 20px;
    background: #f9f9f9;
    border-bottom: 1px solid #eee;
}

.mkh-info-row {
    display: flex;
    margin-bottom: 10px;
}

.mkh-info-col {
    flex: 1;
}

.mkh-letter-content {
    padding: 20px;
    line-height: 1.8;
}

.mkh-workflow-history {
    padding: 20px;
    border-top: 1px solid #eee;
}

.mkh-letter-actions {
    padding: 20px;
    border-top: 1px solid #eee;
    display: flex;
    gap: 10px;
}

/* ========== پاسخگو ========== */
@media (max-width: 768px) {
    .mkh-form-row {
        flex-direction: column;
        gap: 15px;
    }
    
    .mkh-stats-grid {
        flex-direction: column;
    }
    
    .mkh-table {
        display: block;
        overflow-x: auto;
    }
    
    .mkh-info-row {
        flex-direction: column;
        gap: 10px;
    }
    
    .mkh-letter-actions {
        flex-direction: column;
    }
}

/* ========== چاپ ========== */
@media print {
    .mkh-btn,
    .mkh-letter-actions,
    .mkh-form-message,
    .mkh-loading {
        display: none !important;
    }
    
    .mkh-letter-view {
        box-shadow: none;
        padding: 0;
    }
    
    .mkh-letter-header {
        border-bottom: 1px solid #000;
    }
}