/* Minimal Custom CSS - Only essential styles that Bootstrap doesn't provide */

/* Arabic Font */
* {
    font-family: "Zain", sans-serif !important;
}

/* Custom CSS Variables */
:root {
    --primary: #06BBCC;
    --light: #F0FBFC;
    --dark: #181d38;
    --white: #FFFFFF;
    --navbar-height: 80px;
}

/* Spinner Animation */
#spinner {
    opacity: 0;
    visibility: hidden;
    transition: opacity .5s ease-out, visibility 0s linear .5s;
    z-index: 99999;
}

#spinner.show {
    transition: opacity .5s ease-out, visibility 0s linear 0s;
    visibility: visible;
    opacity: 1;
}

/* Navbar Dropdown Arrow */
.navbar .dropdown-toggle::after {
    border: none;
    content: "\f107";
    font-family: "Font Awesome 5 Free";
    font-weight: 900;
    vertical-align: middle;
    margin-left: 8px;
}

/* Course Item Hover Effect */
.course-item {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.course-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 30px rgba(0,0,0,0.1) !important;
}

/* Link Hover Effects */
.hover-primary:hover {
    color: var(--primary) !important;
    transform: translateX(-5px);
    transition: all 0.3s ease;
}

/* Button Hover Effects */
.btn {
    transition: all 0.3s ease;
}

.btn:hover {
    transform: translateY(-2px);
}

/* Navbar Sticky Animation */
.navbar {
    transition: all 0.3s ease;
    height: var(--navbar-height);
    background-color: var(--primary) !important;
}

.navbar.scrolled {
    backdrop-filter: blur(10px);
    background-color: var(--primary) !important;
}

/* Navbar collapse animation */
.navbar-collapse {
    transition: all 0.3s ease;
}

.navbar-collapse.collapsing {
    transition: height 0.35s ease;
}

/* Ensure proper navbar button spacing and sizing */
.navbar .d-flex {
    gap: 0.75rem;
}

.navbar .btn {
    white-space: nowrap;
    min-width: fit-content;
}

/* Card Animations */
.card {
    transition: all 0.3s ease;
}

.card:hover {
    box-shadow: 0 10px 25px rgba(0,0,0,0.1) !important;
}

/* Smooth Scroll */
html {
    scroll-behavior: smooth;
}

/* Back to Top Button */
.back-to-top {
    position: fixed;
    display: none;
    right: 45px;
    bottom: 45px;
    z-index: 99;
    width: 44px;
    height: 44px;
    text-align: center;
    line-height: 44px;
    transition: all 0.3s ease;
}

.back-to-top:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

/* Bootstrap Extension Classes */
.text-primary-hover:hover {
    color: var(--primary) !important;
}

.bg-primary-light {
    background-color: var(--light) !important;
}

.border-primary-light {
    border-color: var(--light) !important;
}

/* Loading States */
.loading-overlay {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(2px);
}

/* Grade Card Hover Effects */
.grade-card {
    transition: all 0.3s ease;
}

.grade-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 20px 40px rgba(0,0,0,0.15) !important;
}

.grade-card .position-absolute {
    transition: all 0.3s ease;
}

/* Course Item Overlay Hover - Show overlay on hover */
*:hover > .position-absolute[style*="opacity: 0"] {
    opacity: 1 !important;
}

/* Hover overlay should be behind badges - target all course cards, not just with course-item class */
.position-absolute[style*="background: rgba(0,0,0,0.3)"],
.position-absolute[style*="background: rgba(0,0,0,0.5)"] {
    z-index: 5 !important;
}

/* Grade and subject badges should have higher z-index than hover overlay */
.grade-tags-container, .subject-badges-container {
    z-index: 15 !important;
}

/* Status badges at top-right should always be on top */
.position-absolute.top-0.end-0 {
    z-index: 20 !important;
}

.grade-tags-container .badge {
    z-index: 1;
}

/* Video Container Improvements */
.ratio iframe,
.ratio video {
    border-radius: 0.5rem;
}

/* Alert Improvements - Positioned in top-right corner */
.alert {
    border: none;
    border-radius: 1rem;
    margin-bottom: 0.5rem;
    position: fixed;
    top: calc(var(--navbar-height) - 25px);
    right: 20px;
    width: 350px;
    z-index: 1050;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    animation: slideInRight 0.3s ease-out;
    padding: 1rem 1.25rem;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
}

/* Stack multiple alerts vertically */
.alert:nth-of-type(2) {
    top: calc(var(--navbar-height) + 50px);
}

.alert:nth-of-type(3) {
    top: calc(var(--navbar-height) + 125px);
}

.alert:nth-of-type(4) {
    top: calc(var(--navbar-height) + 200px);
}

/* Improve close button styling */
.alert .btn-close {
    background: none;
    border: none;
    opacity: 0.8;
    transition: all 0.2s ease;
    padding: 0.25rem;
    margin: -0.25rem -0.25rem -0.25rem 0;
    font-size: 1.25rem;
    line-height: 1;
    color: inherit;
    flex-shrink: 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 0.25rem;
    position: relative;
}

/* Ensure close button has visible X symbol */
.alert .btn-close::before {
    content: "×";
    font-size: 1.5rem;
    font-weight: bold;
    line-height: 1;
    color: currentColor;
}

.alert .btn-close:hover {
    opacity: 1;
    background-color: rgba(0, 0, 0, 0.1);
    transform: scale(1.05);
}

.alert .btn-close:focus {
    outline: none;
    box-shadow: 0 0 0 0.2rem rgba(0, 0, 0, 0.15);
    opacity: 1;
}

/* Ensure alert content doesn't overlap with close button */
.alert > div:first-child,
.alert-content {
    flex: 1;
    margin-right: 0.5rem;
}

/* Slide in animation for alerts */
@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Slide out animation for dismissing alerts */
@keyframes slideOutRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

/* Apply slide out animation when alert is being dismissed */
.alert.fade {
    animation: slideOutRight 0.3s ease-out;
}

.alert-success {
    background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
}

.alert-warning {
    background: linear-gradient(135deg, #fff3cd 0%, #ffeaa7 100%);
}

.alert-info {
    background: linear-gradient(135deg, #d1ecf1 0%, #bee5eb 100%);
}

.alert-danger {
    background: linear-gradient(135deg, #f8d7da 0%, #f5c6cb 100%);
}

/* Enhanced close button visibility for different alert types */
.alert-success .btn-close::before {
    color: #155724;
}

.alert-warning .btn-close::before {
    color: #856404;
}

.alert-info .btn-close::before {
    color: #0c5460;
}

.alert-danger .btn-close::before {
    color: #721c24;
}

/* Close button hover effects for better visibility */
.alert-success .btn-close:hover {
    background-color: rgba(21, 87, 36, 0.1);
}

.alert-warning .btn-close:hover {
    background-color: rgba(133, 100, 4, 0.1);
}

.alert-info .btn-close:hover {
    background-color: rgba(12, 84, 96, 0.1);
}

.alert-danger .btn-close:hover {
    background-color: rgba(114, 28, 36, 0.1);
}

/* Responsive adjustments for mobile */
@media (max-width: 768px) {
    .alert {
        width: calc(100% - 40px);
        right: 20px;
        left: 20px;
        width: auto;
    }
}

@media (max-width: 576px) {
    .alert {
        width: calc(100% - 20px);
        right: 10px;
        left: 10px;
        width: auto;
        font-size: 0.9rem;
    }
}

/* Progress Bar Improvements */
.progress {
    border-radius: 1rem;
    background-color: #f8f9fa;
}

.progress-bar {
    border-radius: 1rem;
    background: linear-gradient(90deg, var(--primary) 0%, #4dd0e1 100%);
}

/* Badge Improvements */
.badge {
    font-weight: 600;
    letter-spacing: 0.5px;
}

/* Form Improvements */
.form-control:focus,
.form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 0.2rem rgba(6, 187, 204, 0.25);
}

/* Button Improvements */
.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, #4dd0e1 100%);
    border: none;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #059aa5 0%, var(--primary) 100%);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(6, 187, 204, 0.3);
}

.btn-outline-primary:hover {
    background: var(--primary);
    border-color: var(--primary);
    transform: translateY(-2px);
}

/* Navigation Improvements */
.navbar-brand {
    transition: transform 0.3s ease;
}

.navbar-brand:hover {
    transform: scale(1.05);
}

.navbar .btn {
    transition: all 0.3s ease;
    border-width: 2px;
    font-weight: 500;
}

.navbar .btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

/* Disable transform effects on mobile for better performance */
@media (max-width: 991.98px) {
    .navbar .btn:hover {
        transform: none !important;
    }
}

/* Proper navbar button styling for better contrast and hover effects */
.navbar .btn-outline-light {
    color: white !important;
    border-color: rgba(255,255,255,0.8) !important;
    background-color: transparent !important;
}

.navbar .btn-outline-light:hover,
.navbar .btn-outline-light:focus {
    color: white !important;
    background-color: rgba(255,255,255,0.2) !important;
    border-color: white !important;
    box-shadow: 0 4px 12px rgba(255,255,255,0.3) !important;
}

.navbar .btn-light {
    color: var(--dark) !important;
    background-color: white !important;
    border-color: white !important;
}

.navbar .btn-light:hover,
.navbar .btn-light:focus {
    color: var(--dark) !important;
    background-color: rgba(255,255,255,0.9) !important;
    border-color: white !important;
    box-shadow: 0 4px 12px rgba(255,255,255,0.3) !important;
}

/* Ensure navbar buttons are always visible */
.navbar .d-flex .btn {
    display: inline-block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* Mobile navbar improvements - Fix overflow and contrast issues */
@media (max-width: 991.98px) {
    /* Give collapsed navbar a consistent background matching the main navbar */
    .navbar-collapse {
        background-color: var(--primary) !important;
        backdrop-filter: blur(10px);
        margin: 1rem -1rem -1rem -1rem;
        padding: 1rem;
        border-radius: 0 0 1rem 1rem;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    }

    .navbar .d-flex {
        flex-direction: column;
        gap: 12px !important;
        align-items: stretch !important;
        width: 100%;
        margin-top: 1rem;
    }

    .navbar .btn {
        width: 100%;
        text-align: center;
        padding: 12px 20px;
        font-size: 1rem;
        border-radius: 0.5rem;
        transform: none !important; /* Disable transform on mobile */
    }

    /* Enhanced mobile button styling - outline buttons (Login, Profile, etc.) */
    .navbar .btn-outline-light {
        background-color: transparent !important;
        border-color: white !important;
        color: white !important;
        border-width: 2px !important;
    }

    .navbar .btn-outline-light:hover,
    .navbar .btn-outline-light:focus,
    .navbar .btn-outline-light:active {
        background-color: rgba(255, 255, 255, 0.15) !important;
        border-color: white !important;
        color: white !important;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2) !important;
    }

    /* Solid white button (Create Account) */
    .navbar .btn-light {
        background-color: white !important;
        border-color: white !important;
        color: var(--dark) !important;
        border-width: 2px !important;
    }

    .navbar .btn-light:hover,
    .navbar .btn-light:focus,
    .navbar .btn-light:active {
        background-color: rgba(255, 255, 255, 0.95) !important;
        border-color: rgba(255, 255, 255, 0.95) !important;
        color: var(--dark) !important;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2) !important;
    }

    /* Navbar toggler improvements for mobile */
    .navbar-toggler {
        border: 2px solid rgba(255, 255, 255, 0.8) !important;
        padding: 0.5rem 0.75rem;
    }

    .navbar-toggler:focus {
        box-shadow: 0 0 0 0.2rem rgba(255, 255, 255, 0.3) !important;
    }

    .navbar-toggler-icon {
        background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%28255, 255, 255, 0.9%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e") !important;
    }
}

/* Footer Link Improvements */
.hover-primary {
    transition: all 0.3s ease;
}

.hover-primary:hover {
    color: var(--primary) !important;
    transform: translateX(-5px);
    text-decoration: none !important;
}

/* Spinner Improvements */
.spinner-border {
    animation: spinner-border 0.75s linear infinite;
}

/* Text Shadow for Better Readability */
.text-white {
    text-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

/* Responsive Utilities */
@media (max-width: 768px) {
    .back-to-top {
        right: 20px;
        bottom: 20px;
        width: 40px;
        height: 40px;
        line-height: 40px;
    }

    .grade-card:hover {
        transform: none;
    }

    .course-item:hover {
        transform: none;
    }

    .btn:hover {
        transform: none;
    }

    .display-3 {
        font-size: 2.5rem;
    }

    .display-5 {
        font-size: 2rem;
    }
}

/* Ensure main content is properly positioned below fixed navbar */
body {
    padding-top: var(--navbar-height);
}

/* Remove body padding on mobile to give more space for content */
@media (max-width: 768px) {
    body {
        padding-top: calc(var(--navbar-height) - 10px);
    }
}

/* Print Styles */
@media print {
    .navbar,
    .footer,
    .back-to-top,
    #spinner {
        display: none !important;
    }

    .container-xxl {
        max-width: 100% !important;
    }
}

/* Social media links */
.social-link {
    transition: color 0.3s ease;
}

.social-link[data-hover-color="#1877f2"]:hover {
    color: #1877f2 !important;
}

.social-link[data-hover-color="#ff0000"]:hover {
    color: #ff0000 !important;
}
