/**
 * Course Design System - Base Styles
 * ===================================
 * Core layout and foundational styles for all courses
 */

/* ═══════════════════════════════════════════════════
   CSS RESET & BASE
   ═══════════════════════════════════════════════════ */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-family);
    font-size: var(--font-size-base);
    line-height: var(--line-height-normal);
    color: var(--text-primary);
    background: var(--bg-page);
    background-attachment: fixed;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Disable text selection for course content */
body.no-select {
    -webkit-user-select: none;
    -moz-user-select: none;
    user-select: none;
}

/* ═══════════════════════════════════════════════════
   SLIDE SYSTEM
   ═══════════════════════════════════════════════════ */
.slide {
    min-height: 100vh;
    width: 100%;
    display: none;
    align-items: center;
    justify-content: center;
    padding: var(--space-xl) var(--space-md) calc(var(--space-3xl) + 2rem);
    opacity: 0;
    transform: translateY(20px);
}

.slide.active {
    display: flex;
    opacity: 1 !important;
    transform: translateY(0) !important;
    animation: slideIn 0.5s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

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

/* ═══════════════════════════════════════════════════
   MAIN CONTAINER
   ═══════════════════════════════════════════════════ */
.container {
    max-width: min(1120px, 100%);
    width: 100%;
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: var(--radius-2xl);
    box-shadow: var(--shadow-2xl),
        0 0 0 1px rgba(255, 255, 255, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);
    overflow: hidden;
    border: 1px solid var(--border-card);
}

/* ═══════════════════════════════════════════════════
   HEADER - GRADIENT HERO
   ═══════════════════════════════════════════════════ */
.header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 50%, var(--accent) 100%);
    background-size: 200% 200%;
    animation: gradientShift 8s ease infinite;
    color: var(--text-inverse);
    padding: var(--space-2xl) var(--space-xl);
    text-align: center;
    position: relative;
    overflow: hidden;
}

.header::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, transparent 50%);
    animation: shimmer 3s linear infinite;
    pointer-events: none;
}

@keyframes gradientShift {

    0%,
    100% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }
}

@keyframes shimmer {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.header h1 {
    font-size: clamp(1.75rem, 5vw, var(--font-size-4xl));
    font-weight: var(--font-weight-bold);
    margin-bottom: var(--space-sm);
    position: relative;
    text-shadow: 0 2px 15px rgba(0, 0, 0, 0.35);
}

.header p {
    font-size: clamp(0.95rem, 2.5vw, var(--font-size-lg));
    opacity: 0.95;
    position: relative;
    font-weight: var(--font-weight-medium);
    text-shadow: 0 1px 8px rgba(0, 0, 0, 0.25);
}

/* ═══════════════════════════════════════════════════
   CONTENT AREA
   ═══════════════════════════════════════════════════ */
.content {
    padding: clamp(var(--space-lg), 5vw, var(--space-xl));
}

/* ═══════════════════════════════════════════════════
   SECTION TITLE
   ═══════════════════════════════════════════════════ */
.section-title {
    color: var(--primary-dark);
    font-size: clamp(var(--font-size-xl), 3.5vw, var(--font-size-2xl));
    margin-bottom: var(--space-lg);
    font-weight: var(--font-weight-bold);
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.section-title::before {
    content: '';
    width: 5px;
    height: 1.5em;
    background: linear-gradient(180deg, var(--primary), var(--secondary));
    border-radius: 3px;
    flex-shrink: 0;
}

/* Alt style with line */
.section-title--line::after {
    content: '';
    flex: 1;
    height: 2px;
    background: linear-gradient(to right, var(--primary-light), transparent);
}

/* ═══════════════════════════════════════════════════
   GRID LAYOUTS
   ═══════════════════════════════════════════════════ */
.grid-2 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--space-lg);
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: var(--space-lg);
}

.grid-4 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: var(--space-md);
}

/* ═══════════════════════════════════════════════════
   PROGRESS BAR
   ═══════════════════════════════════════════════════ */
.progress-bar {
    height: 4px;
    background: var(--gray-200);
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: var(--z-fixed);
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--secondary), var(--accent));
    background-size: 200% 100%;
    animation: progressGlow 2s ease infinite;
    width: 0%;
    transition: width 0.4s ease;
    border-radius: 0 4px 4px 0;
    box-shadow: var(--shadow-glow);
}

@keyframes progressGlow {

    0%,
    100% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }
}

/* ═══════════════════════════════════════════════════
   NAVIGATION BUTTONS ROW
   ═══════════════════════════════════════════════════ */
.nav-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-md);
    justify-content: space-between;
    margin-top: var(--space-xl);
    padding-top: var(--space-lg);
    border-top: 1px solid var(--border-card);
}

/* ═══════════════════════════════════════════════════
   FLOATING BUTTONS
   ═══════════════════════════════════════════════════ */
.floating-btn {
    position: fixed;
    width: 50px;
    height: 50px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    text-decoration: none;
    z-index: var(--z-fixed);
    border: 2px solid rgba(255, 255, 255, 0.3);
    transition: var(--transition-normal);
    cursor: pointer;
    color: var(--text-inverse);
    background: var(--primary);
    box-shadow: var(--shadow-lg);
}

.floating-btn:hover {
    transform: scale(1.1);
    box-shadow: var(--shadow-xl);
}

/* Home Button */
.home-btn {
    bottom: 20px;
    right: 20px;
}

.home-btn:hover {
    background: var(--secondary);
}

/* Forum Button */
.forum-btn {
    bottom: 80px;
    right: 20px;
}

.forum-btn:hover {
    background: var(--secondary);
}

/* Copyright Button */
.copyright-btn {
    bottom: 140px;
    right: 20px;
}

.copyright-btn:hover {
    background: var(--secondary);
}

/* Theme Toggle Button */
.theme-toggle-btn {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 45px;
    height: 45px;
    border-radius: var(--radius-full);
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid var(--border-card);
    cursor: pointer;
    z-index: var(--z-fixed);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-md);
    transition: var(--transition-normal);
    color: var(--text-secondary);
}

.theme-toggle-btn:hover {
    transform: rotate(15deg) scale(1.1);
}

/* Complete Button */
.complete-btn {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, var(--success), var(--success-dark));
    color: var(--text-inverse);
    padding: 0.6rem 1.25rem;
    border-radius: var(--radius-full);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-bold);
    border: none;
    cursor: pointer;
    z-index: var(--z-fixed);
    display: flex;
    align-items: center;
    gap: 0.4rem;
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4),
        0 0 0 2px rgba(255, 255, 255, 0.3);
    transition: var(--transition-bounce);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    overflow: hidden;
}

.complete-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    animation: completeShine 3s infinite;
}

@keyframes completeShine {
    0% {
        left: -100%;
    }

    50%,
    100% {
        left: 100%;
    }
}

.complete-btn:hover {
    transform: translateX(-50%) translateY(-3px) scale(1.05);
    box-shadow: 0 15px 40px rgba(16, 185, 129, 0.5),
        0 0 0 4px rgba(255, 255, 255, 0.4);
}

.complete-btn:disabled {
    background: linear-gradient(135deg, var(--gray-400), var(--gray-500));
    cursor: not-allowed;
    opacity: 0.7;
}

/* ═══════════════════════════════════════════════════
   AUTHOR BOX
   ═══════════════════════════════════════════════════ */
.author-box {
    position: fixed;
    bottom: 20px;
    left: 20px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: var(--radius-lg);
    padding: var(--space-md);
    box-shadow: var(--shadow-lg);
    z-index: var(--z-fixed);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    backdrop-filter: blur(10px);
}

.author-box a {
    color: var(--primary);
    text-decoration: none;
    font-weight: var(--font-weight-semibold);
}

.author-box a:hover {
    text-decoration: underline;
}

.author-close-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1.25rem;
    line-height: 1;
    padding: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-fast);
}

.author-close-btn:hover {
    color: var(--text-primary);
}

/* ═══════════════════════════════════════════════════
   RESPONSIVE ADJUSTMENTS
   ═══════════════════════════════════════════════════ */
@media (max-width: 768px) {
    .slide {
        padding: var(--space-md) var(--space-sm) calc(var(--space-2xl) + 3rem);
    }

    .container {
        border-radius: var(--radius-xl);
        margin: 0 var(--space-xs);
    }

    .header {
        padding: var(--space-xl) var(--space-md);
    }

    .content {
        padding: var(--space-md);
    }

    .nav-buttons {
        flex-direction: column;
        gap: var(--space-sm);
    }

    .floating-btn {
        width: 44px;
        height: 44px;
        font-size: 1.1rem;
    }

    .complete-btn {
        font-size: var(--font-size-xs);
        padding: 0.5rem 1rem;
    }
}

@media (max-width: 480px) {

    .grid-2,
    .grid-3,
    .grid-4 {
        grid-template-columns: 1fr;
    }
}