/* 
 * نظام إخلاء المسؤولية الإلكتروني - CSS
 */

/* المتغيرات العامة */
@import url('https://fonts.googleapis.com/css2?family=Tajawal:wght@400;500;700&display=swap');

:root {
    --primary-color: #0f766e;
    --primary-hover: #0b5f57;
    --secondary-color: #64748b;
    --success-color: #16a34a;
    --danger-color: #dc2626;
    --warning-color: #d97706;
    --background-color: #f4f7f7;
    --card-background: #ffffff;
    --text-primary: #0f172a;
    --text-secondary: #6b7280;
    --border-color: #e5e7eb;
    --shadow: 0 6px 20px rgba(15, 118, 110, 0.08), 0 2px 6px rgba(15, 118, 110, 0.06);
    --shadow-lg: 0 20px 40px rgba(15, 118, 110, 0.12);
    --radius: 12px;
}

/* إعادة التعيين */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Tajawal', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: radial-gradient(circle at top left, #eef6f4, #f8fafc 45%, #f4f7f7 100%);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

img {
    max-width: 100%;
    height: auto;
}

/* الروابط */
a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color 0.2s;
    cursor: pointer;
}

a:hover {
    color: var(--primary-hover);
}

/* الأزرار */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    border: 1px solid transparent;
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    cursor: pointer;
}

/* تخفيف تأثيرات مخصصة عند استخدام Bootstrap */
.btn-primary,
.btn-secondary,
.btn-success,
.btn-danger {
    box-shadow: none;
}

button,
input[type="submit"],
input[type="button"] {
    cursor: pointer;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    box-shadow: 0 6px 16px rgba(15, 118, 110, 0.18);
}

.btn-success {
    background-color: var(--success-color);
    color: white;
}

.btn-success:hover {
    background-color: #16a34a;
}

.btn-danger {
    background-color: var(--danger-color);
    color: white;
}

.btn-danger:hover {
    background-color: #dc2626;
}

.btn-secondary {
    background-color: #eef2f7;
    color: #334155;
    border-color: #dbe0e8;
}

.btn-secondary:hover {
    background-color: #e2e8f0;
}

.btn-lg {
    padding: 12px 22px;
    font-size: 14px;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.btn-block {
    width: 100%;
}

/* النماذج */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-primary);
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 14px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.15);
}

.form-control::placeholder {
    color: var(--text-secondary);
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-color: white;
    padding-right: 40px;
}

/* البطاقات */
.card {
    background-color: var(--card-background);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 20px;
    border: 1px solid rgba(15, 118, 110, 0.08);
}

.card-header {
    border-bottom: 1px solid var(--border-color);
}

.card-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
}

/* التنبيهات */
.alert {
    padding: 16px 20px;
    border-radius: var(--radius);
    margin-bottom: 20px;
    font-weight: 500;
}

.alert-success {
    background-color: #dcfce7;
    color: #166534;
    border: 1px solid #86efac;
}

.alert-error {
    background-color: #fee2e2;
    color: #991b1b;
    border: 1px solid #fca5a5;
}

.alert-warning {
    background-color: #fef3c7;
    color: #92400e;
    border: 1px solid #fcd34d;
}

.alert-info {
    background-color: #dbeafe;
    color: #1e40af;
    border: 1px solid #93c5fd;
}

/* الجداول */
.table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

table.table {
    width: 100%;
}

.table > :not(caption) > * > * {
    padding: 0.75rem 0.9rem;
}

/* شريط الحالة */
.status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.status-pending {
    background-color: #fef3c7;
    color: #92400e;
}

.status-approved {
    background-color: #dcfce7;
    color: #166534;
}

.status-rejected {
    background-color: #fee2e2;
    color: #991b1b;
}

.status-expired {
    background-color: #f1f5f9;
    color: #64748b;
}

/* إحصائيات */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: linear-gradient(135deg, var(--primary-color), #0ea5a0);
    color: white;
    padding: 24px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.stat-card.success {
    background: linear-gradient(135deg, var(--success-color), #22c55e);
}

.stat-card.danger {
    background: linear-gradient(135deg, var(--danger-color), #ef4444);
}

.stat-card.warning {
    background: linear-gradient(135deg, var(--warning-color), #f59e0b);
}

.stat-value {
    font-size: 36px;
    font-weight: 700;
    margin-bottom: 8px;
}

.stat-label {
    font-size: 14px;
    opacity: 0.9;
}

/* التخطيط */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    flex-wrap: wrap;
    gap: 20px;
}

.page-title {
    font-size: 26px;
    font-weight: 700;
    color: var(--text-primary);
}

/* نموذج تسجيل الدخول */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-box {
    width: 100%;
    max-width: 400px;
    background-color: var(--card-background);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 40px;
}

.login-logo {
    text-align: center;
    margin-bottom: 30px;
}

.login-logo h1 {
    font-size: 24px;
    color: var(--primary-color);
    margin-bottom: 8px;
}

.login-logo p {
    color: var(--text-secondary);
    font-size: 14px;
}

/* القائمة الجانبية */
.layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 260px;
    background: linear-gradient(180deg, #ffffff 0%, #f6fbfa 100%);
    border-left: 1px solid var(--border-color);
    padding: 20px 0;
    position: fixed;
    top: 0;
    right: 0;
    height: 100vh;
    overflow-y: auto;
    z-index: 100;
}

.sidebar-header {
    padding: 0 20px 20px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 20px;
}

.sidebar-logo {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary-color);
}

.sidebar-nav {
    list-style: none;
}

.sidebar-nav li {
    margin-bottom: 4px;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    color: var(--text-secondary);
    transition: all 0.2s;
}

.sidebar-nav a:hover,
.sidebar-nav a.active {
    background-color: #eef6f4;
    color: var(--primary-color);
    border-right: 3px solid var(--primary-color);
}

.sidebar-nav svg {
    width: 20px;
    height: 20px;
}

.main-content {
    flex: 1;
    margin-right: 260px;
    padding: 30px;
    background-color: var(--background-color);
}

/* اختيار متعدد لأنواع الخدمات */
.checkbox-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 10px;
    margin-top: 10px;
}

.checkbox-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 8px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    background: #f8fafc;
    font-size: 11.5px;
    line-height: 1.25;
    min-height: 30px;
}

.checkbox-item input {
    accent-color: var(--primary-color);
}

.checkbox-item .remove-service {
    margin-right: auto;
    border: none;
    background: transparent;
    color: #ef4444;
    font-weight: 700;
    cursor: pointer;
    padding: 0 6px;
}

.checkbox-item span {
    flex: 1;
    word-break: break-word;
}

.tag-input {
    display: flex;
    gap: 10px;
    align-items: center;
}

/* صفحة الموافقة للمستفيد */
.consent-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
}

.consent-box {
    width: 100%;
    max-width: 600px;
    background-color: var(--card-background);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 40px;
}

.consent-header {
    text-align: center;
    margin-bottom: 30px;
}

.consent-header h1 {
    font-size: 24px;
    color: var(--primary-color);
    margin-bottom: 10px;
}

.consent-message {
    background-color: #f8fafc;
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 30px;
    line-height: 2;
    white-space: pre-wrap;
    border: 1px solid var(--border-color);
}

.code-display {
    text-align: center;
    font-size: 32px;
    font-weight: 700;
    letter-spacing: 8px;
    color: var(--primary-color);
    margin: 20px 0;
}

.consent-buttons {
    display: flex;
    gap: 16px;
    margin-top: 30px;
}

.consent-buttons .btn {
    flex: 1;
}

/* تذييل الصفحة */
.footer {
    text-align: center;
    padding: 20px;
    color: var(--text-secondary);
    font-size: 12px;
    margin-top: 40px;
    border-top: 1px solid var(--border-color);
}

/* صفحة الطباعة */
@media print {
    .no-print {
        display: none !important;
    }
    
    body {
        background-color: white;
        font-size: 12px;
    }
    
    .print-container {
        max-width: 100%;
        padding: 0;
    }
    
    .card {
        box-shadow: none;
        border: 1px solid #000;
    }
}

/* التحميل */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* الاستجابة للشاشات الصغيرة */
@media (max-width: 900px) {
    .sidebar {
        width: 260px;
        height: 100vh;
        position: fixed;
        top: 0;
        right: -280px;
        transition: right 0.3s ease;
        box-shadow: var(--shadow-lg);
        z-index: 1050;
    }
    
    .sidebar.open {
        right: 0;
    }
    
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.4);
        z-index: 1040;
    }
    
    .sidebar-overlay.show {
        display: block;
    }
    
    .main-content {
        margin-right: 0;
        padding: 15px;
        padding-top: 60px; /* مساحة لزر القائمة */
    }
    
    .mobile-menu-btn {
        display: inline-flex;
        position: fixed;
        top: 10px;
        right: 10px;
        z-index: 1030;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    /* تصغير أرقام الإحصائيات */
    .stat-value {
        font-size: 24px;
    }
    
    .stat-label {
        font-size: 12px;
    }
    
    /* بطاقات الإحصائيات في صفين */
    .row.g-3.mb-4 > .col-12 {
        flex: 0 0 50%;
        max-width: 50%;
    }
    
    .consent-buttons {
        flex-direction: column;
    }
    
    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .page-header .actions {
        width: 100%;
    }

    .page-header .actions .btn,
    .page-header .actions a.btn {
        width: 100%;
        justify-content: center;
    }
    
    /* جعل الجدول أكثر استجابة */
    .table-container {
        margin: 0 -15px;
        padding: 0 5px;
    }
    
    table.table {
        font-size: 12px;
    }
    
    .table > :not(caption) > * > * {
        padding: 0.5rem 0.4rem;
        white-space: nowrap;
    }
    
    /* إخفاء أعمدة أقل أهمية على الجوال */
    table.table th:nth-child(3),
    table.table td:nth-child(3),
    table.table th:nth-child(6),
    table.table td:nth-child(6) {
        display: none;
    }
    
    .search-bar {
        flex-direction: column;
    }
    
    .search-bar .form-control {
        min-width: 100%;
    }
    
    .page-title {
        font-size: 20px;
    }
}

/* شاشات صغيرة جداً */
@media (max-width: 480px) {
    .row.g-3.mb-4 > .col-12 {
        flex: 0 0 50%;
        max-width: 50%;
    }
    
    .stat-value {
        font-size: 20px;
    }
    
    .stat-card {
        padding: 12px;
    }
    
    .consent-box {
        padding: 20px;
    }
    
    .login-box {
        padding: 24px;
    }
}

@media (min-width: 901px) {
    .mobile-menu-btn {
        display: none !important;
    }
    
    .sidebar-overlay {
        display: none !important;
    }
}


/* رمز التحقق */
.verification-input {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin: 20px 0;
}

.verification-input input {
    width: 50px;
    height: 60px;
    text-align: center;
    font-size: 24px;
    font-weight: 700;
    border: 2px solid var(--border-color);
    border-radius: var(--radius);
}

.verification-input input:focus {
    border-color: var(--primary-color);
    outline: none;
}

/* قائمة الإجراءات */
.actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    padding: 0;
    border-radius: 8px;
}

.icon-btn svg {
    width: 16px;
    height: 16px;
}

.mobile-menu-btn {
    display: none;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: #ffffff;
    color: var(--text-primary);
    cursor: pointer;
}

/* نموذج */
.inline-form {
    display: inline;
}

/* فارغ */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.empty-state svg {
    width: 80px;
    height: 80px;
    margin-bottom: 20px;
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 18px;
    margin-bottom: 10px;
    color: var(--text-primary);
}

/* شريط البحث */
.search-bar {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.search-bar .form-control {
    flex: 1;
    min-width: 200px;
}

/* مودال */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.show {
    display: flex;
}

.modal-content {
    background-color: var(--card-background);
    border-radius: var(--radius);
    padding: 30px;
    max-width: 500px;
    width: 90%;
    box-shadow: var(--shadow-lg);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.modal-title {
    font-size: 20px;
    font-weight: 700;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-secondary);
}
