/* CSS Custom Properties (Variables) */
:root {
    /* Primary Colors */
    --primary-blue: #4f46e5;
    --primary-blue-dark: #3730a3;
    --primary-blue-light: #6366f1;
    --secondary-purple: #7c3aed;
    --secondary-purple-dark: #5b21b6;
    
    /* Neutral Colors */
    --white: #ffffff;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    
    /* Background Colors */
    --bg-primary: var(--white);
    --bg-secondary: var(--gray-50);
    --bg-tertiary: var(--gray-100);
    
    /* Text Colors */
    --text-primary: var(--gray-900);
    --text-secondary: var(--gray-700);
    --text-tertiary: var(--gray-600);
    --text-muted: var(--gray-500);
    --text-inverse: var(--white);
    
    /* Border Colors */
    --border-light: var(--gray-200);
    --border-medium: var(--gray-300);
    --border-dark: var(--gray-400);
    
    /* Status Colors */
    --success-bg: #dcfce7;
    --success-border: #16a34a;
    --success-text: #15803d;
    --warning-bg: #fef3c7;
    --warning-border: #f59e0b;
    --warning-text: #d97706;
    --error-bg: #fee2e2;
    --error-border: #dc2626;
    --error-text: #b91c1c;
    --info-bg: #dbeafe;
    --info-border: var(--primary-blue);
    --info-text: var(--primary-blue-dark);
    
    /* Shadow Colors */
    --shadow-light: rgba(0, 0, 0, 0.05);
    --shadow-medium: rgba(0, 0, 0, 0.1);
    --shadow-dark: rgba(0, 0, 0, 0.15);
    
    /* Highlight Colors */
    --highlight-bg: #1e40af;
    --highlight-border: #3b82f6;
    --highlight-text: #ffffff;
    
    /* Interactive Colors */
    --hover-bg: var(--gray-50);
    --hover-text: var(--primary-blue);
    --active-bg: var(--primary-blue);
    --active-text: var(--white);
    
    /* Dark Mode Colors */
    --dark-bg-primary: #0f172a;
    --dark-bg-secondary: #1e293b;
    --dark-bg-tertiary: #334155;
    --dark-text-primary: #f1f5f9;
    --dark-text-secondary: #cbd5e1;
    --dark-text-tertiary: #94a3b8;
    --dark-border: #475569;
    
    /* Media Layout Variables */
    --media-aspect-ratio: 4/3;
    --media-max-width: 100%;
    --media-desktop-width: 400px;
    --media-mobile-width: 100%;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--bg-secondary);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
.header {
    background: linear-gradient(135deg, var(--primary-blue) 0%, var(--secondary-purple) 100%);
    color: var(--text-inverse);
    padding: 1.5rem 0;
    text-align: center;
    box-shadow: 0 2px 10px var(--shadow-medium);
}

.logo {
    font-size: 2rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
    color: var(--text-inverse);
}

.tagline {
    font-size: 1rem;
    opacity: 0.9;
    font-weight: 400;
    color: var(--text-inverse);
}

/* Search Container */
.search-container {
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-light);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

#search-input {
    width: 100%;
    max-width: 500px;
    padding: 12px 20px;
    border: 2px solid var(--border-medium);
    border-radius: 25px;
    font-size: 16px;
    outline: none;
    transition: border-color 0.3s ease;
    background: var(--bg-primary);
    color: var(--text-primary);
}

#search-input:focus {
    border-color: var(--primary-blue);
}

.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-primary);
    border: 1px solid var(--border-medium);
    border-radius: 8px;
    box-shadow: 0 4px 20px var(--shadow-medium);
    max-height: 300px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
}

.search-result-item {
    padding: 12px 20px;
    border-bottom: 1px solid var(--border-light);
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.search-result-item:hover {
    background-color: var(--hover-bg);
}

.search-result-title {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.search-result-snippet {
    font-size: 0.9rem;
    color: var(--text-tertiary);
    line-height: 1.4;
}

.search-highlight {
    background-color: var(--highlight-bg);
    padding: 2px 4px;
    border-radius: 3px;
    color: var(--highlight-text);
    font-weight: 500;
}

/* Main Layout */
.main-wrapper {
    display: flex;
    min-height: calc(100vh - 200px);
    gap: 2rem;
    margin: 2rem 0;
}

/* Sidebar Navigation */
.sidebar {
    width: 280px;
    background: var(--bg-primary);
    border-radius: 8px;
    padding: 1.5rem;
    height: fit-content;
    position: sticky;
    top: 120px;
    box-shadow: 0 2px 10px var(--shadow-light);
    border: 1px solid var(--border-light);
}

.nav-header h3 {
    color: var(--text-primary);
    margin-bottom: 1rem;
    font-size: 1.1rem;
    font-weight: 600;
}

.nav-list {
    list-style: none;
}

.nav-list > li {
    margin-bottom: 0.2rem;
}

.nav-list a {
    display: block;
    padding: 7px 12px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 6px;
    transition: all 0.2s ease;
    font-size: 0.9rem;
}

.nav-list a:hover {
    background-color: var(--hover-bg);
    color: var(--white);
}

.nav-sublist {
    list-style: none;
    margin-top: 0.5rem;
    margin-left: 1rem;
}

.nav-sublist li {
    margin-bottom: 0.15rem;
}

.nav-sublist a {
    padding: 4px 8px;
    font-size: 0.85rem;
    color: var(--text-tertiary);
}

/* Content Area */
.content {
    flex: 1;
    background: var(--bg-primary);
    border-radius: 8px;
    box-shadow: 0 2px 10px var(--shadow-light);
    border: 1px solid var(--border-light);
}

.content-inner {
    padding: 2rem;
}

/* Typography */
h1 {
    font-size: 2.2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

h2 {
    font-size: 1.8rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 2rem 0 1rem 0;
    border-bottom: 2px solid var(--border-light);
    padding-bottom: 0.5rem;
}

h3 {
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin: 1.5rem 0 0.75rem 0;
}

h4 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin: 1rem 0 0.5rem 0;
}

.lead {
    font-size: 1.15rem;
    color: var(--text-tertiary);
    margin-bottom: 2rem;
    line-height: 1.7;
}

/* Icon Styles */
.fa, .fas, .far, .fal, .fab {
    margin-right: 0.5rem;
    opacity: 0.9;
}

h2 .fa, h2 .fas, h2 .far, h2 .fal, h2 .fab,
h3 .fa, h3 .fas, h3 .far, h3 .fal, h3 .fab {
    color: var(--text-primary);
    margin-right: 0.75rem;
}

.nav-list .fa, .nav-list .fas, .nav-list .far, .nav-list .fal, .nav-list .fab {
    margin-right: 0.5rem;
    width: 16px;
    text-align: center;
    opacity: 0.8;
}

.feature-icon .fa, .feature-icon .fas, .feature-icon .far, .feature-icon .fal, .feature-icon .fab {
    font-size: 2rem;
    color: var(--text-primary);
    margin-right: 0;
}

.benefits-highlight .fa, .benefits-highlight .fas, .benefits-highlight .far, .benefits-highlight .fal, .benefits-highlight .fab {
    margin-right: 0.25rem;
    opacity: 1;
}

/* Media Placeholders */
.media-placeholder {
    background: linear-gradient(135deg, var(--bg-tertiary) 0%, var(--bg-secondary) 100%);
    border: 2px dashed var(--border-medium);
    border-radius: 8px;
    padding: 1.5rem;
    margin: 1.5rem 0;
    text-align: center;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    transition: all 0.3s ease;
    width: var(--media-max-width);
    aspect-ratio: var(--media-aspect-ratio);
    max-width: var(--media-desktop-width);
}

.media-placeholder:hover {
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-tertiary) 100%);
    border-color: var(--primary-blue);
}

.media-placeholder-icon {
    font-size: 2.5rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
    opacity: 0.6;
}

.media-placeholder-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.media-placeholder-description {
    font-size: 0.85rem;
    color: var(--text-tertiary);
    font-style: italic;
    max-width: 90%;
    line-height: 1.3;
}

.media-placeholder-small {
    max-width: 300px;
    padding: 1rem;
    margin: 1rem 0;
}

.media-placeholder-large {
    max-width: 600px;
    padding: 2rem;
    margin: 2rem 0;
}

.media-placeholder-gif {
    /* background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%); */
    border-color: var(--warning-border);
}


.media-placeholder-gif .media-placeholder-icon {
    color: var(--warning-text);
}

.media-placeholder-gif .media-placeholder-title {
    color: var(--warning-text);
}

.media-placeholder-image {
    /* background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%); */
    border-color: var(--info-border);
}


.media-placeholder-image .media-placeholder-icon {
    color: var(--info-text);
}

.media-placeholder-image .media-placeholder-title {
    color: var(--info-text);
}

.media-placeholder-video {
    /* background: linear-gradient(135deg, #dcfce7 0%, #bbf7d0 100%); */
    border-color: var(--success-border);
}

.media-placeholder-video .media-placeholder-icon {
    color: var(--success-text);
}

.media-placeholder-video .media-placeholder-title {
    color: var(--success-text);
}

/* Brush Mode Layout with Media */
.brush-mode {
    display: flex;
    gap: 2rem;
    align-items: flex-start;
    background: var(--bg-tertiary);
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    border: 1px solid var(--border-light);
}

.brush-mode-content {
    flex: 1;
    min-width: 0; /* Prevents flex item from growing beyond container */
}

.brush-mode-media {
    flex: 0 0 auto;
    width: var(--media-desktop-width);
}

.brush-mode-media .media-placeholder {
    margin: 0;
    width: 100%;
}

/* GIF styling for brush modes */
.brush-mode-gif {
    width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 4px 12px var(--shadow-medium);
    aspect-ratio: var(--media-aspect-ratio);
    object-fit: cover;
    border: 2px solid var(--border-light);
    transition: all 0.3s ease;
}

.brush-mode-gif:hover {
    box-shadow: 0 6px 20px var(--shadow-dark);
    transform: translateY(-2px);
}

/* For brush modes without media, maintain original styling */
.brush-mode:not(.brush-mode-with-media) {
    display: block;
}

/* Sections */
.section {
    margin-bottom: 3rem;
}

.subsection {
    margin-bottom: 2rem;
}

.intro {
    margin-bottom: 3rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--border-light);
}

/* Features Section */
.features-section {
    background: linear-gradient(135deg, var(--bg-tertiary) 0%, var(--bg-secondary) 100%);
    border-radius: 12px;
    padding: 2.5rem;
    margin-bottom: 3rem;
    border: 1px solid var(--border-light);
    box-shadow: 0 4px 20px var(--shadow-light);
}

.features-intro {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 2.5rem;
    text-align: center;
    line-height: 1.6;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2.5rem;
}

.feature-card {
    background: var(--bg-primary);
    border-radius: 8px;
    padding: 1.5rem;
    border: 1px solid var(--border-light);
    box-shadow: 0 2px 10px var(--shadow-light);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.feature-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px var(--shadow-medium);
}

.feature-icon {
    font-size: 2rem;
    margin-bottom: 1rem;
    text-align: center;
}

.feature-card h3 {
    color: var(--text-primary);
    margin-bottom: 0.75rem;
    font-size: 1.2rem;
    font-weight: 600;
}

.feature-card > p {
    color: var(--text-secondary);
    margin-bottom: 1rem;
    line-height: 1.5;
}

.feature-list {
    list-style: none;
    margin-left: 0;
    margin-bottom: 0;
}

.feature-list li {
    color: var(--text-tertiary);
    margin-bottom: 0.4rem;
    padding-left: 1rem;
    position: relative;
    font-size: 0.9rem;
}

.feature-list li::before {
    content: "•";
    color: var(--primary-blue);
    position: absolute;
    left: 0;
    font-weight: bold;
}

.features-cta {
    background: linear-gradient(135deg, var(--primary-blue) 0%, var(--secondary-purple) 100%);
    color: var(--text-inverse);
    padding: 2rem;
    border-radius: 8px;
    text-align: center;
    margin-top: 2rem;
}

.features-cta h3 {
    color: var(--text-inverse);
    margin-bottom: 1rem;
    font-size: 1.4rem;
}

.features-cta p {
    color: var(--text-inverse);
    margin-bottom: 1.5rem;
    opacity: 0.95;
    line-height: 1.6;
}

.benefits-highlight {
    display: flex;
    justify-content: center;
    gap: 2rem;
    flex-wrap: wrap;
}

.benefit {
    background: rgba(255, 255, 255, 0.15);
    padding: 0.5rem 1rem;
    border-radius: 25px;
    font-size: 0.9rem;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* Lists */
ul, ol {
    margin-left: 1.5rem;
    margin-bottom: 1rem;
}

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

/* Tips and Warnings */
.tip {
    background: var(--info-bg);
    border-left: 4px solid var(--info-border);
    padding: 1rem 1.5rem;
    margin: 1rem 0;
    border-radius: 0 6px 6px 0;
    color: var(--info-text);
}

.warning {
    color: var(--error-text) !important;
    font-weight: 500;
}

/* Brush Modes */
.brush-subtitle {
    color: var(--text-tertiary);
    font-style: italic;
    margin-bottom: 1rem;
}

/* Settings */
.setting-item {
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: var(--bg-tertiary);
    border-radius: 6px;
    border: 1px solid var(--border-light);
}

.setting-item h4 {
    color: var(--text-primary);
    margin-top: 0;
    margin-bottom: 0.5rem;
}

/* Shortcuts */
.shortcuts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.shortcut-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: var(--bg-tertiary);
    border-radius: 6px;
    border: 1px solid var(--border-light);
}

kbd {
    background: var(--bg-primary);
    border: 2px solid var(--border-medium);
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    box-shadow: 0 1px 2px var(--shadow-light);
    min-width: fit-content;
}

.brush-shortcuts {
    margin-bottom: 2rem;
}

.brush-shortcuts h4 {
    color: var(--primary-blue);
    margin-bottom: 1rem;
}

/* Checklists */
.checklist {
    list-style: none;
    margin-left: 0;
}

.checklist li {
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-light);
    color: var(--text-secondary);
}

.checklist li:last-child {
    border-bottom: none;
}

/* Conclusion */
.conclusion {
    background: linear-gradient(135deg, var(--bg-tertiary) 0%, var(--bg-secondary) 100%);
    padding: 2rem;
    border-radius: 8px;
    margin-top: 3rem;
    text-align: center;
    border: 1px solid var(--border-light);
}

.happy-painting {
    font-size: 1.2rem;
    margin: 1rem 0;
    color: var(--primary-blue);
}

.support-note {
    color: var(--text-tertiary);
    font-size: 0.9rem;
    margin-top: 1rem;
}

/* Footer */
.footer {
    background: var(--gray-800);
    color: var(--text-inverse);
    text-align: center;
    padding: 1.5rem 0;
    margin-top: 3rem;
}

/* Dynamic Button Styles */
.print-button {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: var(--primary-blue);
    color: var(--text-inverse);
    border: none;
    padding: 12px 20px;
    border-radius: 25px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    z-index: 1000;
}

.print-button:hover {
    background: var(--primary-blue-dark);
    transform: translateY(-2px);
}

.back-to-top-button {
    position: fixed;
    bottom: 80px;
    right: 20px;
    width: 50px;
    height: 50px;
    background: var(--gray-800);
    color: var(--text-inverse);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 4px 12px var(--shadow-dark);
    font-size: 20px;
    font-weight: bold;
    transition: all 0.3s ease;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
}

.back-to-top-button.visible {
    opacity: 1;
    visibility: visible;
}

.back-to-top-button:hover {
    background: var(--gray-700);
    transform: translateY(-2px);
}

/* Responsive Design */
@media (max-width: 1024px) {
    .main-wrapper {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        position: static;
        order: -1;
    }
    
    .nav-list {
        display: flex;
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    
    .nav-list > li {
        margin-bottom: 0;
    }
    
    .nav-sublist {
        display: none;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 0 15px;
    }
    
    .logo {
        font-size: 1.8rem;
    }
    
    .content-inner {
        padding: 1.5rem;
    }
    
    h1 {
        font-size: 1.8rem;
    }
    
    h2 {
        font-size: 1.5rem;
    }
    
    .shortcuts-grid {
        grid-template-columns: 1fr;
    }
    
    .shortcut-item {
        flex-direction: column;
        text-align: center;
        gap: 0.5rem;
    }
    
    .features-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .features-section {
        padding: 1.5rem;
    }
    
    .benefits-highlight {
        flex-direction: column;
        gap: 1rem;
    }
    
    /* Responsive Media Placeholders */
    .media-placeholder {
        max-width: 100%;
        width: var(--media-mobile-width);
    }
    
    .media-placeholder-small {
        max-width: 100%;
    }
    
    .media-placeholder-large {
        max-width: 100%;
    }
    
    /* Brush Modes Mobile Layout */
    .brush-mode {
        flex-direction: column;
        gap: 1rem;
    }
    
    .brush-mode-media {
        width: 100%;
        order: 2; /* Media goes below content on mobile */
    }
    
    .brush-mode-content {
        order: 1; /* Content goes above media on mobile */
    }
    
    /* Mobile GIF styling */
    .brush-mode-gif {
        width: 100%;
        max-width: none;
    }
}

@media (max-width: 480px) {
    .header {
        padding: 1rem 0;
    }
    
    .logo {
        font-size: 1.5rem;
    }
    
    .tagline {
        font-size: 0.9rem;
    }
    
    .content-inner {
        padding: 1rem;
    }
    
    .brush-mode, .setting-item {
        padding: 1rem;
    }
    
    .features-section {
        padding: 1rem;
    }
    
    .feature-card {
        padding: 1rem;
    }
    
    .features-cta {
        padding: 1.5rem;
    }
    
    .media-placeholder {
        padding: 1.5rem;
        min-height: 150px;
    }
    
    .media-placeholder-large {
        min-height: 200px;
        padding: 2rem;
    }
    
    .media-placeholder-icon {
        font-size: 2.5rem;
    }
}

/* Print Styles */
@media print {
    .header, .search-container, .sidebar, .footer {
        display: none;
    }
    
    .main-wrapper {
        display: block;
    }
    
    .content {
        box-shadow: none;
        border: none;
    }
    
    h2 {
        page-break-after: avoid;
    }
    
    .section {
        page-break-inside: avoid;
    }
}

/* Dark mode support (optional) */
@media (prefers-color-scheme: dark) {
    :root {
        /* Override variables for dark mode */
        --bg-primary: var(--dark-bg-secondary);
        --bg-secondary: var(--dark-bg-primary);
        --bg-tertiary: var(--dark-bg-tertiary);
        --text-primary: var(--dark-text-primary);
        --text-secondary: var(--dark-text-secondary);
        --text-tertiary: var(--dark-text-tertiary);
        --border-light: var(--dark-border);
        --border-medium: var(--dark-border);
        --border-dark: var(--dark-border);
        --hover-bg: var(--dark-bg-tertiary);
        
        /* Dark mode specific colors */
        --highlight-bg: #3b82f6;
        --highlight-text: #ffffff;
        --info-bg: #1e3a8a;
        --info-text: #bfdbfe;
        --success-bg: #14532d;
        --success-text: #bbf7d0;
        --warning-bg: #92400e;
        --warning-text: #fde68a;
        --error-bg: #7f1d1d;
        --error-text: #fecaca;
    }
}
