/* ===== Global Styles ===== */
:root {
    --primary-color: #6366f1;
    --secondary-color: #8b5cf6;
    --accent-color: #ec4899;
    --dark-color: #1e293b;
    --light-color: #f8fafc;
    --gradient-1: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-2: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --gradient-3: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    --shadow-hover: 0 15px 40px rgba(0, 0, 0, 0.15);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: var(--dark-color);
    background-color: var(--light-color);
    overflow-x: hidden;
}

html[dir="ltr"] {
    direction: ltr;
}

html[dir="rtl"] {
    direction: rtl;
}

/* ===== Navigation ===== */
.navbar {
    background: var(--gradient-1) !important;
    padding: 1rem 0;
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    z-index: 1030; /* Ensure navbar is above content */
}

/* Mobile navbar adjustments */
@media (max-width: 991.98px) {
    .navbar-collapse {
        background: rgba(102, 126, 234, 0.98);
        backdrop-filter: blur(20px);
        margin-top: 1rem;
        padding: 1.5rem;
        border-radius: 15px;
        box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
        max-height: calc(100vh - 80px);
        overflow-y: auto;
        border: 1px solid rgba(255, 255, 255, 0.1);
    }
    
    .navbar-nav {
        padding-top: 0;
    }
    
    .navbar-nav .nav-item {
        margin-bottom: 0.75rem;
    }
    
    .navbar-nav .nav-link {
        padding: 0.75rem 1rem;
        border-radius: 10px;
        transition: all 0.3s ease;
        margin: 0;
    }
    
    .navbar-nav .nav-link:hover,
    .navbar-nav .nav-link.active {
        background: rgba(255, 255, 255, 0.15);
        transform: translateX(-5px);
    }
    
    /* Ensure dropdown works properly on mobile */
    .navbar-nav .dropdown {
        position: static;
    }
    
    .navbar-nav .dropdown-toggle {
        display: flex;
        align-items: center;
        justify-content: space-between;
        width: 100%;
        padding: 0.75rem 1rem;
        border-radius: 10px;
        background: rgba(255, 255, 255, 0.1);
        border: 1px solid rgba(255, 255, 255, 0.2);
        transition: all 0.3s ease;
    }
    
    .navbar-nav .dropdown-toggle:hover {
        background: rgba(255, 255, 255, 0.15);
        border-color: rgba(255, 255, 255, 0.3);
    }
    
    .navbar-nav .dropdown-toggle::after {
        margin-right: auto;
        margin-left: 0.5rem;
        transition: transform 0.3s ease;
    }
    
    .navbar-nav .dropdown.show .dropdown-toggle::after {
        transform: rotate(180deg);
    }
    
    /* Ensure dropdown works on mobile */
    .navbar-nav .dropdown {
        position: static;
    }
    
    .navbar-nav .dropdown-menu {
        position: static !important;
        float: none !important;
        width: 100%;
        margin-top: 0.75rem;
        padding: 0.5rem;
        border-radius: 10px;
        background: rgba(255, 255, 255, 0.15);
        backdrop-filter: blur(10px);
        border: 1px solid rgba(255, 255, 255, 0.2);
        box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
        transform: none !important;
        will-change: auto;
        /* Bootstrap default is display: none, we'll override when .show is present */
    }
    
    /* Show dropdown when parent is active - Bootstrap 5 uses .show class */
    .navbar-nav .dropdown.show .dropdown-menu,
    .navbar-nav .dropdown[aria-expanded="true"] .dropdown-menu,
    .navbar-nav .dropdown-menu.show {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
        animation: slideDown 0.3s ease;
    }
    
    .navbar-nav .dropdown-item {
        padding: 0.75rem 1rem;
        border-radius: 8px;
        margin-bottom: 0.25rem;
        color: white;
        display: flex;
        align-items: center;
        transition: all 0.3s ease;
        font-weight: 500;
    }
    
    .navbar-nav .dropdown-item i {
        margin-left: 0.75rem;
        font-size: 1.1rem;
        width: 20px;
        text-align: center;
    }
    
    .navbar-nav .dropdown-item:hover,
    .navbar-nav .dropdown-item.active {
        background: rgba(255, 255, 255, 0.2);
        transform: translateX(-5px);
        color: white;
    }
    
    .navbar-nav .dropdown-item.text-danger {
        color: #ff6b6b !important;
    }
    
    .navbar-nav .dropdown-item.text-danger:hover {
        background: rgba(255, 107, 107, 0.2);
        color: #ff6b6b !important;
    }
    
    .navbar-nav .dropdown-divider {
        border-color: rgba(255, 255, 255, 0.2);
        margin: 0.5rem 0;
    }
    
    /* Adjust hero section when navbar is open */
    body.navbar-open .hero-section {
        padding-top: 350px;
        transition: padding-top 0.3s ease;
    }
    
    /* Ensure content doesn't get hidden behind navbar */
    body.navbar-open section:first-of-type {
        margin-top: 0;
    }
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.navbar-brand {
    font-size: 1.5rem;
    transition: transform 0.3s ease;
}

.navbar-brand:hover {
    transform: scale(1.05);
}

.nav-link {
    font-weight: 500;
    margin: 0 0.5rem;
    transition: all 0.3s ease;
    position: relative;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 2px;
    background: white;
    transition: all 0.3s ease;
    transform: translateX(-50%);
}

.nav-link:hover::after,
.nav-link.active::after {
    width: 80%;
}

/* ===== Hero Section ===== */
.hero-section {
    position: relative;
    min-height: 100vh;
    display: flex;
    align-items: center;
    background: var(--gradient-1);
    overflow: hidden;
    padding-top: 80px; /* Space for fixed navbar */
}

@media (max-width: 991.98px) {
    .hero-section {
        padding-top: 70px; /* Less padding on mobile */
    }
}

.hero-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: url('data:image/svg+xml,<svg width="100" height="100" xmlns="http://www.w3.org/2000/svg"><defs><pattern id="grid" width="100" height="100" patternUnits="userSpaceOnUse"><path d="M 100 0 L 0 0 0 100" fill="none" stroke="rgba(255,255,255,0.1)" stroke-width="1"/></pattern></defs><rect width="100%" height="100%" fill="url(%23grid)"/></svg>');
    opacity: 0.3;
}

.hero-content {
    position: relative;
    z-index: 2;
}

.hero-text h1 {
    color: white;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
    animation: fadeInUp 1s ease;
}

.hero-text p {
    color: rgba(255, 255, 255, 0.9);
    animation: fadeInUp 1s ease 0.2s both;
}

.hero-buttons {
    animation: fadeInUp 1s ease 0.4s both;
}

.hero-image {
    position: relative;
    height: 500px;
}

.floating-card {
    position: absolute;
    width: 150px;
    height: 150px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    color: white;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    animation: float 3s ease-in-out infinite;
}

.floating-card.card1 {
    top: 10%;
    left: 10%;
    animation-delay: 0s;
}

.floating-card.card2 {
    top: 50%;
    right: 20%;
    animation-delay: 1s;
}

.floating-card.card3 {
    bottom: 10%;
    left: 30%;
    animation-delay: 2s;
}

.scroll-indicator {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    color: white;
    font-size: 2rem;
    animation: bounce 2s infinite;
}

/* ===== Animations ===== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(50px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes float {
    0%, 100% {
        transform: translateY(0) rotate(0deg);
    }
    50% {
        transform: translateY(-20px) rotate(5deg);
    }
}

@keyframes bounce {
    0%, 100% {
        transform: translateX(-50%) translateY(0);
    }
    50% {
        transform: translateX(-50%) translateY(10px);
    }
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

.animate-fade-in {
    animation: fadeInUp 1s ease;
}

.animate-slide-in {
    animation: slideIn 1s ease;
}

/* ===== Features Section ===== */
.features-section {
    padding: 5rem 0;
}

.section-title {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
    background: var(--gradient-1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.feature-card {
    background: white;
    padding: 2.5rem;
    border-radius: 20px;
    text-align: center;
    transition: all 0.3s ease;
    box-shadow: var(--shadow);
    height: 100%;
    position: relative;
    overflow: hidden;
}

.feature-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 5px;
    background: var(--gradient-1);
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.feature-card:hover::before {
    transform: scaleX(1);
}

.feature-card:hover {
    transform: translateY(-10px);
    box-shadow: var(--shadow-hover);
}

.feature-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 1.5rem;
    background: var(--gradient-1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: white;
    transition: all 0.3s ease;
}

.feature-card:hover .feature-icon {
    transform: scale(1.1) rotate(5deg);
}

.feature-card h4 {
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--dark-color);
}

/* ===== Courses ===== */
.courses-preview {
    padding: 5rem 0;
}

.course-card {
    background: white;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.course-card:hover {
    transform: translateY(-10px);
    box-shadow: var(--shadow-hover);
}

.course-image {
    height: 200px;
    background: var(--gradient-1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 4rem;
    color: white;
    position: relative;
    overflow: hidden;
}

.course-image::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.1);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.course-card:hover .course-image::after {
    opacity: 1;
}

.course-body {
    padding: 1.5rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.course-category {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background: var(--gradient-2);
    color: white;
    border-radius: 20px;
    font-size: 0.875rem;
    margin-bottom: 1rem;
}

.course-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--dark-color);
}

.course-description {
    color: #64748b;
    margin-bottom: 1rem;
    flex-grow: 1;
}

.course-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 1rem;
    border-top: 1px solid #e2e8f0;
}

.course-rating {
    color: #fbbf24;
}

.course-price {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary-color);
}

/* ===== Stats Section ===== */
.stats-section {
    background: var(--gradient-1);
    padding: 5rem 0;
    color: white;
}

.stat-item {
    text-align: center;
    padding: 2rem;
}

.stat-number {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: white;
}

.stat-item p {
    font-size: 1.1rem;
    opacity: 0.9;
}

/* ===== Page Header ===== */
.page-header {
    background: var(--gradient-1);
    color: white;
    padding: 8rem 0 4rem;
    margin-top: 76px;
}

.min-vh-50 {
    min-height: 50vh;
}

/* ===== Dashboard ===== */
.dashboard-section {
    padding: 2rem 0;
}

.stat-card {
    background: white;
    padding: 2rem;
    border-radius: 15px;
    box-shadow: var(--shadow);
    text-align: center;
    transition: all 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-hover);
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
    color: white;
    font-size: 1.5rem;
}

.stat-card h3 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    margin-top: 0.5rem;
    color: var(--dark-color);
}

.stat-card p {
    margin-bottom: 0;
    font-size: 0.95rem;
    color: #64748b;
}

.course-icon-small {
    width: 50px;
    height: 50px;
    background: var(--gradient-1);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: white;
    flex-shrink: 0;
}

/* ===== Logout Button ===== */
#logoutBtn {
    border: 1px solid rgba(255, 255, 255, 0.5);
    color: white;
    transition: all 0.3s ease;
    padding: 0.375rem 0.75rem;
}

#logoutBtn:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: white;
    color: white;
    transform: translateY(-1px);
}

#logoutBtn i {
    font-size: 0.9rem;
}

#logoutBtn span {
    font-size: 0.875rem;
}

/* ===== Profile Section ===== */
.profile-section {
    padding: 2rem 0;
}

.profile-avatar {
    width: 120px;
    height: 120px;
    margin: 0 auto;
    background: var(--gradient-1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 4rem;
    color: white;
}

/* ===== Dropdown Menu ===== */
.dropdown-menu {
    border-radius: 10px;
    box-shadow: var(--shadow-hover);
    border: none;
    padding: 0.5rem;
}

.dropdown-item {
    border-radius: 5px;
    padding: 0.5rem 1rem;
    transition: all 0.3s ease;
}

.dropdown-item:hover {
    background: var(--gradient-1);
    color: white;
}

.dropdown-item.active {
    background: var(--gradient-1);
    color: white;
}

.dropdown-item.text-danger:hover {
    background: #dc3545;
    color: white;
}

.dropdown-toggle::after {
    margin-right: 0.5rem;
    margin-left: 0;
}

html[dir="ltr"] .dropdown-toggle::after {
    margin-left: 0.5rem;
    margin-right: 0;
}

/* ===== Course Detail ===== */
.course-detail-section {
    padding: 2rem 0;
}

.course-detail-header {
    background: white;
    padding: 2rem;
    border-radius: 20px;
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
}

.course-detail-image {
    height: 300px;
    background: var(--gradient-1);
    border-radius: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 5rem;
    color: white;
    margin-bottom: 2rem;
}

/* ===== Footer ===== */
.footer {
    background: var(--dark-color);
    color: white;
    padding: 3rem 0 1rem;
}

.footer h5 {
    margin-bottom: 1rem;
    font-weight: 600;
}

.footer ul {
    list-style: none;
}

.footer ul li {
    margin-bottom: 0.5rem;
}

.footer a {
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    transition: color 0.3s ease;
}

.footer a:hover {
    color: white;
}

.social-links {
    display: flex;
    gap: 1rem;
}

.social-links a {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.social-links a:hover {
    background: var(--primary-color);
    transform: translateY(-3px);
}

/* ===== Buttons ===== */
.btn {
    border-radius: 10px;
    padding: 0.75rem 1.5rem;
    font-weight: 500;
    transition: all 0.3s ease;
    border: none;
}

.btn-primary {
    background: var(--gradient-1);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(99, 102, 241, 0.4);
}

.btn-outline-light {
    border: 2px solid white;
    color: white;
}

.btn-outline-light:hover {
    background: white;
    color: var(--primary-color);
}

/* ===== Forms ===== */
.form-control,
.form-select {
    border-radius: 10px;
    border: 2px solid #e2e8f0;
    padding: 0.75rem 1rem;
    transition: all 0.3s ease;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(99, 102, 241, 0.25);
}

/* ===== Modal ===== */
.modal-content {
    border-radius: 20px;
    border: none;
    box-shadow: var(--shadow-hover);
}

.modal-dialog-centered {
    min-height: calc(100% - 3.5rem);
}

.modal-header {
    border-bottom: 1px solid #e2e8f0;
    padding: 1.5rem 1.5rem 0.5rem;
}

.modal-body {
    padding: 1.5rem;
}

.btn-close-custom {
    background: none;
    border: none;
    font-size: 1.25rem;
    color: #6c757d;
    cursor: pointer;
    padding: 0.5rem;
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.btn-close-custom:hover {
    background: #f8f9fa;
    color: #212529;
    transform: rotate(90deg);
}

.btn-close-custom i {
    line-height: 1;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .hero-text h1 {
        font-size: 2rem;
    }
    
    .section-title {
        font-size: 2rem;
    }
    
    .floating-card {
        width: 100px;
        height: 100px;
        font-size: 2rem;
    }
    
    .stat-number {
        font-size: 2rem;
    }
}

/* ===== Loading Animation ===== */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ===== Smooth Scroll ===== */
html {
    scroll-behavior: smooth;
}

/* ===== Progress Bar ===== */
.progress {
    height: 8px;
    border-radius: 10px;
    background: #e2e8f0;
    overflow: hidden;
}

.progress-bar {
    background: var(--gradient-1);
    transition: width 0.3s ease;
}

/* ===== Badge ===== */
.badge {
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-weight: 500;
}

/* ===== Card Hover Effects ===== */
.card-hover-effect {
    transition: all 0.3s ease;
}

.card-hover-effect:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-hover);
}

/* ===== Text Gradient ===== */
.text-gradient {
    background: var(--gradient-1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ===== Reviews ===== */
.reviews-summary {
    background: white;
    padding: 1.5rem;
    border-radius: 15px;
    box-shadow: var(--shadow);
}

.rating-stars {
    font-size: 1.2rem;
}

.rating-stars.small {
    font-size: 0.9rem;
}

.review-item {
    transition: all 0.3s ease;
}

.review-item:hover {
    transform: translateX(-5px);
    box-shadow: var(--shadow);
}

/* ===== Course Content Accordion ===== */
.accordion-button {
    font-weight: 600;
    color: var(--dark-color);
}

.accordion-button:not(.collapsed) {
    background: var(--gradient-1);
    color: white;
}

.accordion-button:not(.collapsed)::after {
    filter: brightness(0) invert(1);
}

/* ===== Sticky Sidebar ===== */
.sticky-top {
    position: sticky;
    top: 100px;
    z-index: 10;
}

/* ===== Content Section ===== */
.content-section h2 {
    color: var(--primary-color);
    font-weight: 700;
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 0.5rem;
}

.content-section p {
    line-height: 1.8;
    color: #64748b;
}

/* ===== Badge Improvements ===== */
.badge {
    font-size: 0.875rem;
    padding: 0.5rem 1rem;
}

/* ===== Loading States ===== */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* ===== Trust Badges ===== */
.trust-badges {
    background: var(--gradient-1);
    padding: 2rem;
    border-radius: 15px;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 1.5rem;
    box-shadow: var(--shadow);
}

.trust-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.75rem 1.5rem;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 12px;
    color: var(--primary-color);
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    white-space: nowrap;
}

.trust-badge:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
    background: white;
}

.trust-badge i {
    margin-left: 0.5rem;
    font-size: 1.2rem;
    color: var(--primary-color);
}

html[dir="ltr"] .trust-badge i {
    margin-left: 0;
    margin-right: 0.5rem;
}
