/* Import global HTV24-style theme */
@import url('../styles.css');

/* =============================================
   GLOBAL MOBILE OVERFLOW FIX - PREVENTS ALL ELEMENTS FROM EXTENDING BEYOND VIEWPORT
   ============================================= */
*, *::before, *::after {
    box-sizing: border-box;
}

html, body {
    max-width: 100vw;
    overflow-x: hidden;
}

.container {
    max-width: 100%;
    overflow-x: hidden;
}

main {
    max-width: 100%;
    overflow-x: hidden;
}

/* Force ALL potential overflow elements to scroll instead of overflow */
.code-block,
.struktogramm,
.uml-diagram,
.binary-display,
.truth-table,
.datatype-table,
.conversion-steps,
.concept-box,
.info-box,
.element-box,
.example-box,
.warning-box,
.memory-helper,
.aufgabe,
pre {
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* Informatik-specific accent color override - Tech Blue/Green */
:root {
    --accent-primary: #00d4aa;
    --accent-secondary: #00a884;
    --accent-gradient: linear-gradient(135deg, #00d4aa 0%, #00a884 100%);
}

/* Preserve accent colors in light mode */
[data-theme="light"] {
    --accent-primary: #00a884;
    --accent-secondary: #008f6b;
    --accent-gradient: linear-gradient(135deg, #00a884 0%, #008f6b 100%);
}

/* =============================================
   LIGHT MODE OVERRIDES FOR INFORMATIK
   ============================================= */

/* Code blocks in light mode */
[data-theme="light"] .code-block {
    background: #f8f9fc;
    border: 1px solid #e2e8f0;
}

[data-theme="light"] .code-block code {
    color: #334155;
}

/* Syntax highlighting for light mode */
[data-theme="light"] .keyword { color: #7c3aed; }
[data-theme="light"] .type { color: #b45309; }
[data-theme="light"] .string { color: #16a34a; }
[data-theme="light"] .number { color: #c2410c; }
[data-theme="light"] .comment { color: #64748b; }
[data-theme="light"] .method { color: #2563eb; }
[data-theme="light"] .variable { color: #dc2626; }
[data-theme="light"] .operator { color: #0891b2; }
[data-theme="light"] .annotation { color: #ca8a04; }

/* UML diagrams in light mode */
[data-theme="light"] .uml-diagram {
    background: #f1f5f9;
}

[data-theme="light"] .uml-class {
    background: #ffffff;
    border-color: var(--accent-primary);
}

/* Binary display light mode */
[data-theme="light"] .binary-display {
    background: #f1f5f9;
}

[data-theme="light"] .binary-display .bit {
    background: #ffffff;
}

[data-theme="light"] .binary-display .bit.one {
    background: var(--accent-primary);
    color: white;
}

[data-theme="light"] .binary-display .bit.zero {
    background: #e2e8f0;
    color: #64748b;
}

/* Truth table light mode */
[data-theme="light"] .truth-table td {
    background: #ffffff;
    color: #1e293b;
}

[data-theme="light"] .truth-table td code {
    background: rgba(0, 168, 132, 0.1);
    color: #008f6b;
}

[data-theme="light"] .truth-table tr:hover td {
    background: #f1f5f9;
}

/* Fix für Info-Box Text in Light Mode */
[data-theme="light"] .info-box p,
[data-theme="light"] .info-box li,
[data-theme="light"] .info-box td {
    color: #1e293b;
}

/* Fix für Concept-Box Text in Light Mode */
[data-theme="light"] .concept-box p,
[data-theme="light"] .definition {
    color: #1e293b;
}

/* Info boxes light mode */
[data-theme="light"] .info-box {
    background: #f8fafc;
    border-color: #e2e8f0;
}

[data-theme="light"] .info-box.theory {
    background: linear-gradient(135deg, rgba(0, 168, 132, 0.08) 0%, rgba(0, 143, 107, 0.04) 100%);
    border-left-color: var(--accent-primary);
}

/* Concept box light mode */
[data-theme="light"] .concept-box {
    background: #f8fafc;
    border-color: #e2e8f0;
}

/* Memory helper light mode */
[data-theme="light"] .memory-helper {
    background: linear-gradient(135deg, rgba(0, 168, 132, 0.1) 0%, rgba(0, 143, 107, 0.05) 100%);
}

/* Summary section light mode */
[data-theme="light"] .summary-section {
    background: linear-gradient(135deg, rgba(0, 168, 132, 0.08) 0%, rgba(0, 143, 107, 0.04) 100%);
}

/* Aufgaben (exercises) light mode */
[data-theme="light"] .aufgabe {
    background: #ffffff;
    border-color: #e2e8f0;
}

[data-theme="light"] .aufgabe details summary {
    background: #f1f5f9;
}

/* Result box light mode */
[data-theme="light"] .result-box {
    background: #f1f5f9;
    border-color: #e2e8f0;
}

/* Inline code light mode */
[data-theme="light"] code.inline,
[data-theme="light"] code:not([class]) {
    background: rgba(0, 168, 132, 0.1);
    color: #008f6b;
}

/* =============================================
   END LIGHT MODE OVERRIDES
   ============================================= */

/* Code Block Styling */
.code-block {
    background: #1e1e2e;
    border-radius: var(--border-radius);
    padding: 1.5rem;
    margin: 1.5rem 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border: 1px solid var(--border-color);
    position: relative;
    max-width: 100%;
    width: 100%;
    box-sizing: border-box;
}

.code-block::before {
    content: 'Java';
    position: absolute;
    top: 0;
    right: 0;
    background: var(--accent-gradient);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 0 var(--border-radius) 0 var(--border-radius);
    font-size: 0.75rem;
    font-weight: 600;
}

.code-block code {
    font-family: 'Fira Code', 'JetBrains Mono', 'Consolas', monospace;
    font-size: 0.9rem;
    line-height: 1.6;
    color: #e0e0e0;
    display: block;
    white-space: pre;
}

.code-block pre {
    margin: 0;
    white-space: pre;
    overflow-x: auto;
}

/* Inline Code */
code.inline {
    background: rgba(0, 212, 170, 0.15);
    color: var(--accent-primary);
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    font-family: 'Fira Code', 'Consolas', monospace;
    font-size: 0.9em;
}

/* Syntax Highlighting */
.keyword { color: #c678dd; font-weight: 600; }
.type { color: #e5c07b; }
.string { color: #98c379; }
.number { color: #d19a66; }
.comment { color: #5c6370; font-style: italic; }
.method { color: #61afef; }
.variable { color: #e06c75; }
.operator { color: #56b6c2; }
.annotation { color: #e5c07b; }

/* UML Diagram Styles */
.uml-diagram {
    background: var(--bg-secondary);
    border-radius: var(--border-radius);
    padding: 2rem;
    margin: 1.5rem 0;
    text-align: center;
    border: 1px solid var(--border-color);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
}

.uml-class {
    display: inline-block;
    background: var(--bg-card);
    border: 2px solid var(--accent-primary);
    border-radius: 8px;
    min-width: 200px;
    max-width: 100%;
    text-align: left;
    margin: 0.5rem;
    vertical-align: top;
}

.uml-class-name {
    background: var(--accent-gradient);
    color: white;
    padding: 0.75rem 1rem;
    font-weight: 700;
    text-align: center;
    border-radius: 6px 6px 0 0;
}

.uml-class-attributes,
.uml-class-methods {
    padding: 0.75rem 1rem;
    border-top: 1px solid var(--border-color);
    font-family: 'Fira Code', 'Consolas', monospace;
    font-size: 0.85rem;
}

.uml-class-attributes p,
.uml-class-methods p {
    margin: 0.25rem 0;
}

.uml-visibility {
    color: var(--accent-primary);
    font-weight: 700;
}

/* Binary/Hex Display */
.binary-display {
    font-family: 'Fira Code', 'Consolas', monospace;
    background: var(--bg-secondary);
    padding: 1rem 1.5rem;
    border-radius: var(--border-radius-sm);
    margin: 1rem 0;
    border-left: 4px solid var(--accent-primary);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
}

.binary-display .bit {
    display: inline-block;
    width: 2rem;
    text-align: center;
    padding: 0.5rem;
    margin: 0 2px;
    background: var(--bg-card);
    border-radius: 4px;
    font-weight: 600;
}

.binary-display .bit.one {
    background: var(--accent-primary);
    color: white;
}

.binary-display .bit.zero {
    background: var(--bg-card);
    color: var(--text-muted);
}

/* Truth Table */
.truth-table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
    font-family: 'Fira Code', 'Consolas', monospace;
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.truth-table thead,
.truth-table tbody {
    display: table;
    width: 100%;
    min-width: 600px; /* Force scrolling on small screens */
}

.truth-table tr {
    display: table;
    width: 100%;
    table-layout: fixed;
}

.truth-table th {
    background: var(--accent-gradient);
    color: white;
    padding: 0.75rem 1rem;
    text-align: center;
}

.truth-table td {
    padding: 0.75rem 1rem;
    text-align: center;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-card);
}

.truth-table tr:hover td {
    background: var(--bg-secondary);
}

.truth-table .true {
    color: #10b981;
    font-weight: 700;
}

.truth-table .false {
    color: #ef4444;
    font-weight: 700;
}

/* Conversion Steps */
.conversion-steps {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    margin: 1.5rem 0;
    border: 1px solid var(--border-color);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
}

.conversion-steps h4 {
    color: var(--accent-primary);
    margin-top: 0;
}

.conversion-step {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 0.75rem 0;
    border-bottom: 1px dashed var(--border-color);
}

.conversion-step:last-child {
    border-bottom: none;
}

.conversion-step-num {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 28px;
    background: var(--accent-gradient);
    color: white;
    border-radius: 50%;
    font-weight: 700;
    font-size: 0.85rem;
}

.conversion-step-content {
    flex: 1;
}

/* Concept Box */
.concept-box {
    background: linear-gradient(135deg, rgba(0, 212, 170, 0.1) 0%, rgba(0, 168, 132, 0.05) 100%);
    border: 2px solid var(--accent-primary);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    margin: 1.5rem 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.concept-box h3 {
    color: var(--accent-primary);
    margin-top: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.concept-box .definition {
    background: var(--bg-card);
    padding: 1rem;
    border-radius: var(--border-radius-sm);
    margin: 1rem 0;
    border-left: 4px solid var(--accent-primary);
    font-style: italic;
}

/* Memory Helper / Merkspruch */
.memory-helper {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.15) 0%, rgba(217, 119, 6, 0.08) 100%);
    border: 1px solid #f59e0b;
    border-radius: var(--border-radius);
    padding: 1rem 1.5rem;
    margin: 1.5rem 0;
}

.memory-helper::before {
    content: '💡 Merkhilfe';
    display: block;
    color: #f59e0b;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

/* Warning Box */
.warning-box {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.1) 0%, rgba(220, 38, 38, 0.05) 100%);
    border-left: 4px solid #ef4444;
    border-radius: var(--border-radius);
    padding: 1.25rem;
    margin: 1.5rem 0;
}

.warning-box::before {
    content: '⚠️ Wichtig';
    display: block;
    color: #ef4444;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

/* Example Box */
.example-box {
    background: var(--bg-secondary);
    border-radius: var(--border-radius);
    padding: 1.25rem;
    margin: 1rem 0;
    border: 1px solid var(--border-color);
}

.example-box h4 {
    color: var(--accent-primary);
    margin-top: 0;
}

/* Info Box Types */
.info-box {
    background: var(--bg-secondary);
    border-radius: var(--border-radius);
    padding: 1.25rem;
    margin: 1.5rem 0;
    border-left: 4px solid var(--accent-primary);
}

.info-box h3 {
    color: var(--accent-primary);
    margin-top: 0;
}

.info-box.important {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.1) 0%, rgba(220, 38, 38, 0.05) 100%);
    border-left-color: #ef4444;
}

.info-box.important h3 {
    color: #ef4444;
}

.info-box.theory {
    background: linear-gradient(135deg, rgba(0, 212, 170, 0.08) 0%, rgba(0, 168, 132, 0.03) 100%);
    border-left-color: var(--accent-primary);
}

/* OOP Säulen */
.oop-pillars {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
    margin: 2rem 0;
}

.oop-pillar {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    text-align: center;
    border: 2px solid transparent;
    transition: all 0.3s ease;
}

.oop-pillar:hover {
    border-color: var(--accent-primary);
    transform: translateY(-5px);
}

.oop-pillar-icon {
    font-size: 2.5rem;
    margin-bottom: 0.75rem;
}

.oop-pillar h4 {
    color: var(--accent-primary);
    margin: 0.5rem 0;
}

/* Data Type Table */
.datatype-table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
    display: block;
    overflow-x: auto; {
    display: table;
    width: 100%;
    min-width: 600px; /* Force scrolling */
}

    -webkit-overflow-scrolling: touch;
}

.datatype-table thead,
.datatype-table tbody,
.datatype-table tr {
    display: table;
    width: 100%;
    table-layout: fixed;
}

.datatype-table th {
    background: var(--accent-gradient);
    color: white;
    padding: 0.85rem 1rem;
    text-align: left;
}

.datatype-table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-card);
}

.datatype-table tr:hover td {
    background: var(--bg-secondary);
}

.datatype-table code {
    background: rgba(0, 212, 170, 0.15);
    color: var(--accent-primary);
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    font-family: 'Fira Code', 'Consolas', monospace;
}

/* Collapsible Solution */
details.loesung {
    margin-top: 1rem;
}

details.loesung summary {
    background: var(--accent-gradient);
    color: white;
    padding: 0.6rem 1.2rem;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    font-weight: 600;
    list-style: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
}

details.loesung summary::-webkit-details-marker {
    display: none;
}

details.loesung summary:hover {
    transform: scale(1.02);
}

details.loesung summary::before {
    content: '👁️';
}

details.loesung[open] summary::before {
    content: '✅';
}

details.loesung .loesung-content {
    background: var(--bg-secondary);
    border: 1px solid var(--accent-primary);
    border-radius: var(--border-radius-sm);
    padding: 1.25rem;
    margin-top: 0.75rem;
}

/* Step List */
.step-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin: 1.5rem 0;
}

.step-item {
    display: flex;
    gap: 1rem;
    padding: 1.25rem;
    background: var(--bg-secondary);
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

.step-item:hover {
    border-color: var(--accent-primary);
    transform: translateX(5px);
    box-shadow: 0 4px 15px rgba(0, 212, 170, 0.15);
}

.step-number {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    background: var(--accent-gradient);
    color: white;
    border-radius: 50%;
    font-weight: 700;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.step-content h4 {
    color: var(--accent-primary);
    margin: 0 0 0.5rem 0;
    font-size: 1.05rem;
}

.step-content p, .step-content ul {
    margin: 0.25rem 0;
    color: var(--text-secondary);
}

/* Result Box */
.result-box {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    padding: 1rem 1.5rem;
    border-radius: var(--border-radius-sm);
    margin-top: 1rem;
    font-size: 1.05rem;
}

/* Cards Grid */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin: 1.5rem 0;
}

/* Summary Section */
.summary-section {
    background: linear-gradient(135deg, rgba(0, 212, 170, 0.1) 0%, rgba(0, 168, 132, 0.05) 100%);
    border: 2px solid var(--accent-primary);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    margin: 2rem 0;
}

.summary-section h3 {
    color: var(--accent-primary);
    margin-top: 0;
}

.summary-section ul {
    margin: 0;
    padding-left: 1.5rem;
}

.summary-section li {
    margin: 0.5rem 0;
}

/* Visual Divider */
.divider {
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--accent-primary), transparent);
    margin: 3rem 0;
    border: none;
}

/* Search Bar */
.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(0, 212, 170, 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(0, 212, 170, 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;
    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; }
}

/* =============================================
   GLOBAL MOBILE OVERFLOW PREVENTION
   ============================================= */

/* Prevent any element from exceeding viewport width */
*, *::before, *::after {
    max-width: 100%;
    box-sizing: border-box;
}

/* Base overflow prevention */
html, body {
    overflow-x: hidden;
    width: 100%;
}

.container {
    overflow-x: hidden;
    max-width: 100%;
}

/* All code elements should handle overflow */
pre, code {
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* All tables should be scrollable */
table {
    display: block;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* Scrollbar styling for overflow elements */
*::-webkit-scrollbar {
    height: 6px;
    width: 6px;
}

*::-webkit-scrollbar-track {
    background: var(--bg-secondary);
    border-radius: 3px;
}

*::-webkit-scrollbar-thumb {
    background: var(--accent-primary);
    border-radius: 3px;
}

*::-webkit-scrollbar-thumb:hover {
    background: var(--accent-secondary);
}

/* =============================================
   END GLOBAL MOBILE OVERFLOW PREVENTION
   ============================================= */

/* Responsive adjustments */
@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: 768px) {
    .code-block {
        padding: 1rem;
        font-size: 0.85rem;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .uml-class {
        min-width: 150px;
    }
    
    .oop-pillars {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .truth-table {
        font-size: 0.85rem;
    }
    
    .truth-table th, .truth-table td {
        padding: 0.5rem;
    }
    
    /* Mobile-specific code block adjustments - keep code scrollable, not wrapping */
    .code-block pre {
        white-space: pre;
        overflow-x: visible;
        width: max-content;
        min-width: 100%;
    }
    
    .code-block code {
        white-space: pre;
        overflow-x: visible;
    }
    
    /* Mobile table scrolling */
    .datatype-table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    /* Conversion steps mobile */
    .conversion-step {
        flex-direction: column;
        align-items: flex-start;
    }
    
    /* Step list mobile */
    .step-item {
        flex-direction: column;
        align-items: flex-start;
    }
    
    /* Binary display mobile */
    .binary-display .bit {
        width: 1.5rem;
        padding: 0.3rem;
        font-size: 0.85rem;
    }
}

@media (max-width: 700px) {
    .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;
    }
    
    /* Mobile cards */
    .cards-grid {
        grid-template-columns: 1fr;
    }
    
    /* OOP pillars mobile */
    .oop-pillars {
        grid-template-columns: 1fr;
    }
    
    /* Concept box mobile */
    .concept-box {
        padding: 1rem;
    }
    
    /* Info box mobile */
    .info-box {
        padding: 1rem;
    }
    
    /* Hero mobile */
    .hero {
        padding: 2rem 1rem;
    }
    
    .hero h1 {
        font-size: 1.8rem;
    }
    
    /* Container mobile */
    .container {
        padding: 1rem;
    }
}

@media (max-width: 400px) {
    .search-wrapper {
        left: auto;
        right: 50px;
        transform: none;
    }
    
    #searchInput {
        width: 100px;
    }
    
    #searchInput:focus {
        width: 130px;
    }
    
    /* Very small mobile adjustments */
    .hero h1 {
        font-size: 1.5rem;
    }
    
    .code-block {
        padding: 0.75rem;
        font-size: 0.8rem;
    }
    
    .uml-class {
        min-width: 120px;
    }
    
    .uml-class-name {
        padding: 0.5rem 0.75rem;
        font-size: 0.9rem;
    }
    
    .uml-class-attributes,
    .uml-class-methods {
        padding: 0.5rem 0.75rem;
        font-size: 0.75rem;
    }
    
    h2 {
        font-size: 1.4rem;
    }
    
    h3 {
        font-size: 1.1rem;
    }
}

/* =============================================
   ADDITIONAL MOBILE STYLES FOR INFORMATIK PAGES
   ============================================= */

/* Mobile styles for fragen-antworten.html inline elements */
@media (max-width: 768px) {
    .frage-box {
        padding: 1rem;
    }
    
    .antwort-box {
        padding: 1rem;
    }
    
    .vergleich-tabelle {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .vergleich-tabelle th,
    .vergleich-tabelle td {
        padding: 0.5rem;
        font-size: 0.85rem;
        min-width: 80px;
    }
    
    .code-expression {
        font-size: 1rem;
        padding: 0.75rem;
    }
    
    .truth-table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    /* KV diagram mobile */
    .kv-simple-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        justify-content: flex-start;
        padding: 0.5rem;
    }
    
    .kv-simple th, .kv-simple td {
        width: 40px;
        height: 40px;
        padding: 5px;
        font-size: 0.9rem;
    }
    
    .kv-diagram-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}

@media (max-width: 700px) {
    .frage-box .frage {
        font-size: 0.95rem;
    }
    
    .kategorie-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .kategorie-header h2 {
        font-size: 1.3rem;
    }
}

/* Mobile styles for logik.html inline elements */
@media (max-width: 768px) {
    .logic-gates-container {
        gap: 1rem;
    }
    
    .logic-gate {
        min-width: 120px;
        padding: 0.75rem;
    }
    
    .logic-gate svg {
        width: 80px;
        height: 56px;
    }
    
    .logic-gate-name {
        font-size: 0.85rem;
    }
    
    .logic-gate-symbol {
        font-size: 0.75rem;
    }
}

/* Mobile styles for struktogramme.html inline elements */
@media (max-width: 768px) {
    .struktogramm {
        max-width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .strukt-block {
        padding: 0.5rem 0.75rem;
        font-size: 0.85rem;
    }
}

/* Mobile styles for definitionen.html inline elements */
@media (max-width: 768px) {
    .def-card {
        padding: 1rem;
    }
    
    .def-term {
        font-size: 1.1rem;
        flex-wrap: wrap;
    }
    
    .def-category {
        font-size: 0.7rem;
    }
}

/* Mobile styles for Mermaid diagrams */
@media (max-width: 768px) {
    .mermaid {
        padding: 1rem;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .mermaid svg {
        min-width: 300px;
    }
}

/* Aufgaben/Exercises mobile */
@media (max-width: 768px) {
    .aufgabe {
        padding: 1rem;
    }
    
    .aufgabe h3 {
        font-size: 1rem;
    }
    
    details.loesung summary {
        padding: 0.5rem 1rem;
        font-size: 0.9rem;
    }
    
    details.loesung .loesung-content {
        padding: 1rem;
    }
}
