/* Base Reset and Variables */
:root {
    /* Dark theme (default) */
    --bg-primary: #1a1a1a;
    --bg-secondary: #2d2d2d;
    --text-primary: #ffffff;
    --text-secondary: #b3b3b3;
    --accent-primary: #3498db;
    --accent-secondary: #e74c3c;
    --hover-primary: #2980b9;
    --hover-secondary: #c0392b;
    --border-color: #404040;
    --success-color: #27ae60;
    --error-color: #e74c3c;
    --warning-color: #f1c40f;
    --shadow-color: rgba(0, 0, 0, 0.2);
    --transition-speed: 0.3s;
}

/* Light theme */
[data-theme="light"] {
    --bg-primary: #ffffff;
    --bg-secondary: #f5f5f5;
    --text-primary: #333333;
    --text-secondary: #666666;
    --border-color: #dddddd;
    --shadow-color: rgba(0, 0, 0, 0.1);
}

/* High Contrast theme */
[data-theme="high-contrast"] {
    --bg-primary: #000000;
    --bg-secondary: #ffffff;
    --text-primary: #ffffff;
    --text-secondary: #ffffff;
    --accent-primary: #ffff00;
    --accent-secondary: #00ffff;
    --border-color: #ffffff;
}

/* Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    transition: background-color var(--transition-speed), color var(--transition-speed);
    direction: rtl;
    min-height: 100vh;
    position: relative;
}

/* Skip Link */
.skip-link {
    position: absolute;
    top: -40px;
    right: 0;
    background: var(--accent-primary);
    color: white;
    padding: 8px 16px;
    z-index: 100;
    transition: top 0.3s;
}

.skip-link:focus {
    top: 0;
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Header Styles */
header {
    background-color: var(--bg-secondary);
    padding: 30px;
    border-radius: 8px;
    margin-bottom: 30px;
    box-shadow: 0 2px 4px var(--shadow-color);
}

.header-content {
    text-align: center;
    margin-bottom: 20px;
}

.header-content h1 {
    font-size: 2em;
    margin-bottom: 10px;
    color: var(--text-primary);
}

.header-content h2 {
    font-size: 1.5em;
    color: var(--text-secondary);
    margin-bottom: 10px;
}

.teacher-name {
    color: var(--text-secondary);
    font-size: 1.2em;
}

/* Theme Switcher */
.theme-switcher {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 15px;
}

.theme-toggle, .contrast-toggle {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    transition: all var(--transition-speed);
}

.theme-toggle:hover, .contrast-toggle:hover {
    background: var(--bg-secondary);
}

/* Breadcrumb */
.breadcrumb {
    margin-bottom: 20px;
}

.breadcrumb ol {
    list-style: none;
    display: flex;
    gap: 10px;
}

.breadcrumb li:not(:last-child)::after {
    content: "/";
    margin-right: 10px;
    color: var(--text-secondary);
}

/* Tabs */
.years-tabs {
    background-color: var(--bg-secondary);
    border-radius: 8px;
    box-shadow: 0 2px 4px var(--shadow-color);
    margin-bottom: 30px;
}

.tab-buttons {
    display: flex;
    background-color: var(--bg-primary);
    border-bottom: 2px solid var(--border-color);
    padding: 0 20px;
    flex-wrap: wrap;
    gap: 5px;
}

.tab-btn {
    padding: 15px 30px;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 16px;
    color: var(--text-secondary);
    border-bottom: 3px solid transparent;
    transition: all var(--transition-speed);
}

.tab-btn:hover, .tab-btn:focus {
    color: var(--text-primary);
    outline: none;
}

.tab-btn:focus-visible {
    outline: 3px solid var(--accent-primary);
    outline-offset: -3px;
}

.tab-btn.active {
    color: var(--text-primary);
    border-bottom-color: var(--accent-primary);
}

.tab-content {
    padding: 20px;
    animation: fadeIn var(--transition-speed) ease-in-out;
}

/* Semester Styles */
.semester {
    margin-bottom: 20px;
    padding: 20px;
    background-color: var(--bg-primary);
    border-radius: 6px;
    transition: transform var(--transition-speed);
    border: 1px solid var(--border-color);
}

.semester:hover {
    transform: translateX(-10px);
}

.semester-title {
    color: var(--text-primary);
    margin-bottom: 15px;
    font-size: 1.2em;
}

/* Exam Links */
.exam-links {
    display: flex;
    gap: 15px;
}

.exam-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 25px;
    background-color: var(--accent-primary);
    color: white;
    text-decoration: none;
    border-radius: 4px;
    transition: all var(--transition-speed);
    min-width: 120px;
}

.exam-link:hover {
    background-color: var(--hover-primary);
    transform: scale(1.05);
}

.exam-link.pre {
    background-color: var(--accent-secondary);
}

.exam-link.pre:hover {
    background-color: var(--hover-secondary);
}

/* Search Section */
.search-section {
    margin-bottom: 30px;
}

.search-form {
    display: flex;
    gap: 10px;
}

.search-form input {
    flex: 1;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.search-form button {
    padding: 10px 20px;
    background: var(--accent-primary);
    border: none;
    border-radius: 4px;
    color: white;
    cursor: pointer;
    transition: background-color var(--transition-speed);
}

.search-form button:hover {
    background: var(--hover-primary);
}

/* Notification container - positioned at top middle */
#notificationArea {
    position: fixed;
    top: 15px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    width: 90%;
    max-width: 500px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Base notification styles */
/* Notification container - positioned at top middle */
#notificationArea {
    position: fixed;
    top: 15px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    width: 90%;
    max-width: 500px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Base notification styles */
.notification {
    width: 100%;
    padding: 12px 16px;
    border-radius: 4px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    opacity: 0;
    transform: translateY(-20px);
    transition: opacity 0.3s, transform 0.3s;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
}

.notification-visible {
    opacity: 1;
    transform: translateY(0);
}

.notification-hiding {
    opacity: 0;
    transform: translateY(-20px);
}

.notification-icon {
    margin-left: 10px;
    margin-right: 10px;
    font-size: 18px;
}

/* MORE INTENSE Color variations for different types */
.notification.info {
    background-color: #2196f3;
    color: #ffffff;
    border-left: 4px solid #0d47a1;
}

.notification.success {
    background-color: #4caf50;
    color: #ffffff;
    border-left: 4px solid #1b5e20;
}

.notification.warning {
    background-color: #ff9800;
    color: #ffffff;
    border-left: 4px solid #e65100;
}

.notification.error {
    background-color: #f44336;
    color: #ffffff;
    border-left: 4px solid #b71c1c;
}

/* Dark theme variations - slightly adjusted for more contrast */
[data-theme="dark"] .notification.info {
    background-color: #1976d2;
    color: #ffffff;
    border-left-color: #0d47a1;
}

[data-theme="dark"] .notification.success {
    background-color: #388e3c;
    color: #ffffff;
    border-left-color: #1b5e20;
}

[data-theme="dark"] .notification.warning {
    background-color: #f57c00;
    color: #ffffff;
    border-left-color: #e65100;
}

[data-theme="dark"] .notification.error {
    background-color: #d32f2f;
    color: #ffffff;
    border-left-color: #b71c1c;
}

/* Dark theme variations */
[data-theme="dark"] .notification-info {
    background-color: #1a2740;
    color: #e3f2fd;
    border-left-color: #2196f3;
}

[data-theme="dark"] .notification-success {
    background-color: #1b3522;
    color: #e8f5e9;
    border-left-color: #4caf50;
}

[data-theme="dark"] .notification-warning {
    background-color: #3d2e08;
    color: #ffe082;
    border-left-color: #ffc107;
}

[data-theme="dark"] .notification-error {
    background-color: #3b1a1a;
    color: #ffcdd2;
    border-left-color: #f44336;
}

/* Download Progress */
.download-progress {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: var(--bg-secondary);
    padding: 15px;
    border-radius: 4px;
    box-shadow: 0 2px 10px var(--shadow-color);
    z-index: 1000;
}

.progress-bar {
    height: 4px;
    background: var(--accent-primary);
    width: 0;
    transition: width var(--transition-speed);
}

/* Back to Top Button */
.back-to-top {
    position: fixed;
    bottom: 20px;
    left: 20px;
    background: var(--accent-primary);
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    opacity: 0;
    transition: opacity var(--transition-speed), background-color var(--transition-speed);
    z-index: 99;
}

.back-to-top.visible {
    opacity: 1;
}

.back-to-top:hover {
    background: var(--hover-primary);
}

/* Footer */
footer {
    text-align: center;
    padding: 20px;
    margin-top: 30px;
    background-color: var(--bg-secondary);
    border-radius: 8px;
}

footer a {
    color: var(--accent-primary);
    text-decoration: none;
    transition: color var(--transition-speed);
}

footer a:hover {
    color: var(--hover-primary);
}

.footer-nav ul {
    list-style: none;
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 15px;
}

/* Loading State */
.loading {
    text-align: center;
    padding: 20px;
    color: var(--text-secondary);
}

.loading::after {
    content: "...";
    animation: dots 1.5s steps(4, end) infinite;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes dots {
    0%, 20% { content: "."; }
    40% { content: ".."; }
    60% { content: "..."; }
    80%, 100% { content: ""; }
}

/* Print Styles */
@media print {
    .tab-buttons,
    .exam-links,
    .theme-switcher,
    .back-to-top,
    .search-section {
        display: none;
    }

    body {
        background: white;
        color: black;
    }

    .semester {
        break-inside: avoid;
        page-break-inside: avoid;
        border: 1px solid #ccc;
    }

    a {
        color: black;
        text-decoration: none;
    }

    .container {
        max-width: none;
        padding: 0;
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }

    header {
        padding: 20px;
    }

    .header-content h1 {
        font-size: 1.5em;
    }

    .header-content h2 {
        font-size: 1.2em;
    }

    .tab-buttons {
        flex-direction: column;
        padding: 10px;
    }

    .tab-btn {
        width: 100%;
        text-align: center;
        padding: 10px;
    }

    .exam-links {
        flex-direction: column;
    }
    
    .exam-link {
        text-align: center;
        width: 100%;
    }

    .semester:hover {
        transform: none;
    }

    .search-form {
        flex-direction: column;
    }

    .footer-nav ul {
        flex-direction: column;
        gap: 10px;
    }
}

@media (max-width: 480px) {
    .header-content h1 {
        font-size: 1.2em;
    }

    .container {
        padding: 5px;
    }

    .notification {
        right: 10px;
        left: 10px;
        width: auto;
    }
}

/* Accessibility Improvements */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}