@import url('variables.css');

/* ===== RESET & BASE STYLES ===== */

* {
    padding: 0;
    margin: 0;
    font-family: 'Poppins', sans-serif;
    box-sizing: border-box;
    scroll-behavior: smooth;
}


/* ===== BODY STYLES ===== */

body {
    background-color: var(--dark-white);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    font-size: 16px;
    position: relative;
}


/* ===== MAIN SECTION ===== */

#sec1 {
    padding: 120px 2% 40px 280px;
    position: relative;
    min-height: 100vh;
    background: linear-gradient(to bottom, var(--white), var(--dark-white));
    position: relative;
    overflow: hidden;
}

#sec1::before {
    content: '';
    position: absolute;
    top: -50px;
    right: -50px;
    width: 300px;
    height: 300px;
    border-radius: 50%;
    background-color: rgba(5, 89, 207, 0.05);
    z-index: 0;
    animation: pulse 8s infinite alternate;
}

#sec1::after {
    content: '';
    position: absolute;
    bottom: -50px;
    left: -50px;
    width: 250px;
    height: 250px;
    border-radius: 50%;
    background-color: rgba(11, 129, 202, 0.05);
    z-index: 0;
    animation: pulse 6s infinite alternate-reverse;
}

@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 0.5;
    }
    100% {
        transform: scale(1.2);
        opacity: 0.8;
    }
}


/* ===== SIDEBAR ===== */

#sec1 .side {
    position: fixed;
    left: 0;
    top: 0;
    width: 260px;
    height: 100%;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    /* Safari support */
    padding: 120px 0 80px 0;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-medium);
    z-index: 100;
    border-right: 1px solid rgba(5, 89, 207, 0.1);
    overflow-y: auto;
    will-change: transform;
    /* Performance optimization */
}


/* Fixed sidebar content with gradient overlays */

#sec1 .side::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 260px;
    height: 120px;
    background: linear-gradient(to bottom, rgba(255, 255, 255, 1), rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.7));
    z-index: 101;
    pointer-events: none;
}

#sec1 .side::after {
    content: '';
    position: fixed;
    bottom: 0;
    left: 0;
    width: 260px;
    height: 80px;
    background: linear-gradient(to top, rgba(255, 255, 255, 1), rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.7));
    z-index: 101;
    pointer-events: none;
}

#sec1 .side p {
    border-left: 4px solid transparent;
    padding: 18px 25px;
    margin: 8px 15px;
    font-size: 16px;
    cursor: pointer;
    transition: var(--transition-fast);
    font-weight: 500;
    border-radius: 0 var(--border-radius-lg) var(--border-radius-lg) 0;
    position: relative;
    overflow: hidden;
    background-color: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    /* Safari support */
    z-index: 102;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

#sec1 .side p::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(5, 89, 207, 0.1), transparent);
    transition: var(--transition-medium);
}

#sec1 .side p:hover::before {
    left: 100%;
}

#sec1 .side p:hover {
    background: var(--category-hover);
    color: var(--primary-color);
    transform: translateX(8px);
    box-shadow: 0 4px 15px rgba(5, 89, 207, 0.1);
}

#sec1 .side p.select {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border-left: 4px solid var(--primary-dark);
    font-weight: 600;
    transform: translateX(5px);
    box-shadow: 0 8px 25px rgba(5, 89, 207, 0.3);
}


/* ===== SEARCH CONTAINER ===== */

.search-container {
    width: 100%;
    max-width: 500px;
    margin: 0 auto 30px auto;
    position: relative;
}

.search-container input {
    width: 100%;
    padding: 15px 55px 15px 20px;
    border: 2px solid var(--white);
    border-radius: var(--border-radius-xl);
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    /* Safari support */
    font-size: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    transition: var(--transition-fast);
    outline: none;
    position: relative;
    overflow: hidden;
}

.search-container input::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(45deg, transparent, rgba(5, 89, 207, 0.05), transparent);
    transform: translateX(-100%);
    transition: transform 0.6s ease;
}

.search-container input:hover::before {
    transform: translateX(100%);
}

.search-container input:focus {
    background: white;
    box-shadow: 0 12px 40px rgba(5, 89, 207, 0.2);
    transform: translateY(-2px);
    border: 2px solid rgba(5, 89, 207, 0.2);
}

.search-icon {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: var(--border-radius-circle);
    cursor: pointer;
    transition: var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
}

.search-icon:hover {
    transform: translateY(-50%) scale(1.1);
    box-shadow: 0 4px 15px rgba(5, 89, 207, 0.4);
}


/* ===== COURSE GRID ===== */

#sec1 .content {
    width: 100%;
    padding: 20px;
    min-height: 600px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 30px;
    position: relative;
    z-index: 1;
}


/* ===== COURSE CARDS ===== */

#sec1 .content .box {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    /* Safari support */
    border-radius: var(--border-radius-xl);
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    transition: var(--transition-medium);
    display: none;
    height: auto;
    max-height: 500px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    position: relative;
}

#sec1 .content .box::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    transform: scaleX(0);
    transition: var(--transition-fast);
}

#sec1 .content .box.open {
    display: flex;
    flex-direction: column;
    animation: fadeInUp 0.6s ease-out forwards;
}

#sec1 .content .box:hover {
    transform: translateY(-15px);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
}

#sec1 .content .box:hover::before {
    transform: scaleX(1);
}

#sec1 .content .box img {
    width: 100%;
    height: 180px;
    object-fit: cover;
    transition: var(--transition-medium);
}

#sec1 .content .box:hover img {
    transform: scale(1.05);
}

#sec1 .content .box>div {
    padding: 20px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

#sec1 .content .box>div>div {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 15px;
}

#sec1 .content .box>div>div h3 a {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-color);
    transition: var(--transition-fast);
    line-height: 1.4;
    text-decoration: none;
}

#sec1 .content .box>div>div h3 a:hover {
    color: var(--primary-color);
}

#sec1 .content .box>div>div span {
    font-size: 13px;
    font-weight: 600;
    background: linear-gradient(135deg, var(--primary-light), rgba(168, 204, 255, 0.3));
    padding: 6px 12px;
    border-radius: var(--border-radius-xl);
    white-space: nowrap;
    box-shadow: 0 2px 10px rgba(5, 89, 207, 0.1);
}

#sec1 .content .box>div>p {
    font-size: 14px;
    margin-top: 10px;
    color: var(--text-light);
    line-height: 1.6;
    flex-grow: 1;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    overflow: hidden;
}


/* ===== ANIMATIONS ===== */

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    opacity: 0;
    animation: fadeInUp 0.8s ease-out forwards;
}

.fade-in.delay-1 {
    animation-delay: 0.2s;
}

.fade-in.delay-2 {
    animation-delay: 0.4s;
}

.fade-in.delay-3 {
    animation-delay: 0.6s;
}


/* ===== RESPONSIVE DESIGN ===== */

@media (max-width: 1200px) {
    #sec1 {
        padding: 120px 2% 40px 240px;
    }
    #sec1 .side {
        width: 220px;
    }
    #sec1 .side::before,
    #sec1 .side::after {
        width: 220px;
    }
}


/* Medium Screens */

@media (max-width: 990px) {
    /* Navigation Menu */
    .nav-links,
    .nav-login {
        display: none;
    }
    .menu-icon {
        display: block;
        font-size: 24px;
        color: var(--text-color);
        cursor: pointer;
    }
    .navbar-menu {
        position: fixed;
        top: 0;
        right: -100%;
        width: 300px;
        height: 100vh;
        background: rgba(255, 255, 255, 0.95);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        /* Safari support */
        display: flex;
        flex-direction: column;
        padding: 80px 30px 30px;
        transition: var(--transition-medium);
        z-index: 999;
        box-shadow: -10px 0 30px rgba(0, 0, 0, 0.1);
    }
    .navbar-menu.active {
        right: 0;
    }
    .close-btn {
        position: absolute;
        top: 20px;
        right: 20px;
        font-size: 24px;
        color: var(--text-color);
        cursor: pointer;
    }
    .navbar-menu ul {
        list-style: none;
        margin-bottom: 30px;
    }
    .navbar-menu ul li {
        margin-bottom: 20px;
    }
    .navbar-menu ul li a {
        color: var(--text-color);
        font-size: 18px;
        font-weight: 500;
        text-decoration: none;
        transition: var(--transition-fast);
    }
    .navbar-menu ul li a:hover {
        color: var(--primary-color);
    }
    /* Main Section */
    #sec1 {
        padding: 100px 20px 40px 20px;
    }
    /* Sidebar becomes horizontal scrolling menu */
    #sec1 .side {
        width: 100%;
        height: auto;
        position: fixed;
        top: 70px;
        left: 0;
        flex-direction: row;
        overflow-x: auto;
        overflow-y: hidden;
        padding: 15px;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
        margin-bottom: 20px;
        border-radius: 0;
        z-index: 100;
        background: rgba(255, 255, 255, 0.95);
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
        /* Safari support */
    }
    /* Remove fixed pseudo-elements for horizontal sidebar */
    #sec1 .side::before,
    #sec1 .side::after {
        display: none;
    }
    #sec1 .side p {
        border-left: none;
        border-bottom: 3px solid transparent;
        padding: 12px 20px;
        margin: 0 8px;
        white-space: nowrap;
        font-size: 14px;
        border-radius: var(--border-radius-md);
        background-color: rgba(255, 255, 255, 0.9);
    }
    #sec1 .side p.select {
        border-left: none;
        border-bottom: 3px solid var(--primary-color);
    }
    #sec1 .side p:hover {
        transform: translateY(-3px);
    }
    /* Adjust grid for smaller screens */
    #sec1 .content {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
        gap: 25px;
        margin-top: 60px;
    }
}


/* Small Screens */

@media (max-width: 600px) {
    #sec1 {
        padding: 90px 15px 30px 15px;
    }
    /* Single column layout for mobile */
    #sec1 .content {
        grid-template-columns: 1fr;
        gap: 20px;
        margin-top: 70px;
    }
    /* Smaller text and padding for sidebar items */
    #sec1 .side p {
        font-size: 13px;
        padding: 10px 15px;
    }
    /* Smaller padding for card content */
    #sec1 .content .box>div {
        padding: 15px;
    }
    /* Smaller font size for card titles */
    #sec1 .content .box>div>div h3 a {
        font-size: 16px;
    }
    /* Search container for mobile */
    .search-container {
        margin-bottom: 20px;
    }
    .search-container input {
        padding: 12px 50px 12px 15px;
        font-size: 14px;
    }
}


/* ===== SEARCH HIGHLIGHTING ===== */

.box.highlighted {
    border: 3px solid #FFD700 !important;
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.5) !important;
    transform: translateY(-10px) !important;
    transition: all 0.3s ease !important;
}

.search-results-count {
    text-align: center;
    margin-top: 10px;
    font-size: 14px;
    color: var(--primary-color);
    font-weight: 500;
    background-color: rgba(5, 89, 207, 0.1);
    padding: 5px 15px;
    border-radius: var(--border-radius-md);
    display: inline-block;
    position: absolute;
    right: 10px;
    top: -40px;
}