/* =============================================
   ملف الأنماط الموحد لمساق أمن الشبكات
   دبلوم أمن المعلومات - الكلية الجامعية للعلوم التطبيقية
   © 2026 سايبر خليل - جميع الحقوق محفوظة.
============================================= */

/* الخطوط */
@import url('https://fonts.googleapis.com/css2?family=Tajawal:wght@300;400;500;700;800&display=swap');

/* CSS Variables للتجاوب */
:root {
    --primary-color: #0d6efd;
    --secondary-color: #198754;
    --accent-color: #6f42c1;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --light-bg: #f5f7fa;
    --text-dark: #333;
    --text-muted: #6c757d;
    --border-radius: 12px;
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.05);
    --shadow-md: 0 8px 30px rgba(0,0,0,0.08);
    --shadow-lg: 0 4px 12px rgba(0,0,0,0.1);
    --transition: all 0.3s ease;
}

/* التصميم العام */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Tajawal', 'Segoe UI', sans-serif;
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    background: linear-gradient(135deg, #f5f7fa 0%, #e4edf5 100%);
    color: var(--text-dark);
    line-height: 1.8;
    min-height: 100vh;
    padding-bottom: 2rem;
    overflow-x: hidden;
}

/* الهيدر - تحسين تباين الألوان */
header {
    background: linear-gradient(90deg, #0d6efd 0%, #0a58ca 100%);
    color: white;
    text-align: center;
    padding: 2.5rem 1rem;
    box-shadow: 0 4px 12px rgba(13, 110, 253, 0.2);
    position: relative;
    overflow: hidden;
}

header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100" preserveAspectRatio="none"><path d="M0,0 L100,0 L100,100 Z" fill="rgba(255,255,255,0.05)"/></svg>');
    background-size: cover;
}

.header-content {
    position: relative;
    z-index: 1;
    max-width: 1200px;
    margin: 0 auto;
}

h1 {
    font-size: clamp(1.5rem, 5vw, 2.5rem);
    margin-bottom: 0.8rem;
    font-weight: 800;
    font-family: 'Tajawal', sans-serif;
    color: white;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    line-height: 1.3;
}

.header-content p {
    color: rgba(255, 255, 255, 0.95);
    font-size: clamp(0.9rem, 3vw, 1.1rem);
    margin-bottom: 1rem;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.course-info {
    background: rgba(255, 255, 255, 0.25);
    padding: 1rem 1.5rem;
    border-radius: 10px;
    display: inline-block;
    margin-top: 1rem;
    font-size: clamp(0.8rem, 2.5vw, 1rem);
    color: white;
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    word-wrap: break-word;
    max-width: 100%;
}

.course-info strong {
    color: #ffeb3b;
    font-weight: 700;
}

/* المحتوى الرئيسي */
.container {
    max-width: 95%;
    margin: 2rem auto;
    padding: 0 1rem;
}

main {
    padding: 2rem 1rem;
    max-width: 1000px;
    margin: auto;
    width: 100%;
}

.main-card {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-md);
    margin-bottom: 2rem;
    overflow: hidden;
    border: 1px solid #eaeaea;
}

/* بطاقة العنوان الرئيسي - تحسين التباين */
.card-header {
    background: linear-gradient(90deg, #198754 0%, #157347 100%);
    color: white;
    padding: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.card-header h2 {
    font-size: clamp(1.2rem, 4vw, 1.8rem);
    margin: 0;
    font-weight: 700;
    font-family: 'Tajawal', sans-serif;
    color: white;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    flex: 1;
    min-width: 200px;
}

.week-badge {
    background: rgba(255, 255, 255, 0.25);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-weight: 600;
    font-size: clamp(0.8rem, 2.5vw, 0.9rem);
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    white-space: nowrap;
}

.card-body {
    padding: clamp(1rem, 3vw, 2rem);
}

/* العناوين */
h2 {
    color: var(--primary-color);
    margin-bottom: 1rem;
    border-bottom: 2px solid var(--primary-color);
    display: inline-block;
    font-family: 'Tajawal', sans-serif;
    padding-bottom: 0.3rem;
    font-size: clamp(1.3rem, 4vw, 1.8rem);
}

h3 {
    color: var(--primary-color);
    margin: 1.5rem 0 1rem 0;
    font-size: clamp(1.1rem, 3.5vw, 1.5rem);
    border-bottom: 2px solid #eaeaea;
    padding-bottom: 0.5rem;
    font-family: 'Tajawal', sans-serif;
}

h4 {
    color: var(--secondary-color);
    margin: 1.2rem 0 0.8rem 0;
    font-size: clamp(1rem, 3vw, 1.2rem);
    font-family: 'Tajawal', sans-serif;
    font-weight: 600;
}

h5, h6 {
    font-family: 'Tajawal', sans-serif;
    font-weight: 600;
    font-size: clamp(0.95rem, 2.8vw, 1.1rem);
}

/* قوائم */
ul, ol {
    margin-right: 1.5rem;
    margin-bottom: 1.2rem;
    padding-left: 1rem;
}

li {
    margin-bottom: 0.5rem;
    padding-right: 0.5rem;
    line-height: 1.7;
}

/* أقسام خاصة */
.learning-outcomes {
    background: #e8f4ff;
    border-right: 4px solid var(--primary-color);
    padding: clamp(1rem, 3vw, 1.2rem);
    border-radius: 8px;
    margin: 1.5rem 0;
}

.learning-outcomes h3 {
    color: #0a58ca;
    border-bottom: none;
    margin-top: 0;
    font-size: clamp(1rem, 3vw, 1.3rem);
}

.important-note {
    background: #fff3cd;
    border: 1px solid #ffecb5;
    border-right: 4px solid var(--warning-color);
    padding: clamp(1rem, 3vw, 1.2rem);
    border-radius: 8px;
    margin: 1.5rem 0;
}

.important-note h4 {
    color: #856404;
    margin-top: 0;
    font-size: clamp(0.95rem, 3vw, 1.1rem);
}

.practical-section {
    background: #d1e7dd;
    border: 1px solid #badbcc;
    border-right: 4px solid var(--secondary-color);
    padding: clamp(1rem, 3vw, 1.2rem);
    border-radius: 8px;
    margin: 1.5rem 0;
}

.practical-section h3 {
    color: #0f5132;
    border-bottom: none;
    margin-top: 0;
}

/* خطة الجلسة */
.session-plan {
    background: #f8f9fa;
    border-radius: 8px;
    padding: clamp(1rem, 3vw, 1.5rem);
    margin: 1.5rem 0;
}

.session-plan h3 {
    margin-top: 0;
    color: #0a58ca;
}

.session-item {
    display: flex;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #dee2e6;
    flex-wrap: nowrap;
    gap: 0.75rem;
}

.session-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.session-icon {
    color: var(--primary-color);
    font-size: clamp(1rem, 3vw, 1.2rem);
    margin-top: 0.2rem;
    flex-shrink: 0;
    min-width: 24px;
    text-align: center;
}

.session-content {
    flex: 1;
    min-width: 0;
}

.session-content h4 {
    margin-top: 0;
    color: #495057;
    font-weight: 600;
    font-size: clamp(0.95rem, 3vw, 1.1rem);
}

.session-content p {
    color: var(--text-muted);
    margin-bottom: 0;
    font-size: clamp(0.85rem, 2.8vw, 1rem);
    line-height: 1.6;
}

/* حل النشاط */
.solution-section {
    background: #e7f1ff;
    border: 1px solid #cfe2ff;
    border-right: 4px solid var(--primary-color);
    padding: clamp(1rem, 3vw, 1.5rem);
    border-radius: 8px;
    margin: 1.5rem 0;
}

.solution-section h3 {
    color: #0a58ca;
    border-bottom: none;
    margin-top: 0;
}

.solution-item {
    margin-bottom: 1.2rem;
}

.solution-item:last-child {
    margin-bottom: 0;
}

.solution-item h4 {
    color: var(--primary-color);
    font-size: clamp(0.95rem, 3vw, 1.1rem);
}

/* تأثيرات نصية */
.highlight {
    background: linear-gradient(120deg, #a5d8ff 0%, transparent 100%);
    padding: 0.2rem 0.5rem;
    border-radius: 3px;
    font-weight: 600;
}

.key-term {
    color: var(--primary-color);
    font-weight: 700;
}

.correct-answer {
    color: var(--secondary-color);
    font-weight: 700;
}

/* الأنشطة */
.activity-item {
    display: flex;
    align-items: flex-start;
    margin-bottom: 1rem;
    gap: 0.75rem;
}

.activity-icon {
    color: var(--secondary-color);
    margin-left: 0;
    font-size: clamp(1rem, 3vw, 1.2rem);
    margin-top: 0.2rem;
    flex-shrink: 0;
    min-width: 24px;
    text-align: center;
}

/* الجداول - تحسين التمرير الأفقي */
.comparison-table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
    font-size: clamp(0.8rem, 2.5vw, 0.95rem);
    display: block;
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
}

.comparison-table th,
.comparison-table td {
    border: 1px solid #dee2e6;
    padding: clamp(0.5rem, 2vw, 0.75rem);
    text-align: right;
    min-width: 100px;
}

.comparison-table th {
    background-color: #f8f9fa;
    font-weight: 700;
    color: #495057;
    position: sticky;
    top: 0;
}

.comparison-table tr:nth-child(even) {
    background-color: #f8f9fa;
}

/* أقسام الهجمات */
.attack-section {
    background: #f8d7da;
    border: 1px solid #f5c2c7;
    border-right: 4px solid var(--danger-color);
    padding: clamp(1rem, 3vw, 1.2rem);
    border-radius: 8px;
    margin: 1.5rem 0;
}

.attack-section h3 {
    color: #842029;
    border-bottom: none;
    margin-top: 0;
}

.attack-demo {
    background: #fff3cd;
    border: 1px dashed var(--warning-color);
    padding: clamp(0.75rem, 2.5vw, 1rem);
    border-radius: 6px;
    margin: 1rem 0;
    direction: ltr;
    font-family: 'Courier New', monospace;
    font-size: clamp(0.75rem, 2.5vw, 0.9rem);
    overflow-x: auto;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.mitigation-steps {
    background: #d1e7dd;
    border: 1px solid #badbcc;
    padding: clamp(0.75rem, 2.5vw, 1rem);
    border-radius: 6px;
    margin: 1rem 0;
}

.ethical-warning {
    background: #cfe2ff;
    border: 2px solid var(--primary-color);
    padding: clamp(0.75rem, 2.5vw, 1rem);
    border-radius: 6px;
    margin: 1rem 0;
    text-align: center;
    font-weight: bold;
}

/* الواجبات */
.homework-section {
    background: #f0f9ff;
    border: 1px solid #cfe2ff;
    border-right: 4px solid var(--primary-color);
    padding: clamp(1rem, 3vw, 1.5rem);
    border-radius: 8px;
    margin: 1.5rem 0;
}

.homework-section h3 {
    color: #0a58ca;
    border-bottom: none;
    margin-top: 0;
}

.submission-requirements {
    background: #fff3cd;
    padding: clamp(0.75rem, 2.5vw, 1rem);
    border-radius: 6px;
    margin: 1rem 0;
    border: 1px dashed var(--warning-color);
}

.homework-instructions {
    background: #e8f4ff;
    padding: clamp(1rem, 3vw, 1.2rem);
    border-radius: 8px;
    margin: 1.2rem 0;
}

.homework-instructions h4 {
    color: #0a58ca;
}

/* التقييم */
.assess-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.assess-card {
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    text-align: center;
    padding: clamp(1rem, 3vw, 1.5rem) 1rem;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

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

.assess-card i {
    font-size: clamp(1.5rem, 4vw, 2rem);
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.assess-card h3 {
    margin: 0.5rem 0;
    font-size: clamp(1.2rem, 3.5vw, 1.5rem);
    color: var(--primary-color);
    border-bottom: none;
}

.assess-card p {
    font-size: clamp(0.85rem, 2.8vw, 1rem);
    margin: 0.5rem 0;
}

.assess-card small {
    font-size: clamp(0.75rem, 2.5vw, 0.85rem);
    color: var(--text-muted);
}

.week-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    color: #666;
    font-size: clamp(0.8rem, 2.5vw, 0.9rem);
    flex-wrap: wrap;
    gap: 0.5rem;
}

.week-topic {
    color: var(--primary-color);
    font-weight: bold;
    margin: 0.5rem 0;
    font-size: clamp(0.95rem, 3vw, 1.1rem);
}

/* معلومات المساق */
.course-info-block {
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    padding: clamp(1rem, 3vw, 1.5rem);
    margin-bottom: 2rem;
    box-shadow: var(--shadow-sm);
}

.course-info-block h3 {
    color: var(--primary-color);
    margin-bottom: 1rem;
    font-size: clamp(1.1rem, 3.5vw, 1.3rem);
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.info-item {
    margin-bottom: 0.8rem;
    font-size: clamp(0.85rem, 2.8vw, 1rem);
}

/* روابط وأزرار */
.btn {
    display: inline-block;
    background: var(--primary-color);
    color: white;
    padding: clamp(0.6rem, 2.5vw, 0.8rem) clamp(1rem, 3vw, 1.5rem);
    border-radius: 6px;
    text-decoration: none;
    font-weight: 600;
    margin-top: 0.5rem;
    transition: var(--transition);
    border: none;
    cursor: pointer;
    font-family: 'Tajawal', sans-serif;
    box-shadow: 0 2px 4px rgba(13, 110, 253, 0.3);
    font-size: clamp(0.85rem, 2.8vw, 1rem);
    text-align: center;
    touch-action: manipulation;
}

.btn:hover {
    background: #0a58ca;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(13, 110, 253, 0.4);
}

.btn:active {
    transform: translateY(0);
}

.btn-secondary {
    background: #6c757d;
    box-shadow: 0 2px 4px rgba(108, 117, 125, 0.3);
}

.btn-secondary:hover {
    background: #5a6268;
    box-shadow: 0 4px 8px rgba(108, 117, 125, 0.4);
}

.nav-buttons {
    display: flex;
    justify-content: space-between;
    margin-top: 2rem;
    gap: 1rem;
    flex-wrap: wrap;
}

.nav-buttons .btn {
    flex: 1;
    min-width: 140px;
}

/* الفوتر */
footer {
    text-align: center;
    margin-top: 3rem;
    padding: 1.5rem 1rem;
    color: white;
    font-size: clamp(0.8rem, 2.5vw, 0.9rem);
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    background: linear-gradient(90deg, #0d6efd 0%, #0a58ca 100%);
    font-family: 'Tajawal', sans-serif;
}

footer p {
    color: rgba(255, 255, 255, 0.95);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    margin: 0;
    line-height: 1.6;
}

/* حقوق النشر */
.copyright {
    text-align: center;
    margin-top: 1rem;
    padding-top: 1rem;
    color: rgba(255, 255, 255, 0.85);
    font-size: clamp(0.75rem, 2.5vw, 0.85rem);
    direction: ltr;
    font-family: 'Tajawal', sans-serif;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
}

/* تفاصيل للصفحة الرئيسية - تحسين للعرض الموسع */
details {
    border: 1px solid #dee2e6;
    border-radius: 6px;
    margin-bottom: 0.75rem;
    background: #fff;
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

details[open] {
    box-shadow: var(--shadow-md);
}

summary {
    padding: clamp(0.75rem, 2.5vw, 1rem);
    font-weight: 700;
    cursor: pointer;
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-family: 'Tajawal', sans-serif;
    font-size: clamp(0.9rem, 3vw, 1.1rem);
    background: #f8f9fa;
    transition: var(--transition);
}

summary:hover {
    background: #e9ecef;
}

summary::-webkit-details-marker {
    display: none;
}

summary i {
    color: var(--primary-color);
    transition: var(--transition);
    font-size: clamp(0.8rem, 2.5vw, 1rem);
}

details[open] summary i {
    transform: rotate(180deg);
}

.week-content {
    padding: clamp(0.75rem, 2.5vw, 1rem);
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* تحسين عرض الصور */
img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 1rem 0;
    display: block;
}

/* أنماط إضافية للنصوص */
strong {
    color: #0a58ca;
    font-weight: 700;
}

em {
    color: var(--secondary-color);
    font-style: italic;
}

blockquote {
    border-right: 4px solid var(--primary-color);
    padding-right: 1rem;
    margin: 1rem 0;
    font-style: italic;
    color: #666;
    background: #f8f9fa;
    padding: 1rem;
    border-radius: 4px;
    font-size: clamp(0.9rem, 2.8vw, 1rem);
}

/* تأثيرات تفاعلية إضافية */
.btn i {
    margin-left: 0.5rem;
}

/* ===============================
   تحسينات متقدمة للهواتف المحمولة
   =============================== */

/* شاشات صغيرة جداً (هواتف صغيرة) */
@media (max-width: 360px) {
    html {
        font-size: 14px;
    }

    .container {
        padding: 0 0.5rem;
    }

    .card-body {
        padding: 0.75rem;
    }

    .session-item {
        flex-direction: column;
        gap: 0.5rem;
    }

    .session-icon {
        margin-top: 0;
    }
}

/* شاشات صغيرة (هواتف) */
@media (max-width: 576px) {
    header {
        padding: 1.5rem 0.75rem;
    }

    .course-info {
        padding: 0.75rem;
        font-size: 0.75rem;
    }

    .card-header {
        flex-direction: column;
        text-align: center;
        gap: 0.75rem;
    }

    .week-badge {
        align-self: center;
    }

    .nav-buttons {
        flex-direction: column;
    }

    .nav-buttons .btn {
        width: 100%;
        margin: 0.25rem 0;
    }

    .activity-item {
        flex-direction: column;
        gap: 0.5rem;
    }

    .activity-icon {
        margin-top: 0;
    }

    ul, ol {
        margin-right: 1rem;
        padding-left: 0.5rem;
    }
}

/* شاشات متوسطة (هواتف كبيرة، تابلت صغير) */
@media (max-width: 768px) {
    .container {
        max-width: 100%;
        padding: 0 0.75rem;
    }

    main {
        padding: 1rem 0.5rem;
    }

    .assess-grid {
        grid-template-columns: 1fr;
    }

    .info-grid {
        grid-template-columns: 1fr;
    }

    .comparison-table {
        font-size: 0.75rem;
    }

    .comparison-table th,
    .comparison-table td {
        padding: 0.4rem;
        min-width: 80px;
    }
}

/* شاشات كبيرة (تابلت، لابتوب صغير) */
@media (min-width: 769px) and (max-width: 992px) {
    .container {
        max-width: 95%;
    }

    .assess-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* شاشات كبيرة جداً (لابتوب، ديسكتوب) */
@media (min-width: 1200px) {
    .container {
        max-width: 1100px;
    }

    main {
        max-width: 1100px;
    }
}

/* تحسينات للطباعة */
@media print {
    .nav-buttons,
    .btn,
    footer .copyright {
        display: none !important;
    }

    body {
        background: white !important;
        color: black !important;
        font-size: 12pt;
    }

    .main-card {
        box-shadow: none !important;
        border: 1px solid #ddd !important;
        page-break-inside: avoid;
    }

    header {
        background: white !important;
        color: black !important;
        box-shadow: none !important;
    }

    .card-header {
        background: #f8f9fa !important;
        color: black !important;
    }

    .week-content {
        display: block !important;
    }
}

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

    html {
        scroll-behavior: auto;
    }
}

/* تأثيرات إضافية */
.highlight-box {
    background: linear-gradient(120deg, #e3f2fd 0%, #bbdefb 100%);
    padding: 1rem;
    border-radius: 8px;
    margin: 1rem 0;
    border-right: 4px solid #2196f3;
}

.code-block {
    background: #2d2d2d;
    color: #f8f8f2;
    padding: clamp(0.75rem, 2.5vw, 1rem);
    border-radius: 6px;
    margin: 1rem 0;
    font-family: 'Courier New', monospace;
    direction: ltr;
    overflow-x: auto;
    font-size: clamp(0.75rem, 2.5vw, 0.9rem);
    white-space: pre-wrap;
    word-wrap: break-word;
}

.success-box {
    background: #d4edda;
    border: 1px solid #c3e6cb;
    border-right: 4px solid #28a745;
    padding: 1rem;
    border-radius: 6px;
    margin: 1rem 0;
}

.warning-box {
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    border-right: 4px solid var(--warning-color);
    padding: 1rem;
    border-radius: 6px;
    margin: 1rem 0;
}

.error-box {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    border-right: 4px solid var(--danger-color);
    padding: 1rem;
    border-radius: 6px;
    margin: 1rem 0;
}

/* تحسين التمرير */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}