/* ===================================
   ENHANCED WEB DEVELOPMENT TUTORIAL
   Professional & Modern Design System
   =================================== */

/* Import Beautiful Fonts */
@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@400;600;700;900&family=DM+Sans:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;600&display=swap');

/* CSS Variables for Consistency */
:root {
    /* Colors - Warm Academic Palette */
    --primary: #bf9270;
    --primary-dark: #a67c5d;
    --primary-light: #d4a989;
    --secondary: #4a4a4a;
    --accent: #c77d3f;
    --background: #fdfaf6;
    --surface: #ffffff;
    --surface-hover: #f8f5f1;
    --border: #e3dcd2;
    --text-primary: #2c2c2c;
    --text-secondary: #6b6b6b;
    --text-muted: #9e9e9e;
    
    /* Shadows */
    --shadow-sm: 0 2px 8px rgba(191, 146, 112, 0.08);
    --shadow-md: 0 4px 16px rgba(191, 146, 112, 0.12);
    --shadow-lg: 0 8px 24px rgba(191, 146, 112, 0.15);
    --shadow-hover: 0 12px 32px rgba(191, 146, 112, 0.2);
    
    /* Typography */
    --font-display: 'Playfair Display', serif;
    --font-body: 'DM Sans', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
    
    /* Spacing */
    --spacing-xs: 0.5rem;
    --spacing-sm: 1rem;
    --spacing-md: 1.5rem;
    --spacing-lg: 2rem;
    --spacing-xl: 3rem;
    
    /* Border Radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    
    /* Transitions */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 350ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-body);
    background: var(--background);
    color: var(--text-primary);
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

/* Smooth Scrolling */
html {
    scroll-behavior: smooth;
    scroll-padding-top: 2rem;
}

/* Selection */
::selection {
    background: var(--primary);
    color: white;
}

/* ==================
   TYPOGRAPHY
   ================== */

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-display);
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: var(--spacing-sm);
    color: var(--text-primary);
}

h1 {
    font-size: clamp(2rem, 5vw, 3.5rem);
    font-weight: 900;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: fadeInUp 0.6s ease-out;
}

h2 {
    font-size: clamp(1.5rem, 3vw, 2rem);
    color: var(--primary);
}

h3 {
    font-size: clamp(1.25rem, 2.5vw, 1.75rem);
    color: var(--primary-dark);
}

p {
    margin-bottom: var(--spacing-sm);
    color: var(--text-secondary);
    font-size: 1.05rem;
}

/* ==================
   BANNER
   ================== */

header.banner {
    position: relative;
    width: 100%;
    height: 250px;
    overflow: hidden;
    background: linear-gradient(135deg, #f5e6d3 0%, #e8d5c4 100%);
}

header.banner img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--transition-slow);
}

header.banner:hover img {
    transform: scale(1.05);
}

header.banner::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 100px;
    background: linear-gradient(to bottom, transparent, var(--background));
    pointer-events: none;
}

/* ==================
   SIDEBAR
   ================== */

aside#sidebar {
    background: linear-gradient(to bottom, #f9f6f2, #f4f0eb);
    border-right: 2px solid var(--border);
    padding: var(--spacing-lg);
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--primary) transparent;
}

aside#sidebar::-webkit-scrollbar {
    width: 6px;
}

aside#sidebar::-webkit-scrollbar-track {
    background: transparent;
}

aside#sidebar::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 3px;
}

aside#sidebar h2 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: var(--spacing-md);
    padding-bottom: var(--spacing-sm);
    border-bottom: 3px solid var(--primary);
    letter-spacing: 0.05em;
    text-transform: uppercase;
    font-family: var(--font-body);
}

aside#sidebar nav ul {
    list-style: none;
}

aside#sidebar nav a {
    display: block;
    padding: var(--spacing-xs) var(--spacing-sm);
    margin-bottom: 0.25rem;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--radius-sm);
    transition: all var(--transition-base);
    font-weight: 500;
    position: relative;
    overflow: hidden;
}

aside#sidebar nav a::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 3px;
    background: var(--primary);
    transform: scaleY(0);
    transition: transform var(--transition-base);
}

aside#sidebar nav a:hover {
    background: var(--surface-hover);
    color: var(--primary);
    transform: translateX(4px);
}

aside#sidebar nav a:hover::before {
    transform: scaleY(1);
}

.sidebar-link.active {
    background: linear-gradient(to right, var(--primary-light), transparent);
    color: var(--primary-dark);
    font-weight: 600;
}

.sidebar-link.active::before {
    transform: scaleY(1);
}

aside#sidebar hr {
    margin: var(--spacing-md) 0;
    border: none;
    height: 1px;
    background: linear-gradient(to right, transparent, var(--border), transparent);
}

/* ==================
   MAIN CONTENT
   ================== */

main {
    padding: var(--spacing-xl);
    max-width: 1200px;
    animation: fadeIn 0.5s ease-out;
}

main header {
    margin-bottom: var(--spacing-xl);
    animation: fadeInUp 0.6s ease-out;
}

main header p {
    font-size: 1.15rem;
    color: var(--text-muted);
    margin-top: var(--spacing-sm);
}

/* ==================
   SECTIONS & CARDS
   ================== */

.topic-section {
    background: var(--surface);
    padding: var(--spacing-lg);
    margin-bottom: var(--spacing-lg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    transition: all var(--transition-base);
    border: 1px solid var(--border);
    position: relative;
    overflow: hidden;
}

.topic-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(to right, var(--primary), var(--accent));
    transform: scaleX(0);
    transform-origin: left;
    transition: transform var(--transition-slow);
}

.topic-section:hover::before {
    transform: scaleX(1);
}

.topic-section:hover {
    box-shadow: var(--shadow-hover);
    transform: translateY(-2px);
}

.topic-section h3 {
    position: relative;
    padding-bottom: var(--spacing-sm);
    margin-bottom: var(--spacing-md);
}

.topic-section h3::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 60px;
    height: 3px;
    background: var(--primary);
    border-radius: 2px;
}

/* Card Styling */
.card {
    background: linear-gradient(to bottom, #fefefe, #fafafa);
    border-radius: var(--radius-md);
    padding: var(--spacing-md);
    margin-top: var(--spacing-md);
    border: 1px solid rgba(191, 146, 112, 0.1);
    transition: all var(--transition-base);
}

.card:hover {
    box-shadow: var(--shadow-sm);
}

/* ==================
   CODE BLOCKS
   ================== */

pre, code {
    font-family: var(--font-mono);
    font-size: 0.9rem;
}

.code-editor {
    background: linear-gradient(135deg, #1e1e1e 0%, #2d2d2d 100%);
    color: #d4d4d4;
    border: 2px solid #3a3a3a;
    border-radius: var(--radius-md);
    padding: var(--spacing-md);
    overflow-x: auto;
    line-height: 1.6;
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.3);
    position: relative;
}

.code-editor::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 30px;
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0.05), transparent);
    border-radius: var(--radius-md) var(--radius-md) 0 0;
    pointer-events: none;
}

.code-editor::-webkit-scrollbar {
    height: 8px;
}

.code-editor::-webkit-scrollbar-track {
    background: #1e1e1e;
}

.code-editor::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 4px;
}

/* Preview Pane */
.preview-pane {
    background: white;
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    padding: var(--spacing-md);
    min-height: 200px;
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.05);
    position: relative;
    overflow: auto;
}

.preview-pane::before {
    content: 'Preview';
    position: absolute;
    top: 0;
    right: 0;
    background: var(--primary);
    color: white;
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-bottom-left-radius: var(--radius-sm);
    letter-spacing: 0.05em;
}

/* ==================
   LISTS & TABLES
   ================== */

ul, ol {
    margin-bottom: var(--spacing-sm);
}

li {
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin: var(--spacing-md) 0;
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

thead {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
}

th {
    padding: var(--spacing-sm) var(--spacing-md);
    text-align: left;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    font-size: 0.85rem;
}

td {
    padding: var(--spacing-sm) var(--spacing-md);
    border-bottom: 1px solid var(--border);
}

tbody tr {
    transition: background var(--transition-fast);
}

tbody tr:hover {
    background: var(--surface-hover);
}

tbody tr:last-child td {
    border-bottom: none;
}

/* ==================
   ALERT BOXES
   ================== */

.alert-box {
    padding: var(--spacing-md);
    border-radius: var(--radius-md);
    margin: var(--spacing-md) 0;
    border-left: 4px solid;
    display: flex;
    align-items: start;
    gap: var(--spacing-sm);
    animation: slideInLeft 0.4s ease-out;
}

.alert-box.info {
    background: linear-gradient(to right, #e3f2fd, #f5f9ff);
    border-left-color: #2196f3;
    color: #1565c0;
}

.alert-box.warning {
    background: linear-gradient(to right, #fff3e0, #fffaf5);
    border-left-color: #ff9800;
    color: #e65100;
}

.alert-box.success {
    background: linear-gradient(to right, #e8f5e9, #f5fdf5);
    border-left-color: #4caf50;
    color: #2e7d32;
}

.alert-box.danger {
    background: linear-gradient(to right, #ffebee, #fff5f5);
    border-left-color: #f44336;
    color: #c62828;
}

/* ==================
   FOOTER
   ================== */

footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, var(--secondary), #3a3a3a);
    color: white;
    text-align: center;
    padding: var(--spacing-sm);
    font-size: 0.9rem;
    z-index: 1000;
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.1);
}

footer p {
    margin: 0;
    color: rgba(255, 255, 255, 0.9);
}

/* ==================
   ANIMATIONS
   ================== */

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.8;
    }
}

/* ==================
   RESPONSIVE
   ================== */

@media (max-width: 768px) {
    :root {
        --spacing-xl: 2rem;
        --spacing-lg: 1.5rem;
    }
    
    aside#sidebar {
        position: relative;
        height: auto;
        border-right: none;
        border-bottom: 2px solid var(--border);
    }
    
    main {
        padding: var(--spacing-md);
    }
    
    .topic-section {
        padding: var(--spacing-md);
    }
    
    table {
        font-size: 0.9rem;
    }
    
    th, td {
        padding: var(--spacing-xs) var(--spacing-sm);
    }
}

/* ==================
   UTILITY CLASSES
   ================== */

.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.mb-4 { margin-bottom: var(--spacing-md); }
.mt-4 { margin-top: var(--spacing-md); }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }

/* Grid Utilities */
.grid-2 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: var(--spacing-md);
}

/* Highlight Box */
.highlight-box {
    background: linear-gradient(135deg, var(--primary-light), var(--primary));
    color: white;
    padding: var(--spacing-md);
    border-radius: var(--radius-md);
    margin: var(--spacing-md) 0;
}

/* Badge */
.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background: var(--primary);
    color: white;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.05em;
}
