/*
 * نظام إدارة الخطابات المتجاوب - ملف الأنماط (CSS)
 * تصميم متجاوب يعمل على الكمبيوتر، التابلت، والجوال
 * ألوان وتصميم ناعم (Soft UI) مع بطاقات بزوايا دائرية وظلال خفيفة
 */

/* إعدادات الخطوط والاتجاه العام */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    /* نظام الألوان */
    --background: #FFFFFF;
    --card-background: #FFFFFF;
    --primary-accent: #007AFF;
    --text-primary: #000000;
    --text-secondary: #6C757D;
    --status-received: #28A745;
    --status-pending: #FFC107;
    --status-sent: #17A2B8;
    --status-draft: #007AFF;
    --border-color: #E5E5E7;
    --shadow-light: 0 2px 8px rgba(0, 0, 0, 0.08);
    --shadow-medium: 0 4px 16px rgba(0, 0, 0, 0.12);
    --shadow-heavy: 0 8px 32px rgba(0, 0, 0, 0.16);
    --border-radius: 12px;
    --border-radius-small: 8px;
    --border-radius-large: 16px;
}

* {
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    direction: rtl;
    background-color: #F8F9FA;
    margin: 0;
    padding: 0;
    color: var(--text-primary);
    line-height: 1.6;
    font-size: 16px;
}

/* التخطيط الرئيسي */
.app-layout {
    display: flex;
    min-height: 100vh;
}

/* الشريط الجانبي - للكمبيوتر */
.sidebar {
    width: 280px;
    background: var(--card-background);
    border-left: 1px solid var(--border-color);
    box-shadow: var(--shadow-light);
    position: fixed;
    top: 0;
    right: 0;
    height: 100vh;
    overflow-y: auto;
    z-index: 1000;
    transition: transform 0.3s ease;
}

.sidebar-header {
    padding: 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-logo {
    width: 48px;
    height: 48px;
    border-radius: var(--border-radius-small);
    object-fit: contain;
    display: block;
    flex-shrink: 0;
    background: transparent;
    padding: 2px;
}

.sidebar-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.sidebar-nav {
    padding: 16px 0;
}

.nav-item {
    display: block;
    padding: 12px 24px;
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s ease;
    border-right: 3px solid transparent;
}

.nav-item:hover {
    background-color: #F8F9FA;
    color: var(--primary-accent);
    border-right-color: var(--primary-accent);
}

.nav-item.active {
    background-color: #E3F2FD;
    color: var(--primary-accent);
    border-right-color: var(--primary-accent);
}

/* المحتوى الرئيسي */
.main-content {
    flex: 1;
    margin-right: 280px;
    min-height: 100vh;
    background-color: var(--background);
}

/* الهيدر */
.header {
    background: var(--card-background);
    border-bottom: 1px solid var(--border-color);
    padding: 16px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--shadow-light);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-primary);
    cursor: pointer;
    padding: 8px;
    border-radius: var(--border-radius-small);
}

.mobile-menu-btn:hover {
    background-color: #F8F9FA;
}

.header-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.search-bar {
    display: flex;
    align-items: center;
    background: #F8F9FA;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 8px;
    min-width: 40px;
    width: 40px;
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
}

.search-bar:hover,
.search-bar.active {
    min-width: 300px;
    width: 300px;
    padding: 8px 16px;
}

.search-bar input {
    border: none;
    background: none;
    outline: none;
    flex: 1;
    font-size: 0.9rem;
    color: var(--text-primary);
    width: 0;
    opacity: 0;
    transition: all 0.3s ease;
    pointer-events: none;
}

.search-bar:hover input,
.search-bar.active input {
    width: auto;
    opacity: 1;
    pointer-events: auto;
}

.search-bar input::placeholder {
    color: var(--text-secondary);
}

.search-bar .icon {
    font-size: 1.2rem;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: var(--border-radius);
    background: #F8F9FA;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.user-profile:hover {
    background-color: #E9ECEF;
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--primary-accent);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.9rem;
}

.logout-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: var(--border-radius-small);
    background: #F8F9FA;
    border: 1px solid var(--border-color);
    color: #DC3545;
    font-size: 1.1rem;
    text-decoration: none;
    transition: all 0.2s ease;
    cursor: pointer;
}

.logout-btn:hover {
    background-color: #FFF5F5;
    border-color: #DC3545;
    transform: scale(1.05);
}

/* الحاوية الرئيسية */
.container {
    padding: 24px;
    max-width: 1200px;
    margin: 0 auto;
}

/* بطاقات KPI */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.kpi-card {
    background: var(--card-background);
    border-radius: var(--border-radius);
    padding: 24px;
    box-shadow: var(--shadow-light);
    border: 1px solid var(--border-color);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.kpi-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-medium);
}

.kpi-title {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin: 0 0 8px 0;
    font-weight: 500;
}

.kpi-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 8px 0;
}

.kpi-change {
    font-size: 0.8rem;
    font-weight: 500;
}

.kpi-change.positive {
    color: var(--status-received);
}

.kpi-change.negative {
    color: #DC3545;
}

/* قائمة النشاط الأخير */
.activity-section {
    background: var(--card-background);
    border-radius: var(--border-radius);
    padding: 24px;
    box-shadow: var(--shadow-light);
    border: 1px solid var(--border-color);
    margin-bottom: 32px;
}

.activity-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 20px 0;
}

.activity-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.activity-item {
    display: flex;
    align-items: center;
    padding: 16px 0;
    border-bottom: 1px solid var(--border-color);
}

.activity-item:last-child {
    border-bottom: none;
}

.activity-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #E3F2FD;
    color: var(--primary-accent);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: 16px;
    font-size: 1.2rem;
}

.activity-content {
    flex: 1;
}

.activity-text {
    font-size: 0.9rem;
    color: var(--text-primary);
    margin: 0 0 4px 0;
}

.activity-time {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin: 0;
}

/* النماذج */
.form-container {
    background: var(--card-background);
    border-radius: var(--border-radius);
    padding: 32px;
    box-shadow: var(--shadow-light);
    border: 1px solid var(--border-color);
    margin-bottom: 32px;
}

.form-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 24px 0;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

/* تخطيط جانبي للنماذج على الشاشات الكبيرة */
.content-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 32px;
    align-items: start;
}

.content-layout .form-container {
    margin-bottom: 0;
}

.content-layout .data-table {
    margin-top: 0;
}

/* تخطيط مرن للنماذج - نموذج يسار، آخر المعاملات يمين */
.content-flex {
    display: flex;
    flex-direction: row;
    gap: 32px;
    align-items: flex-start;
}

.content-flex .form-container {
    flex: 1;
    margin-bottom: 0;
}

.content-flex .table-container {
    flex: 1;
    background: var(--card-background);
    border-radius: var(--border-radius);
    padding: 24px;
    box-shadow: var(--shadow-light);
    border: 1px solid var(--border-color);
    max-height: 80vh;
    overflow-y: auto;
}

@media (max-width: 1024px) {
    .content-flex {
        flex-direction: column;
    }
    
    .content-flex .table-container {
        max-height: none;
    }
}

/* تحسين عرض التواريخ */
.date-display {
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    direction: ltr;
    text-align: left;
    background: #F8F9FA;
    padding: 4px 8px;
    border-radius: 4px;
    display: inline-block;
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-primary);
    font-size: 0.9rem;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-small);
    font-size: 1rem;
    font-family: inherit;
    background: var(--background);
    color: var(--text-primary);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-accent);
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.1);
}

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

/* الأزرار */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    border: none;
    border-radius: var(--border-radius-small);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s ease;
    font-family: inherit;
    gap: 8px;
}

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

.btn-primary:hover {
    background-color: #0056CC;
    transform: translateY(-1px);
    box-shadow: var(--shadow-medium);
}

.btn-secondary {
    background-color: #6C757D;
    color: white;
}

.btn-secondary:hover {
    background-color: #5A6268;
}

.btn-danger {
    background-color: #DC3545;
    color: white;
}

.btn-danger:hover {
    background-color: #C82333;
}

.btn-outline {
    background-color: transparent;
    color: var(--primary-accent);
    border: 1px solid var(--primary-accent);
}

.btn-outline:hover {
    background-color: var(--primary-accent);
    color: white;
}

/* شريط الفلاتر */
.filter-bar {
    background: var(--card-background);
    border-radius: var(--border-radius);
    padding: 20px;
    box-shadow: var(--shadow-light);
    border: 1px solid var(--border-color);
    margin-bottom: 24px;
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: center;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.filter-group label {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-primary);
}

.filter-group select,
.filter-group input {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-small);
    font-size: 0.9rem;
    background: var(--background);
    color: var(--text-primary);
    min-width: 150px;
}

/* عرض البيانات - جدول للكمبيوتر */
.data-table {
    background: var(--card-background);
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow-light);
    border: 1px solid var(--border-color);
}

.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table-header {
    background: #F8F9FA;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.table-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.table-actions {
    display: flex;
    gap: 12px;
    align-items: center;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

table th {
    background: #F8F9FA;
    color: var(--text-primary);
    font-weight: 600;
    padding: 16px 20px;
    text-align: right;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

table td {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
    vertical-align: middle;
}

table tr:hover {
    background-color: #F8F9FA;
}

/* عرض البيانات - بطاقات للجوال */
.cards-view {
    display: none;
}

.letter-card {
    background: var(--card-background);
    border-radius: var(--border-radius);
    padding: 20px;
    margin-bottom: 16px;
    box-shadow: var(--shadow-light);
    border: 1px solid var(--border-color);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.letter-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-medium);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.card-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
    flex: 1;
}

.card-status {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-received {
    background-color: #D4EDDA;
    color: var(--status-received);
}

.status-pending {
    background-color: #FFF3CD;
    color: var(--status-pending);
}

.status-sent {
    background-color: #D1ECF1;
    color: var(--status-sent);
}

.status-draft {
    background-color: #E3F2FD;
    color: var(--status-draft);
}

.card-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 16px;
}

.card-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.card-field-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.card-field-value {
    font-size: 0.9rem;
    color: var(--text-primary);
}

.card-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

/* زر الإضافة العائم */
.fab {
    position: fixed;
    bottom: 24px;
    left: 24px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background-color: var(--primary-accent);
    color: white;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: var(--shadow-heavy);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    z-index: 1000;
    display: none;
}

.fab:hover {
    transform: scale(1.1);
    box-shadow: 0 12px 40px rgba(0, 122, 255, 0.3);
}

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

.login-container {
    background: var(--card-background);
    border-radius: var(--border-radius-large);
    padding: 40px;
    box-shadow: var(--shadow-heavy);
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.login-logo {
    width: 80px;
    height: 80px;
    margin: 0 auto 24px;
    border-radius: var(--border-radius);
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 2rem;
    font-weight: 700;
}

.login-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 8px 0;
}

.login-subtitle {
    font-size: 1rem;
    color: var(--text-secondary);
    margin: 0 0 32px 0;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.login-form input {
    padding: 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-small);
    font-size: 1rem;
    background: var(--background);
    color: var(--text-primary);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.login-form input:focus {
    outline: none;
    border-color: var(--primary-accent);
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.1);
}

/* رسائل التنبيه */
.alert {
    padding: 16px 20px;
    border-radius: var(--border-radius-small);
    margin-bottom: 20px;
    font-weight: 500;
    border: 1px solid;
}

.alert-error {
    background-color: #F8D7DA;
    color: #721C24;
    border-color: #F5C6CB;
}

.alert-success {
    background-color: #D4EDDA;
    color: #155724;
    border-color: #C3E6CB;
}

.alert-info {
    background-color: #D1ECF1;
    color: #0C5460;
    border-color: #BEE5EB;
}

/* الحالة الفارغة */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.empty-state-icon {
    font-size: 4rem;
    margin-bottom: 20px;
    opacity: 0.5;
}

.empty-state-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0 0 8px 0;
    color: var(--text-primary);
}

.empty-state-text {
    font-size: 1rem;
    margin: 0 0 24px 0;
}

/* الاستجابة للشاشات المختلفة */

/* التابلت */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(100%);
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .main-content {
        margin-right: 0;
    }
    
    .mobile-menu-btn {
        display: block;
    }
    
    .search-bar:hover,
    .search-bar.active {
        min-width: 250px;
        width: 250px;
    }
    
    .kpi-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .form-grid {
        grid-template-columns: 1fr;
    }
    
    .table-responsive {
        display: none;
    }
    
    .cards-view {
        display: block;
    }
    
    .fab {
        display: block;
    }
}

/* الجوال */
@media (max-width: 768px) {
    .container {
        padding: 16px;
    }
    
    .header {
        padding: 12px 16px;
    }
    
    .header-title {
        font-size: 1.25rem;
    }
    
    .search-bar {
        display: flex;
    }
    
    .search-bar:hover,
    .search-bar.active {
        min-width: 200px;
        width: 200px;
    }
    
    .user-profile span {
        display: none;
    }
    
    .logout-btn {
        width: 32px;
        height: 32px;
        font-size: 1rem;
    }
    
    .kpi-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .kpi-card {
        padding: 20px;
    }
    
    .kpi-value {
        font-size: 1.75rem;
    }
    
    .form-container {
        padding: 20px;
    }
    
    .filter-bar {
        flex-direction: column;
        align-items: stretch;
    }
    
    .filter-group {
        width: 100%;
    }
    
    .filter-group select,
    .filter-group input {
        min-width: auto;
        width: 100%;
    }
    
    .card-content {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    
    .card-actions {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
        justify-content: center;
    }
    
    .login-container {
        padding: 32px 24px;
    }
    
    /* تخطيط عمودي للجوال */
    .content-layout {
        grid-template-columns: 1fr;
        gap: 24px;
    }
    
    .content-layout .form-container {
        margin-bottom: 24px;
    }
    
    .content-layout .data-table {
        margin-top: 0;
    }
}

/* شاشات صغيرة جداً */
@media (max-width: 480px) {
    .container {
        padding: 12px;
    }
    
    .header {
        padding: 8px 12px;
    }
    
    .header-title {
        font-size: 1.1rem;
    }
    
    .kpi-card {
        padding: 16px;
    }
    
    .form-container {
        padding: 16px;
    }
    
    .letter-card {
        padding: 16px;
    }
    
    .fab {
        bottom: 16px;
        left: 16px;
        width: 48px;
        height: 48px;
        font-size: 1.25rem;
    }
}

/* تحسينات إضافية للاستجابة */
@media (min-width: 1200px) {
    .container {
        max-width: 1400px;
    }
    
    .kpi-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* تحسينات للطباعة */
@media print {
    .sidebar,
    .header,
    .fab,
    .btn {
        display: none !important;
    }
    
    .main-content {
        margin-right: 0;
    }
    
    .data-table {
        display: block !important;
    }
    
    .cards-view {
        display: none !important;
    }
}

/* تحسينات للوصول */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* تحسينات للوضع المظلم */
@media (prefers-color-scheme: dark) {
    :root {
        --background: #1A1A1A;
        --card-background: #2D2D2D;
        --text-primary: #FFFFFF;
        --text-secondary: #B0B0B0;
        --border-color: #404040;
    }
    
    body {
        background-color: #121212;
    }
    
    .search-bar {
        background: #404040;
    }
    
    .user-profile {
        background: #404040;
    }
    
    .user-profile:hover {
        background-color: #4A4A4A;
    }
    
    .logout-btn {
        background: #404040;
        border-color: #666;
    }
    
    .logout-btn:hover {
        background-color: #5A5A5A;
        border-color: #DC3545;
    }
}

/* ========================================
   أنماط أزرار الصلاحيات (Switch Buttons)
   ======================================== */

.permissions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-top: 12px;
}

.permission-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: #F8F9FA;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    transition: all 0.3s ease;
    position: relative;
}

.permission-item:hover {
    background: #F0F0F0;
    border-color: var(--primary-accent);
    box-shadow: 0 2px 8px rgba(0, 122, 255, 0.1);
    transform: translateY(-1px);
}

.permission-item:has(input:checked) {
    background: linear-gradient(135deg, #E3F2FD 0%, #BBDEFB 100%);
    border-color: var(--primary-accent);
    box-shadow: 0 4px 12px rgba(0, 122, 255, 0.15);
}

.permission-item:has(input:checked):hover {
    background: linear-gradient(135deg, #BBDEFB 0%, #90CAF9 100%);
}

.permission-item span {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.95rem;
    transition: color 0.3s ease;
}

.permission-item:has(input:checked) span {
    color: #0056CC;
}

/* Toggle Switch Styles - محسّنة */
.switch {
    position: relative;
    display: inline-block;
    width: 52px;
    height: 28px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 22px;
    width: 22px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

input:checked + .slider {
    background: linear-gradient(135deg, var(--primary-accent) 0%, #0056CC 100%);
    box-shadow: 0 0 0 4px rgba(0, 122, 255, 0.15);
}

input:checked + .slider:before {
    transform: translateX(24px);
    box-shadow: 0 2px 8px rgba(0, 122, 255, 0.4);
}

input:focus + .slider {
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.1);
}

input:checked:focus + .slider {
    box-shadow: 0 0 0 4px rgba(0, 122, 255, 0.2);
}

.slider:hover {
    background-color: #b0b0b0;
}

input:checked + .slider:hover {
    background: linear-gradient(135deg, #0056CC 0%, #0040A3 100%);
}

/* تحسينات الاستجابة للجوال */
@media (max-width: 768px) {
    .permissions-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
        gap: 12px;
    }
    
    .permission-item {
        padding: 10px 12px;
    }
    
    .permission-item span {
        font-size: 0.85rem;
    }
    
    .switch {
        width: 48px;
        height: 26px;
    }
    
    .slider:before {
        height: 20px;
        width: 20px;
    }
    
    input:checked + .slider:before {
        transform: translateX(22px);
    }
}