/* 
  Accessibility-Hinweis:
  - Fokus-Stile für Tastaturnavigation und Screenreader sind implementiert.
  - ARIA-Labels und hohe Kontraste werden unterstützt.
  - Für weitere Barrierefreiheit regelmäßig mit Screenreader und Tastatur testen.
*/

/* CSS Custom Properties */
:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --secondary: #64748b;
    --accent: #f59e0b;
    --success: #10b981;
    --danger: #ef4444;
    
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-card: #ffffff;
    --bg-hover: #f1f5f9;
    
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #64748b;
    
    --border: #e2e8f0;
    --border-hover: #cbd5e1;
    
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
    
    --radius: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    
    --font-sans: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'Courier New', Courier, monospace;
    
    --max-width: 1200px;
    --container-padding: 1rem;
    
    --transition: all 0.2s ease-in-out;
}

/* Dark Theme */
[data-theme="dark"] {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-card: #1e293b;
    --bg-hover: #334155;
    
    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
    
    --border: #334155;
    --border-hover: #475569;
    
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.3);
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.3), 0 1px 2px -1px rgb(0 0 0 / 0.3);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.3), 0 4px 6px -4px rgb(0 0 0 / 0.3);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.3), 0 8px 10px -6px rgb(0 0 0 / 0.3);
}

/* Reset & Base */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    height: 100%;
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    min-height: 100vh;
    font-family: var(--font-sans);
    line-height: 1.6;
    color: var(--text-primary);
    background: var(--bg-primary);
    transition: var(--transition);
    display: flex;
    flex-direction: column;
}

/* Screen Reader Only */
.sr-only {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

/* Container */
.container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 var(--container-padding);
    width: 100%;
}

/* Header */
.header {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 100;
}

.logo {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--primary);
    margin: 1rem 0 0.5rem;
    text-align: center;
}

.tagline {
    color: var(--text-secondary);
    text-align: center;
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

/* Navigation */
.nav {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    padding: 0 0 1rem;
    flex-wrap: wrap;
}

.nav-btn {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.9rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: fit-content;
}

.nav-btn:hover {
    background: var(--bg-hover);
    border-color: var(--border-hover);
}

.nav-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.theme-btn {
    background: transparent;
    border: none;
    padding: 0.75rem;
    border-radius: 50%;
    width: 3rem;
    height: 3rem;
    justify-content: center;
}

.theme-icon {
    font-size: 1.2rem;
    transition: transform 0.3s ease;
}

/* Main Content */
.main {
    flex: 1;
    padding: 2rem 0;
    background: var(--bg-secondary);
}

.section {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    padding: 2rem;
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
}

.section:not(.active) {
    display: none;
}

.section h2 {
    font-size: 1.5rem;
    color: var(--text-primary);
    margin-bottom: 1.5rem;
    text-align: center;
}

/* Search Panel */
.search-panel {
    margin-bottom: 2rem;
}

.search-input-container {
    position: relative;
    margin-bottom: 1.5rem;
}

.search-input {
    width: 100%;
    padding: 1rem 3.5rem 1rem 1rem;
    border: 2px solid var(--border);
    border-radius: var(--radius-lg);
    font-size: 1rem;
    background: var(--bg-primary);
    color: var(--text-primary);
    transition: var(--transition);
}

.search-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgb(37 99 235 / 0.1);
}

.search-btn {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    background: var(--primary);
    border: none;
    color: white;
    padding: 0.5rem;
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
    width: 2.5rem;
    height: 2.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.search-btn:hover {
    background: var(--primary-dark);
}

/* Suggestions */
.suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-top: none;
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    max-height: 200px;
    overflow-y: auto;
    z-index: 50;
    box-shadow: var(--shadow-lg);
}

.suggestion-item {
    padding: 0.75rem 1rem;
    cursor: pointer;
    border-bottom: 1px solid var(--border);
    transition: var(--transition);
}

.suggestion-item:hover {
    background: var(--bg-hover);
}

.suggestion-item:last-child {
    border-bottom: none;
}

/* Quick Tags */
.quick-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
}

.tag-btn {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.9rem;
}

.tag-btn:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* Results */
.results-container {
    display: grid;
    gap: 1rem;
}

.verse-card {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    transition: var(--transition);
    cursor: pointer;
}

.verse-card:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.verse-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.75rem;
}

.verse-reference {
    font-weight: 600;
    color: var(--primary);
    font-size: 1.1rem;
}

.verse-actions {
    display: flex;
    gap: 0.5rem;
}

.action-btn {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    padding: 0.5rem;
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
    width: 2.5rem;
    height: 2.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
}

.action-btn:hover {
    background: var(--bg-hover);
    border-color: var(--border-hover);
}

.favorite-btn.active {
    color: var(--accent);
    border-color: var(--accent);
    background: rgb(245 158 11 / 0.1);
}

.verse-text {
    color: var(--text-primary);
    font-size: 1rem;
    line-height: 1.6;
    margin-bottom: 0.75rem;
}

.verse-text mark {
    background: rgb(245 158 11 / 0.3);
    color: var(--text-primary);
    padding: 0.1rem 0.2rem;
    border-radius: 0.25rem;
}

.verse-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
}

.tag {
    background: var(--bg-secondary);
    color: var(--text-muted);
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius);
    font-size: 0.8rem;
    border: 1px solid var(--border);
}

/* No Results */
.no-results {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-secondary);
}

/* Random Button */
.random-btn {
    display: block;
    margin: 0 auto 2rem;
    background: var(--accent);
    color: white;
    border: none;
    padding: 1rem 2rem;
    border-radius: var(--radius-lg);
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.random-btn:hover {
    background: rgb(245 158 11 / 0.9);
    transform: translateY(-1px);
}

/* Modal */
.modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
}

.modal[aria-hidden="false"] {
    opacity: 1;
    visibility: visible;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgb(0 0 0 / 0.5);
    backdrop-filter: blur(4px);
}

.modal-content {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    transform: scale(0.95);
    transition: var(--transition);
}

.modal[aria-hidden="false"] .modal-content {
    transform: scale(1);
}

.modal-header {
    padding: 1.5rem 1.5rem 0;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.modal-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--primary);
    margin: 0;
    flex: 1;
    padding-right: 1rem;
}

.modal-close {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: var(--radius);
    transition: var(--transition);
    width: 2.5rem;
    height: 2.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.modal-close:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.modal-body {
    padding: 1.5rem;
}

.modal-actions {
    padding: 0 1.5rem 1.5rem;
    display: flex;
    gap: 0.75rem;
    justify-content: center;
    flex-wrap: wrap;
}

.modal-actions .action-btn {
    padding: 0.75rem 1rem;
    width: auto;
    height: auto;
    font-size: 0.9rem;
    gap: 0.5rem;
}

/* Footer */
.footer {
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    padding: 2rem 0;
    margin-top: auto;
}

.disclaimer {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    text-align: center;
    line-height: 1.5;
}

.copyright {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-align: center;
}

.copyright a {
    color: var(--primary);
    text-decoration: none;
}

.copyright a:hover {
    text-decoration: underline;
}

.install-link {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

/* Offline Indicator */
.offline-indicator {
    position: fixed;
    bottom: 1rem;
    left: 1rem;
    background: var(--secondary);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-lg);
    font-size: 0.9rem;
    box-shadow: var(--shadow-lg);
    z-index: 200;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        --container-padding: 0.75rem;
    }
    
    .logo {
        font-size: 1.5rem;
    }
    
    .tagline {
        font-size: 1rem;
    }
    
    .nav {
        gap: 0.25rem;
    }
    
    .nav-btn {
        padding: 0.5rem 0.75rem;
        font-size: 0.8rem;
    }
    
    .section {
        padding: 1.5rem;
        margin-bottom: 1rem;
    }
    
    .search-input {
        padding: 0.875rem 3rem 0.875rem 0.875rem;
    }
    
    .verse-card {
        padding: 1rem;
    }
    
    .verse-header {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .verse-actions {
        align-self: flex-end;
    }
    
    .modal-content {
        margin: 0.5rem;
        max-height: 95vh;
    }
    
    .modal-header {
        padding: 1rem 1rem 0;
    }
    
    .modal-body {
        padding: 1rem;
    }
    
    .modal-actions {
        padding: 0 1rem 1rem;
        gap: 0.5rem;
    }
    
    .modal-actions .action-btn {
        padding: 0.5rem 0.75rem;
        font-size: 0.8rem;
    }
}

@media (max-width: 480px) {
    .quick-tags {
        gap: 0.25rem;
    }
    
    .tag-btn {
        padding: 0.375rem 0.75rem;
        font-size: 0.8rem;
    }
    
    .modal-actions {
        flex-direction: column;
    }
    
    .modal-actions .action-btn {
        width: 100%;
        justify-content: center;
    }
}

/* Focus Styles for Accessibility */
button:focus-visible,
input:focus-visible,
.verse-card:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* Animation for smooth transitions */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.verse-card {
    animation: slideIn 0.3s ease-out;
}

/* Print Styles */
@media print {
    .header,
    .nav,
    .footer,
    .modal,
    .offline-indicator,
    .action-btn {
        display: none !important;
    }
    
    .main {
        padding: 0;
    }
    
    .section {
        box-shadow: none;
        border: 1px solid #000;
        page-break-inside: avoid;
    }
    
    .verse-card {
        border: 1px solid #000;
        page-break-inside: avoid;
        margin-bottom: 1rem;
    }
}
