/* ============================================
   HTV24-STYLE GLOBAL STYLESHEET
   Modern Dark/Light Theme for Lernzettel
   ============================================ */

/* GLOBAL BOX SIZING AND OVERFLOW FIX */
*, *::before, *::after {
    box-sizing: border-box;
}

html {
    overflow-x: hidden;
}

body {
    overflow-x: hidden;
    max-width: 100vw;
}

/* CSS Variables for easy customization - Dark Mode (default) */
:root {
    --bg-primary: #0a0a0f;
    --bg-secondary: #12121a;
    --bg-card: #1a1a24;
    --bg-card-hover: #22222e;
    --text-primary: #ffffff;
    --text-secondary: #a0a0b0;
    --text-muted: #6b6b7b;
    --accent-primary: #00b4d8;
    --accent-secondary: #0077b6;
    --accent-gradient: linear-gradient(135deg, #00b4d8 0%, #0077b6 100%);
    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;
    --border-color: #2a2a3a;
    --border-radius: 12px;
    --border-radius-sm: 8px;
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5);
    --transition: all 0.3s ease;
    --nav-bg: rgba(10, 10, 15, 0.95);
    --code-bg: #1e1e2e;
    --table-header-bg: #1a1a24;
    --table-row-hover: rgba(0, 180, 216, 0.1);
}

/* Light Mode Variables */
[data-theme="light"] {
    --bg-primary: #f8fafc;
    --bg-secondary: #ffffff;
    --bg-card: #ffffff;
    --bg-card-hover: #f1f5f9;
    --text-primary: #1e293b;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --border-color: #e2e8f0;
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);
    --nav-bg: rgba(255, 255, 255, 0.95);
    --code-bg: #f1f5f9;
    --table-header-bg: #f1f5f9;
    --table-row-hover: rgba(0, 180, 216, 0.08);
}

/* Theme Toggle Button - Floating */
.theme-toggle {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--accent-gradient);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-lg);
    z-index: 9999;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.theme-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 8px 30px rgba(0, 180, 216, 0.4);
}

.theme-toggle svg {
    width: 24px;
    height: 24px;
    fill: white;
    transition: transform 0.3s ease;
}

.theme-toggle:hover svg {
    transform: rotate(15deg);
}

.theme-toggle .sun-icon {
    display: none;
}

.theme-toggle .moon-icon {
    display: block;
}

[data-theme="light"] .theme-toggle .sun-icon {
    display: block;
}

[data-theme="light"] .theme-toggle .moon-icon {
    display: none;
}

/* Light mode specific adjustments */
[data-theme="light"] .card {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

[data-theme="light"] .card:hover {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

[data-theme="light"] h1 .gradient-text,
[data-theme="light"] .hero h1 .text {
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

[data-theme="light"] .info-box {
    border-color: rgba(0, 180, 216, 0.3);
}

/* Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    overflow-x: hidden;
}

body {
    font-family: 'Inter', 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.7;
    min-height: 100vh;
    overflow-x: hidden;
    width: 100%;
    max-width: 100vw;
}

/* MathJax Responsive - Prevent overflow on mobile only */
@media (max-width: 768px) {
    body {
        overflow-x: hidden;
    }
    
    .MathJax, 
    .MathJax_Display,
    mjx-container,
    mjx-math {
        max-width: 100% !important;
        overflow-x: auto !important;
        overflow-y: hidden !important;
    }

    mjx-container[jax="CHTML"][display="true"] {
        overflow-x: auto !important;
        overflow-y: hidden !important;
        max-width: 100% !important;
        padding: 0.5rem 0;
    }

    /* Scrollbar styling for MathJax on mobile */
    mjx-container::-webkit-scrollbar {
        height: 4px;
    }

    mjx-container::-webkit-scrollbar-track {
        background: var(--bg-secondary);
        border-radius: 2px;
    }

    mjx-container::-webkit-scrollbar-thumb {
        background: var(--accent-primary);
        border-radius: 2px;
    }
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    line-height: 1.3;
    margin-bottom: 1rem;
}

h1 {
    font-size: 2.5rem;
    color: var(--text-primary);
}

/* Gradient text for titles without emojis */
h1 .gradient-text, .hero h1 .text {
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Keep emojis with their natural colors */
h1 .emoji, .hero h1 .emoji {
    -webkit-text-fill-color: initial;
    background: none;
    margin-right: 0.3rem;
}

h2 {
    font-size: 1.8rem;
    color: var(--text-primary);
    border-bottom: 2px solid var(--accent-primary);
    padding-bottom: 0.5rem;
    margin-top: 2rem;
}

h3 {
    font-size: 1.3rem;
    color: var(--accent-primary);
}

h4 {
    font-size: 1.1rem;
    color: var(--text-secondary);
}

p {
    margin-bottom: 1rem;
    color: var(--text-secondary);
}

a {
    color: var(--accent-primary);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--accent-secondary);
    text-decoration: underline;
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    overflow-x: hidden;
    width: 100%;
}

/* Professional Navigation Header */
nav {
    background: var(--nav-bg);
    border-bottom: 1px solid var(--border-color);
    padding: 0;
    position: sticky;
    top: 0;
    z-index: 1000;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

nav .nav-container {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    height: 70px;
}

nav .nav-logo {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--text-primary);
    flex-shrink: 0;
    width: auto;
    max-width: max-content;
}

nav .nav-logo .logo-icon {
    width: 36px;
    height: 36px;
    background: var(--accent-gradient);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

nav .nav-logo:hover {
    text-decoration: none;
    opacity: 0.9;
}

/* Hamburger Menu Button */
nav .nav-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    z-index: 1001;
}

nav .nav-toggle span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--text-primary);
    margin: 5px 0;
    transition: var(--transition);
    border-radius: 2px;
}

nav .nav-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

nav .nav-toggle.active span:nth-child(2) {
    opacity: 0;
}

nav .nav-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

nav ul {
    list-style: none;
    display: flex;
    gap: 0.5rem;
    align-items: center;
    margin: 0;
    padding: 0;
}

nav ul li {
    margin: 0;
}

nav a {
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.9rem;
    padding: 0.6rem 1rem;
    border-radius: 6px;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    text-decoration: none;
    white-space: nowrap;
}

nav a:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
    text-decoration: none;
}

nav a.active {
    color: var(--accent-primary);
    background: rgba(0, 180, 216, 0.1);
}

nav .nav-cta {
    background: var(--accent-gradient);
    color: white !important;
    padding: 0.6rem 1.25rem;
    border-radius: 6px;
    font-weight: 600;
}

nav .nav-cta:hover {
    opacity: 0.9;
    background: var(--accent-gradient);
    transform: translateY(-1px);
}

/* Tablet Navigation */
@media (max-width: 900px) {
    nav .nav-container {
        padding: 0 1.5rem;
        height: 60px;
    }
    
    nav ul {
        gap: 0.25rem;
    }
    
    nav a {
        padding: 0.5rem 0.6rem;
        font-size: 0.8rem;
    }
    
    nav .nav-cta {
        padding: 0.5rem 0.8rem;
    }
}

/* Mobile Navigation */
@media (max-width: 700px) {
    nav .nav-logo {
        font-size: 0.9rem;
        gap: 0.4rem;
        padding: 0.25rem 0.5rem;
        margin-left: -0.5rem;
        width: auto;
        max-width: fit-content;
        position: relative;
        z-index: 1003;
    }
    
    nav .nav-logo .logo-icon {
        width: 28px;
        height: 28px;
        font-size: 1rem;
    }
    
    nav .nav-logo span:not(.logo-icon) {
        font-size: 0.85rem;
    }
    
    nav .nav-toggle {
        display: block;
        position: absolute;
        right: 1rem;
        top: 50%;
        transform: translateY(-50%);
    }
    
    nav .nav-container {
        height: 60px;
        position: relative;
        padding: 0 1rem;
        justify-content: flex-start;
        gap: 0;
    }
    
    nav ul {
        position: fixed;
        top: 60px;
        left: 0;
        right: 0;
        background: rgba(10, 10, 15, 0.98);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        flex-direction: column;
        padding: 1rem;
        gap: 0.5rem;
        border-bottom: 1px solid var(--border-color);
        transform: translateY(-150%);
        opacity: 0;
        transition: transform 0.3s ease, opacity 0.3s ease;
        z-index: 999;
    }
    
    nav ul.nav-open {
        transform: translateY(0);
        opacity: 1;
    }
    
    nav ul li {
        width: 100%;
    }
    
    nav a {
        width: 100%;
        justify-content: center;
        padding: 0.9rem 1rem;
        font-size: 1rem;
        border-radius: 8px;
    }
    
    nav .nav-cta {
        margin-top: 0.5rem;
    }
}

/* Very Small Mobile */
@media (max-width: 400px) {
    nav .nav-logo {
        font-size: 0.8rem;
        gap: 0.3rem;
        padding: 0.2rem 0.4rem;
    }
    
    nav .nav-logo .logo-icon {
        width: 24px;
        height: 24px;
        font-size: 0.9rem;
    }
    
    nav .nav-logo span:not(.logo-icon) {
        font-size: 0.75rem;
    }
    
    nav .nav-container {
        padding: 0 0.75rem;
    }
    
    nav .nav-toggle {
        right: 0.75rem;
        padding: 0.75rem;
    }
    
    nav .nav-logo .logo-icon {
        width: 32px;
        height: 32px;
        font-size: 1rem;
    }
}

/* Hero Section */
.hero {
    text-align: center;
    padding: 4rem 2rem;
    background: linear-gradient(180deg, var(--bg-secondary) 0%, var(--bg-primary) 100%);
    border-bottom: 1px solid var(--border-color);
}

.hero h1 {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.hero p {
    font-size: 1.2rem;
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto;
}

/* Cards Grid */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--accent-gradient);
    transform: scaleX(0);
    transition: var(--transition);
}

.card:hover {
    background: var(--bg-card-hover);
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.card:hover::before {
    transform: scaleX(1);
}

.card-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.card h3 {
    margin-bottom: 0.5rem;
}

.card p {
    font-size: 0.95rem;
    color: var(--text-muted);
}

.card a {
    display: inline-block;
    margin-top: 1rem;
    padding: 0.5rem 1rem;
    background: var(--accent-gradient);
    color: white;
    border-radius: var(--border-radius-sm);
    font-weight: 500;
}

.card a:hover {
    opacity: 0.9;
    text-decoration: none;
    transform: translateX(5px);
}

/* Content Sections */
.content-section {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 2rem;
    margin: 2rem 0;
}

/* Info Boxes */
.info-box {
    background: var(--bg-secondary);
    border-left: 4px solid var(--accent-primary);
    border-radius: var(--border-radius-sm);
    padding: 1.5rem;
    margin: 1.5rem 0;
}

.info-box h3, .info-box h4 {
    color: var(--accent-primary);
    margin-bottom: 0.5rem;
}

.info-box.important {
    border-left-color: var(--warning);
    background: rgba(245, 158, 11, 0.1);
}

.info-box.important h3, .info-box.important h4 {
    color: var(--warning);
}

.info-box.success {
    border-left-color: var(--success);
    background: rgba(16, 185, 129, 0.1);
}

.info-box.error {
    border-left-color: var(--error);
    background: rgba(239, 68, 68, 0.1);
}

/* Formula Box */
.formula-box {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 2rem;
    margin: 1.5rem 0;
    text-align: center;
}

.formula-box p {
    color: var(--text-primary);
    font-size: 1.1rem;
}

.formula-box ul {
    text-align: left;
    margin-top: 1rem;
}

/* Solution Box */
.solution {
    background: linear-gradient(135deg, rgba(0, 180, 216, 0.1) 0%, rgba(0, 119, 182, 0.1) 100%);
    border: 1px solid var(--accent-primary);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    margin: 1rem 0;
}

.solution p {
    color: var(--text-primary);
}

/* Lists */
ul, ol {
    margin: 1rem 0;
    padding-left: 1.5rem;
}

li {
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
}

li::marker {
    color: var(--accent-primary);
}

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
    background: var(--bg-card);
    border-radius: var(--border-radius);
    overflow: hidden;
}

th, td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

th {
    background: var(--bg-secondary);
    color: var(--accent-primary);
    font-weight: 600;
}

tr:hover {
    background: var(--bg-card-hover);
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    background: var(--accent-gradient);
    color: white;
    border: none;
    border-radius: var(--border-radius-sm);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.btn:hover {
    opacity: 0.9;
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    text-decoration: none;
}

.btn-secondary {
    background: transparent;
    border: 2px solid var(--accent-primary);
    color: var(--accent-primary);
}

.btn-secondary:hover {
    background: var(--accent-primary);
    color: white;
}

/* Task Box */
.task-box {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    margin: 1.5rem 0;
}

.task-box h3 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.task-box .toggle-solution {
    background: var(--accent-gradient);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    margin-top: 1rem;
    font-weight: 500;
    transition: var(--transition);
}

.task-box .toggle-solution:hover {
    opacity: 0.9;
}

.task-box .solution-content {
    display: none;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.task-box .solution-content.show {
    display: block;
}

/* Back Link */
.back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
    padding: 0.5rem 1rem;
    background: var(--bg-card);
    border-radius: var(--border-radius-sm);
    transition: var(--transition);
}

.back-link:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
    text-decoration: none;
}

/* Footer */
footer {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    padding: 2rem;
    text-align: center;
    margin-top: 4rem;
}

footer p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background: var(--accent-gradient);
    color: white;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}

.badge-outline {
    background: transparent;
    border: 1px solid var(--accent-primary);
    color: var(--accent-primary);
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin: 2rem 0;
}

.stat-item {
    text-align: center;
    padding: 1.5rem;
    background: var(--bg-card);
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
}

.stat-number {
    font-size: 2rem;
    font-weight: 700;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.stat-label {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent-primary);
}

/* Responsive */
@media (max-width: 768px) {
    h1 { font-size: 2rem; }
    h2 { font-size: 1.5rem; }
    
    .hero h1 { font-size: 2rem; }
    .hero { padding: 2rem 1rem; }
    
    .container { 
        padding: 1rem; 
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
    }
    
    main {
        max-width: 100%;
        overflow-x: hidden;
    }
    
    .cards-grid {
        grid-template-columns: 1fr;
    }
    
    /* GLOBAL: Prevent any element from causing horizontal overflow */
    img, video, iframe {
        max-width: 100%;
        height: auto;
    }
    
    /* GLOBAL: Make tables, code blocks, and pre elements scroll horizontally */
    table, pre, .code-block, .struktogramm, .uml-diagram, .binary-display {
        max-width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        display: block;
    }
    
    /* Ensure code doesn't break out of containers */
    code {
        word-break: break-word;
    }
    
    pre code {
        word-break: normal;
        white-space: pre;
    }
}

/* MathJax Styling */
.MathJax {
    color: var(--text-primary) !important;
}

/* Code blocks */
code {
    background: var(--bg-secondary);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-family: 'Fira Code', 'Consolas', monospace;
    color: var(--accent-primary);
}

pre {
    background: var(--bg-secondary);
    padding: 1rem;
    border-radius: var(--border-radius-sm);
    overflow-x: auto;
    border: 1px solid var(--border-color);
}

/* Subject-specific accent colors */
.chemie { --accent-primary: #10b981; --accent-secondary: #059669; }
.mathe { --accent-primary: #8b5cf6; --accent-secondary: #7c3aed; }
.physik { --accent-primary: #00b4d8; --accent-secondary: #0077b6; }
.politik { --accent-primary: #f59e0b; --accent-secondary: #d97706; }

/* Search Bar Styles */
.search-wrapper {
    position: relative;
    margin-right: 1rem;
    display: flex;
    align-items: center;
}

.search-input-container {
    position: relative;
    display: flex;
    align-items: center;
}

#searchInput {
    padding: 0.5rem 2rem 0.5rem 2rem;
    border-radius: 20px;
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    width: 200px;
    transition: all 0.3s ease;
}

#searchInput:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.2);
    width: 250px;
}

.search-icon {
    position: absolute;
    left: 10px;
    font-size: 0.9rem;
    opacity: 0.6;
    pointer-events: none;
}

.search-close {
    position: absolute;
    right: 10px;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 1.2rem;
    padding: 0;
    line-height: 1;
}

.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    margin-top: 8px;
    max-height: 400px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
    width: 300px;
}

.search-result-item {
    display: block;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
    text-decoration: none;
    color: var(--text-primary);
    transition: background 0.2s;
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-item:hover {
    background: var(--bg-secondary);
}

.search-result-title {
    font-weight: 600;
    color: var(--accent-primary);
    margin-bottom: 0.25rem;
    font-size: 0.9rem;
}

.search-result-snippet {
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

.search-match {
    background-color: rgba(139, 92, 246, 0.2);
    color: var(--accent-primary);
    font-weight: 600;
    border-radius: 2px;
}

.search-loading, .search-no-results {
    padding: 1rem;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Highlighted term on page */
.highlighted-term {
    background-color: #fef08a; /* Yellow highlight */
    color: #854d0e;
    padding: 0 2px;
    border-radius: 2px;
    animation: pulse-highlight 2s infinite;
}

@keyframes pulse-highlight {
    0% { background-color: #fef08a; }
    50% { background-color: #fde047; }
    100% { background-color: #fef08a; }
}

/* Responsive adjustments for search */
@media (max-width: 900px) {
    .search-wrapper {
        margin-right: 0.5rem;
    }
    
    #searchInput {
        width: 150px;
        font-size: 0.85rem;
        padding: 0.4rem 1.8rem;
    }
    
    #searchInput:focus {
        width: 180px;
    }
    
    .search-icon {
        font-size: 0.8rem;
        left: 8px;
    }
    
    .search-close {
        right: 8px;
        font-size: 1rem;
    }
}

@media (max-width: 700px) {
    nav .nav-logo {
        position: relative;
        z-index: 1003;
    }
    
    .search-wrapper {
        position: absolute;
        right: 60px;
        left: auto;
        transform: none;
        margin: 0;
        z-index: 1002;
    }
    
    #searchInput {
        width: 110px;
        font-size: 16px; /* Prevents zoom on iOS */
        padding: 0.5rem 1.8rem 0.5rem 2rem;
        height: 38px;
    }
    
    #searchInput:focus {
        width: 140px;
    }
    
    .search-results {
        position: fixed;
        left: 1rem;
        right: 1rem;
        top: 65px;
        width: auto;
        max-width: calc(100vw - 2rem);
        max-height: 60vh;
    }
    
    .search-result-item {
        padding: 1rem;
    }
    
    .search-result-title {
        font-size: 1rem;
    }
    
    .search-result-snippet {
        font-size: 0.9rem;
    }
}

@media (max-width: 400px) {
    .search-wrapper {
        left: auto;
        right: 50px;
        transform: none;
    }
    
    #searchInput {
        width: 120px;
    }
    
    #searchInput:focus {
        width: 150px;
    }
}
