/* استيراد الخطوط */
@import url('https://fonts.googleapis.com/css2?family=Tajawal:wght@300;400;500;700;900&display=swap');
@import url("https://fonts.googleapis.com/css2?family=Rubik:ital,wght@0,300..900;1,300..900&display=swap");

/* Hide body initially to prevent unstyled content flash */
body {
    opacity: 0;
    transition: opacity 0.2s ease;
}

body.theme-1,
body.theme-2 {
    opacity: 1;
}

.two-line-code {
    display: flex;
    flex-direction: column;
    justify-content: center;
    row-gap: 0;
    /* إزالة المسافة الرأسية تماماً */
    line-height: 0.9;

}

.bmc-btn-text {
    text-align: justify !important;
}

.two-line-code span {
    line-height: 0.7;
    /* يمكنك تجربة قيم أقل من 1 */
    margin-top: -0.3em;
    /* قيمة سلبية لتقريب السطور أكثر */
    margin-bottom: -0.3em;
}

/* Theme Switch Button Styles (Moved to be after search button in HTML) */
.theme-switch {
    /* position: fixed; */
    /* Removed */
    /* top: 20px; */
    /* Removed */
    /* left: 20px; */
    /* Removed */
    /* z-index: 100; */
    /* Removed */
    background: linear-gradient(135deg, #3A57E8, #08B1BA);
    color: white;
    border: none;
    /* border-radius: 50%; */
    /* Removed */
    border-radius: 20px;
    /* Added standard border radius */
    /* width: 50px; */
    /* Removed */
    /* height: 50px; */
    /* Removed */
    width: 100%;
    /* Make it full width like other buttons */
    padding: 15px;
    /* Match search button padding */
    margin-top: 15px;
    /* Add space above */
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
    font-family: 'Tajawal', sans-serif;
    /* Ensure font consistency */
    font-weight: 700;
    /* Match search button weight */
    font-size: 1.1rem;
    /* Match search button size */
    gap: 10px;
    /* Add gap for icon */
}

.theme-switch i {
    font-size: 1.5rem;
}

.theme-switch:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.3);
}

/* ===== THEME 1: Original Dark Gradient Theme ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    min-height: 100vh;
    display: flex;
    justify-content: center;
    padding: 20px;
    line-height: 1.6;
    transition: all 0.3s ease;
}

/* Theme 1 Variables */
.theme-1 {
    --primary-color: #3A57E8;
    --secondary-color: #08B1BA;
    --accent-color: #FFD166;
    --dark-bg: #111827;
    --card-bg: #1F2937;
    --light-text: #F9FAFB;
    --muted-text: #9CA3AF;
    --border-radius: 10px;
    --shadow-sm: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 10px 15px rgba(0, 0, 0, 0.2);
    --shadow-lg: 0 20px 25px rgba(0, 0, 0, 0.3);
    --transition: all 0.3s ease;
    --column-border: rgba(255, 255, 255, 0.08);

    /* Apply theme 1 specific styles to body */
    font-family: 'Tajawal', sans-serif;
    direction: rtl;
    text-align: right;
    background: linear-gradient(135deg, #111827 0%, #0F172A 100%);
    color: #F9FAFB;
}

.theme-1 .container {
    width: 100%;
    max-width: 800px;
    display: flex;
    align-items: center;
    flex-direction: column;
    padding: 20px 0;
}

.theme-1 .header {
    text-align: center;
    margin-bottom: 30px;
}

.theme-1 .header h1 {
    font-size: 1.7rem;
    font-weight: 900;
    margin-bottom: 10px;
    background: linear-gradient(to right, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    position: relative;
    display: inline-block;
}

.theme-1 .header h1::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 100px;
    height: 4px;
    background: linear-gradient(to right, var(--primary-color), var(--secondary-color));
    border-radius: 4px;
}

.theme-1 .header p {
    color: var(--muted-text);
    margin-top: 10px;
    font-size: 1.1rem;
}

.theme-1 .card {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    padding: 20px;
    box-shadow: var(--shadow-md);
    margin-bottom: 30px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(10px);
}

.theme-1 .search-container {
    position: relative;
    margin-bottom: 30px;
}

.theme-1 .search-container label {
    display: block;
    margin-bottom: 10px;
    font-weight: 500;
    font-size: 1.1rem;
}

.theme-1 .search-input {
    width: 100%;
    padding: 15px 20px;
    padding-right: 60px;
    font-size: 1.1rem;
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--border-radius);
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--light-text);
    transition: var(--transition);
    font-family: 'Tajawal', sans-serif;
}

.theme-1 .search-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(58, 87, 232, 0.2);
}

.theme-1 .search-input::placeholder {
    color: var(--muted-text);
}

.theme-1 .search-icon {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--primary-color);
    font-size: 1.2rem;
}

.theme-1 .search-button {
    width: 100%;
    padding: 15px;
    margin-top: 20px;
    border: none;
    border-radius: 20px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    font-weight: 700;
    font-size: 1.1rem;
    cursor: pointer;
    transition: var(--transition);
    font-family: 'Tajawal', sans-serif;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
}

.theme-1 .search-button:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

.theme-1 .search-button:active {
    transform: translateY(0);
}

.theme-1 .loader {
    display: none;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    margin: 30px 0;
}

.theme-1 .spinner {
    width: 50px;
    height: 50px;
    border: 5px solid rgba(58, 87, 232, 0.1);
    border-radius: 50%;
    border-top-color: var(--primary-color);
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.theme-1 .loader-text {
    margin-top: 15px;
    font-size: 1rem;
    color: var(--muted-text);
}

.results-container {
    overflow-x: auto;
    /* margin-bottom: 30px; */
    -webkit-overflow-scrolling: touch;
}

.theme-1 .results-container {
    background-color: #101729;
    border-radius: var(--border-radius);
    /* border-width: 20px; */
    /* margin-top: 40px; */
    /* margin-bottom: 30px; */
    scrollbar-width: thin;
    overflow: hidden;
}

@media (max-width: 600px) {
    .theme-1 .results-container {
        width: fit-content;
        scale: 1;
        scrollbar-width: thin;
        overflow: hidden;
    }
}

.theme-1 .results-container::-webkit-scrollbar {
    height: 6px;
}

.theme-1 .results-container::-webkit-scrollbar-track {
    background: var(--card-bg);
}

.theme-1 .results-container::-webkit-scrollbar-thumb {
    background-color: var(--primary-color);
}

.schedule-table {
    border-collapse: separate;
    direction: ltr;
    /* تغيير اتجاه الجدول ليكون من اليسار إلى اليمين */
    padding: 7px;
    /* margin-bottom: 20px; */
}

.theme-1 .schedule-table {
    width: 100%;
    border-spacing: 0;
    font-size: 0.7rem;
}

.theme-1 .schedule-table th,
.theme-1 .schedule-table td {
    padding: 6px 3px;
    border-radius: 20px;
    max-width: 120px;
    padding: 8px 5px;
    text-align: center;
    border-bottom: 1.5px solid rgba(255, 255, 255, 0.05);
    border-right: 1.5px solid var(--column-border);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 150px;
    /* تعديل العرض الأقصى للخلايا */
}

.theme-1 .schedule-table td:last-child,
.theme-1 .schedule-table th:last-child {
    border-right: none;
}

.theme-1 .schedule-table th {
    font-size: 0.75rem;
    padding: 6px 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 150px;
    background-color: rgba(58, 87, 232, 0.1);
    font-weight: 700;
    color: var(--primary-color);
    position: sticky;
    top: 0;
    z-index: 10;
}

.theme-1 .schedule-table tr:last-child td {
    border-bottom: none;
}

.theme-1 .schedule-table tr:nth-child(even) {
    background-color: rgba(255, 255, 255, 0.02);
}

.theme-1 .schedule-table tr:hover {
    background-color: rgba(58, 87, 232, 0.05);
}

.two-line {
    text-align: center;
}

.theme-1 .two-line {
    display: block;
    line-height: 1.2;
}

.theme-1 .two-line span:first-child {
    color: var(--light-text);
    display: block;
    margin-bottom: 1px;
}

.theme-1 .two-line span:last-child {
    color: var(--muted-text);
    display: block;
    margin-top: 1px;
}

.footer {
    text-align: center;
    /* margin-top: 20px; */
}

.theme-1 .footer {
    color: var(--muted-text);
}

.theme-1 .separator {
    display: flex;
    align-items: center;
    margin: 20px 0;
    color: var(--muted-text);
}

.theme-1 .separator::before,
.theme-1 .separator::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.theme-1 .separator::before {
    margin-left: 10px;
}

.theme-1 .separator::after {
    margin-right: 10px;
}

.theme-1 .buttons-container {
    display: flex;
    flex-direction: column;
    /* gap: 15px; */
    /* margin-top: 20px; */
}

.theme-1 .home-button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px 20px;
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--light-text);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--border-radius);
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition);
}

.theme-1 .home-button:hover {
    background-color: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
}

.theme-1 .support-button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px 20px;
    background-color: var(--accent-color);
    color: #000;
    border: none;
    border-radius: var(--border-radius);
    text-decoration: none;
    font-weight: 600;
    transition: var(--transition);
}

.theme-1 .support-button:hover {
    background-color: #FFE066;
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

.theme-1 .updates-button {
    background-color: #2196F3;
    /* Blue color */
    color: white;
}

.theme-1 .updates-button:hover {
    background-color: #1976D2;
    /* Darker blue on hover */
}

.theme-1 .support-button img {
    height: 24px;
}

.theme-1 .no-results {
    text-align: center;
    padding: 30px;
    color: var(--muted-text);
    font-size: 1.1rem;
}

.theme-1 .highlight-cell {
    color: var(--accent-color);
    font-weight: 500;
    max-width: 80px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* أزرار التنزيل والمشاركة */
.action-buttons {
    display: none;
    gap: 10px;
    margin-top: 30px;
    width: 100%;
}

.theme-1 .action-buttons {
    display: flex;
    flex-direction: column;
    width: fit-content;
    align-items: center;
    text-align: center;
}

.theme-1 .download-button,
.theme-1 .share-button {
    width: fit-content;
    text-align: center;
    width: max-content;
    align-self: anchor-center;
    padding: 15px;
    border: none;
    border-radius: var(--border-radius);
    color: white;
    font-weight: 700;
    font-size: 1.1rem;
    cursor: pointer;
    transition: var(--transition);
    font-family: 'Tajawal', sans-serif;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
}

.theme-1 .download-button {
    background: linear-gradient(135deg, #4CAF50, #45a049);
}

.theme-1 .share-button {
    background: linear-gradient(135deg, #2196F3, #1976D2);
}

.theme-1 .download-button:hover,
.theme-1 .share-button:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

.theme-2 .action-buttons {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 10px;
    /* margin-top: 20px; */
    align-items: anchor-center;
}

.theme-2 .download-button,
.theme-2 .share-button {
    color: var(--text-color);
    font-family: "Rubik", sans-serif;
    padding: 0.7rem;
    font-size: 1.2rem;
    border: none;
    border-radius: 10px;
    width: 180px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.theme-2 .download-button {
    background-color: #4CAF50;
}

.theme-2 .share-button {
    background-color: #2196F3;
}

.theme-2 .download-button:hover,
.theme-2 .share-button:hover {
    transform: scale(1.05);
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.2);
}

.theme-1 .course-code {
    color: var(--accent-color);
    font-weight: 600;
    /* تغيير الخط ليكون سميك جداً */
    max-width: 80px;
    font-size: 0.85rem;

    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    /* font-size: 1rem; */
    /* زيادة حجم الخط قليلاً لإبرازه أكثر */
}

/* ===== THEME 2: Rubik Black Theme ===== */
/* Theme 2 Variables */
.theme-2 {
    --primary-color: #007BFF;
    --accent-color: #FFD700;
    --background-color: #000000;
    --card-bg: #2a2a2a;
    --text-color: #ffffff;
    --muted-text: #cccccc;
    --border-radius: 16px;

    /* Apply theme 2 specific styles to body */
    font-family: "Rubik", sans-serif;
    direction: rtl;
    text-align: right;
    background-color: #000000;
    color: #ffffff;
}

.theme-2 .container {
    width: auto;
    margin: 2vh auto;
    background-color: var(--card-bg);
    border-radius: var(--border-radius);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.3);
    /* padding: 2vh; */
    box-sizing: border-box;
    padding-bottom: 12px;
    /* margin-bottom: 20px; */
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Removed empty .container rule */

.theme-2 h1 {
    color: var(--text-color);
    text-align: center;
    margin-bottom: 2vh;
    font-size: 2rem;
}

.theme-2 .search-container label {
    color: var(--text-color);
    display: block;
    margin-bottom: 10px;
    font-weight: 500;
    font-size: 1.1rem;
}

.theme-2 .search-input {
    width: 60%;
    font-family: "Rubik", sans-serif;
    max-width: 500px;
    margin-bottom: 15px;
    padding: 0.5rem;
    margin-top: 0.5rem;
    border: 1px solid #ccc;
    border-radius: 8px;
    font-size: 1rem;
    color: #333;
    background-color: #f9f9f9;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    outline: none;
    text-align: center;
}

.theme-2 .search-input:focus {
    box-shadow: 0 0 8px rgba(58, 150, 255, 0.5);
    border-color: var(--primary-color);
}

.theme-2 .search-button {
    color: var(--text-color);
    font-family: "Rubik", sans-serif;
    padding: 0.7rem;
    font-size: 1.3rem;
    margin: 0.75rem auto;
    border: none;
    border-radius: 10px;
    width: 250px;
    white-space: nowrap;
    overflow: hidden;
    max-width: 100%;
    cursor: pointer;
    text-decoration: none;
    display: block;
    text-align: center;
    justify-content: center;
    align-items: center;
    transition: background-color 0.3s ease, box-shadow 0.3s ease, transform 0.2s ease;
    background-color: var(--primary-color);
}

.theme-2 .search-button:hover {
    background-color: #0056b3;
    transform: scale(1.05);
}

.theme-2 .support-button {
    background-color: var(--accent-color);
    color: #000;
    width: auto;
    max-width: 80%;
    font-family: "Rubik", sans-serif;
    font-weight: 700;
    font-size: 1.2rem;
    box-shadow: 0 0 8px rgba(255, 215, 0, 0.7), 0 0 12px rgba(255, 215, 0, 0.5);
    border-radius: 8px;
    transition: box-shadow 0.3s ease, transform 0.2s ease;
    cursor: pointer;
    display: block;
    margin: 0 auto;
    text-align: center;
    white-space: nowrap;
    padding: 0.7rem 1.5rem;
    text-decoration: none;
}

.theme-2 .support-button:hover {
    background-color: #f0c020;
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.8), 0 0 20px rgba(255, 215, 0, 0.6);
    transform: scale(1.05);
}

.theme-2 .home-button {
    background-color: #0454ad;
    font-size: 15px;
    font-weight: 700;
    color: var(--text-color);
    width: 80%;
    padding: 0.7rem 1.5rem;
    border-radius: 8px;
    text-decoration: none;
    display: block;
    margin: 10px auto;
    text-align: center;
    transition: background-color 0.3s ease, transform 0.2s ease;
    font-family: "Rubik", sans-serif;
}

.theme-2 .home-button:hover {
    background-color: #444;
    transform: scale(1.05);
}

.theme-2 .schedule-table {
    width: auto;
    direction: ltr;
    margin: 20px auto;
    border-collapse: separate;
    border-spacing: 3px;
}

.theme-2 .schedule-table th,
.theme-2 .schedule-table td {
    text-align: center;
    font-size: 0.6rem;
    padding: 0.6vh;
    border-radius: 15px;
    background-color: #000;
    direction: ltr;
    color: #fff;
    white-space: nowrap;
    word-wrap: break-word;
}

.theme-2 .schedule-table th {
    background-color: #4CAF50;
    color: #fff;
    font-weight: bold;
}

.theme-2 .two-line {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    line-height: 1.5;
}

.theme-2 .loader {
    display: none;
    flex-direction: column;
    align-items: center;
    margin: 20px 0;
}

.theme-2 .spinner {
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top: 4px solid #007BFF;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin-bottom: 10px;
}

.theme-2 .loader-text {
    color: var(--text-color);
    font-size: 1rem;
}

.theme-2 .footer {
    text-align: center;
    margin-top: 20px;
    color: var(--muted-text);
}

.theme-2 .separator {
    display: flex;
    align-items: center;
    margin: 20px 0;
    color: var(--muted-text);
}

.theme-2 .separator::before,
.theme-2 .separator::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.theme-2 .separator::before {
    margin-left: 10px;
}

.theme-2 .separator::after {
    margin-right: 10px;
}

/* Collapsible Info Sections */
details.info-section {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 10px;
    margin: 20px 0;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
    text-align: right;
    direction: rtl;
    width: 100%;
}

details.info-section[open] {
    background: rgba(255, 255, 255, 0.08);
    padding-bottom: 20px;
}

summary {
    cursor: pointer;
    font-weight: bold;
    padding: 10px;
    list-style: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--primary-color);
}

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

summary::after {
    content: '+';
    font-size: 1.5em;
    font-weight: bold;
    transition: transform 0.3s ease;
}

details[open] summary::after {
    transform: rotate(45deg);
}

details.info-section p,
details.info-section ul {
    margin-top: 15px;
    padding: 0 10px;
    animation: fadeIn 0.5s ease;
    color: var(--light-text);
}

details.info-section ul {
    margin-right: 20px;
}

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

    to {
        opacity: 1;
        transform: translateY(0);
    }
}



.theme-2 .results-container {
    overflow-x: auto;
    /* margin-bottom: 30px; */
    background-color: var(--card-bg);
    /* box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2); */
}

.theme-2 .no-results {
    text-align: center;
    padding: 30px;
    color: var(--muted-text);
    font-size: 1.1rem;
}

.theme-2 .highlight-cell {
    color: var(--accent-color);
    font-weight: 500;
}

.theme-2 .course-code {
    color: var(--accent-color);
    font-weight: 700;
    font-size: 0.78rem;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.5s ease forwards;
}

.card,
.header,
.footer {
    animation: fadeIn 0.5s ease forwards;
}

.card {
    animation-delay: 0.1s;
}

.footer {
    animation-delay: 0.2s;
}

/* إزالة إعدادات العتامة الأولية */
body {
    opacity: 1 !important;
    transition: all 0.3s ease;
}

/* تحسين انتقالات الثيمات */
body.theme-1,
body.theme-2 {
    opacity: 1;
    transition: opacity 0.5s ease-in-out;
}
