/* public/style.css */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
    line-height: 1.6;
    margin: 0;
    padding: 0;
    background-color: #f8f9fa;
    color: #212529;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.container {
    width: 92%;
    max-width: 830px;
    margin: 20px auto;
    padding: 25px;
    background-color: #ffffff;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    flex-grow: 1;
    overflow-x: hidden;
    position: relative;
}

.site-header {
    background-color: #343a40;
    color: #ffffff;
    padding: 15px 0;
    text-align: center;
    border-bottom: 3px solid #007bff;
}

#logo {
    max-height: 50px;
    margin-bottom: 10px;
    vertical-align: middle;
}

.site-header h1 {
    margin: 0;
    display: inline-block;
    vertical-align: middle;
    font-size: 1.8em;
}

.search-form {
    display: flex;
    margin-bottom: 0;
    gap: 10px;
}

#searchInput {
    flex-grow: 1;
    padding: 12px 15px;
    font-size: 1rem;
    border: 1px solid #ced4da;
    border-radius: 20px;
    box-shadow: inset 0 1px 2px rgba(0,0,0,.075);
}

#searchInput:focus {
    border-color: #86b7fe;
    outline: 0;
    box-shadow: 0 0 0 .25rem rgba(13,110,253,.25);
}

#searchButton {
    padding: 12px 25px;
    font-size: 1rem;
    color: #fff;
    background-color: #007bff;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    transition: background-color 0.15s ease-in-out;
}

#searchButton:hover {
    background-color: #0056b3;
}

/* Search Type Options */
.search-type-options {
    margin-top: 15px;
    margin-bottom: 20px;
    padding-top: 5px;
    text-align: center;
    font-size: 0.95em;
}

.search-type-options a {
    color: #0056b3;
    text-decoration: none;
    padding: 5px 10px;
    border-radius: 4px;
    margin: 0 2px;
}

.search-type-options a:hover {
    background-color: #e9ecef;
    text-decoration: underline;
}

.search-type-options a.active {
    font-weight: bold;
    color: #000;
    background-color: #ddeeff;
}

#resultsArea h2 {
    color: #0056b3;
    margin-top: 0;
    border-bottom: 2px solid #eee;
    padding-bottom: 0.5em;
}

#resultsArea h3 {
    margin-top: 1.5em;
    color: #333;
}

.results-block {
    margin-bottom: 30px;
}

hr.results-separator {
    margin: 30px 0;
    border: 0;
    border-top: 1px solid #eee;
}

.result-content {
    background-color: #fdfdff;
    padding: 15px;
    border-left: 3px solid #007bff;
    margin-bottom: 10px;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.sources-list {
    list-style-type: none;
    padding-left: 0;
}

.sources-list li {
    margin-bottom: 0.5em;
    display: flex;
    align-items: baseline;
}

.sources-list li sup {
    margin-right: 5px;
}

.sources-list a {
    color: #0056b3;
    text-decoration: none;
}

.sources-list a:hover {
    text-decoration: underline;
}

.error-box {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    padding: 15px;
    border-radius: 4px;
    margin-bottom: 20px;
}

.error-details {
    font-family: monospace;
    font-size: 0.9em;
    background-color: #ffe5e8;
    padding: 10px;
    border-radius: 3px;
    margin-top: 10px;
    white-space: pre-wrap;
    word-break: break-all;
    max-height: 200px;
    overflow-y: auto;
}

.raw-response-details {
    margin-top: 20px;
    border: 1px solid #e0e0e0;
    padding: 10px;
    border-radius: 4px;
}

.raw-response-details summary {
    cursor: pointer;
    font-weight: bold;
    color: #555;
}

.raw-response-details pre {
    background-color: #f9f9f9;
    padding: 10px;
    border-radius: 3px;
    max-height: 400px;
    overflow: auto;
    font-size: 0.85em;
}

.site-footer {
    text-align: center;
    padding: 20px;
    background-color: #343a40; /* Dunkelgrauer Hintergrund */
    color: #f8f9fa; /* Sehr hellgraue/fast weiße Schriftfarbe für Text im Footer */
    margin-top: auto;
}

.site-footer p a,
.site-footer nav a { /* Erweitert, um auch Links in einer potenziellen <nav> im Footer abzudecken */
    color: #ffffff; /* Weiß */
    text-decoration: none; /* Keine Unterstreichung */
}

.site-footer p a:hover,
.site-footer nav a:hover {
    text-decoration: underline; /* Optional: Unterstreichung beim Hover für besseres Feedback */
    /* color: #dddddd; */ /* Optional: Leicht andere Farbe beim Hover */
}

.language-selector {
    margin-bottom: 10px;
}

.language-selector label {
    margin-right: 5px;
}

.language-selector select {
    padding: 5px;
    border-radius: 4px;
}

.api-source-indicator,
.cache-indicator {
    font-size: 0.8em;
    color: #555;
    margin-left: 8px;
    font-weight: normal;
}

.perplexity-results .result-content > p:first-child {
    margin-top: 0;
}

.result-content > p:first-child,
.result-content > h1:first-child,
.result-content > h2:first-child,
.result-content > h3:first-child,
.result-content > h4:first-child,
.result-content > ul:first-child,
.result-content > ol:first-child {
    margin-top: 0;
}

.result-content > p:first-child {
    margin-top: 0 !important;
}

.perplexity-content-teaser {
    max-height: 150px;
    overflow: hidden;
    position: relative;
    transition: max-height 0.5s ease-out;
    margin-top: 0 !important;
    padding-top: 0 !important;
}

.perplexity-content-teaser.expanded {
    max-height: none;
    overflow: visible;
}

.perplexity-content-teaser > *,
.perplexity-content-teaser > p,
.perplexity-content-teaser > div,
.perplexity-content-teaser > *:first-child {
    margin-top: 0 !important;
    padding-top: 0 !important;
}

/* Extrem spezifisch, um die höchste Priorität zu gewährleisten */
body main .container .results-block.perplexity-results .result-content.perplexity-content-teaser {
    margin-top: 0 !important;
    padding-top: 0 !important;
}

/* Formatierung direkt für das erste <p>-Element im Container */
body main .container .results-block.perplexity-results .result-content.perplexity-content-teaser > p:first-child {
    margin-top: 0 !important;
    padding-top: 0 !important;
}

/* Verhindere Collapsing Margins */
.perplexity-results h3 + .result-content.perplexity-content-teaser {
    display: block;
    margin-top: 0;
    padding-top: 0;
    border-top: 0;
}

/* Entferne Abstände zwischen h3 und dem Container */
.perplexity-results h3 {
    margin-bottom: 0;
    padding-bottom: 10px;
}

.results-block.perplexity-results {
    padding-top: 1px;
    margin-top: -1px;
    overflow: hidden;
}

.result-content > * {
    margin-top: 0;
}

.toggle-button {
    display: inline-block;
    padding: 6px 12px;
    margin-top: 10px;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9em;
}

.toggle-button:hover {
    background-color: #0056b3;
}

/* Brave Search Results - General */
.brave-web-results-list,
.brave-news-results-list,
.brave-image-results-grid {
    list-style-type: none;
    padding-left: 0;
}

.brave-result-item {
    margin-bottom: 25px;
    padding: 15px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    background-color: #f9f9f9;
}

.brave-result-item:hover {
    border-color: #ccc;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.brave-result-header {
    display: flex;
    align-items: center;
    margin-bottom: 5px;
}

.brave-favicon {
    width: 16px;
    height: 16px;
    margin-right: 8px;
    vertical-align: middle;
}

.brave-favicon-placeholder {
    display: inline-block;
    width: 16px;
    height: 16px;
    margin-right: 8px;
}

.brave-result-title-url {
    display: flex;
    flex-direction: column;
}

.brave-title-link {
    font-size: 1.2em;
    color: #1a0dab;
    text-decoration: none;
    margin-bottom: 2px;
}

.brave-title-link:hover {
    text-decoration: underline;
}

.brave-url-display {
    font-size: 0.9em;
    color: #006621;
    word-break: break-all;
}

.brave-snippet {
    font-size: 0.95em;
    color: #333;
    line-height: 1.5;
    margin-top: 4px;
    margin-bottom: 4px;
}

.brave-page-age {
    font-size: 0.8em;
    color: #555;
    margin-top: 5px;
}

/* Brave News Specific */
.brave-news-item {
    display: flex;
    align-items: flex-start;
}

.brave-news-thumbnail {
    width: 100px;
    height: auto;
    max-height: 100px;
    object-fit: cover;
    margin-right: 15px;
    border-radius: 4px;
    border: 1px solid #eee;
}

.brave-news-content {
    flex: 1;
}

.brave-news-content .brave-title-link {
    font-size: 1.1em;
}

/* Brave Image Results */
.brave-image-results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 15px;
}

.brave-image-item {
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    padding: 10px;
    text-align: center;
    background-color: #f9f9f9;
}

.brave-image-item img {
    max-width: 100%;
    height: 150px;
    object-fit: cover;
    border-radius: 4px;
    margin-bottom: 8px;
    border: 1px solid #ddd;
}

.brave-image-item:hover {
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.brave-image-title {
    font-size: 0.9em;
    color: #333;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.brave-image-source {
    font-size: 0.8em;
    color: #555;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Loader Styles */
.loader-container {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.8);
    z-index: 998;
}

.loader {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: inline-block;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    border: 3px solid;
    border-color: #5a5a5a #464646 transparent transparent;
    box-sizing: border-box;
    animation: rotation 1s linear infinite;
    z-index: 999;
}

.loader::after,
.loader::before {
    content: '';
    box-sizing: border-box;
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    bottom: 0;
    margin: auto;
    border: 3px solid;
    border-color: transparent transparent #FF3D00 #FF3D00;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    box-sizing: border-box;
    animation: rotationBack 0.5s linear infinite;
    transform-origin: center center;
}

.loader::before {
    width: 32px;
    height: 32px;
    border-color: #FFF #FFF transparent transparent;
    animation: rotation 1.5s linear infinite;
}

@keyframes rotation {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

@keyframes rotationBack {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(-360deg);
    }
}

.usp-container {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    grid-gap: 20px;
    width: 96%;
    margin: 0 auto;
    max-width: 750px;
    margin-top: 70px;
    margin-bottom: 40px;
}

.usp-card {
    width: 100%;
    margin: 0;
    padding: 18px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    box-sizing: border-box;
    background-color: #ffffff;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.usp-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

.usp-content {
    width: 100%;
}

.usp-content h1,
.usp-content h3 {
    color: #343a40;
    margin-top: 0;
    margin-bottom: 10px;
    font-size: 1.25rem;
}

.usp-content p {
    color: #495057;
    margin: 0;
    font-size: 0.9rem;
    line-height: 1.5;
}

.usp-icon {
    font-size: 2.2rem;
    color: #a3a3a3;
    margin-bottom: 12px;
}

.usp-container + #resultsArea h2 + .usp-container {
    display: none;
}

/* Mobile Optimierungen */
@media (max-width: 768px) {
    .container {
        width: 95%;
        padding: 15px;
    }
    
    .usp-container {
        display: flex;
        flex-direction: column;
        width: 100%;
        margin-top: 50px;
        margin-bottom: 30px;
        gap: 15px;
    }
    
    .usp-card {
        width: 92%;
        margin: 0 auto;
        max-width: 400px;
    }
}

/* Extra kleine Bildschirme */
@media (max-width: 480px) {
    .container {
        width: 98%;
        padding: 12px;
    }
    
    .usp-card {
        width: 90%;
        padding: 15px;
    }
    
    .usp-content h1,
    .usp-content h3 {
        font-size: 1.15rem;
    }
    
    .search-form {
        width: 100%;
        margin-left: -2px;
        margin-right: -2px;
    }
    
    #searchInput {
        font-size: 0.95rem;
        padding: 10px 12px;
    }
    
    #searchButton {
        padding: 10px 15px;
        font-size: 0.95rem;
        min-width: 80px;
    }
}

/* Für sehr kleine Bildschirme noch kompakter machen */
@media (max-width: 360px) {
    .search-form {
        flex-wrap: nowrap;
        gap: 5px;
    }
    
    #searchInput {
        padding: 8px 10px;
    }
    
    #searchButton {
        padding: 8px 12px;
        min-width: 70px;
    }
}

/* Mobiles Layout für die Typen-Navigation */
@media (max-width: 480px) {
    .search-type-options {
        margin-top: 12px;
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 8px;
    }
    
    .search-type-options a {
        padding: 5px 8px;
    }
}

/* Ergänzung zu style.css */
/* Anpassungen für das Lupensymbol im Suchbutton */

#searchButton .fa-search {
    margin-right: 5px;
}

/* Für kleine Bildschirme, evtl. nur das Icon anzeigen */
@media (max-width: 360px) {
    #searchButton .fa-search {
        margin-right: 3px;
    }
}

/* --- Autocomplete Styles --- */
.autocomplete {
    position: relative;
    width: 100%;
}

.autocomplete-items {
    position: absolute;
    border: 1px solid #ddd;
    border-top: none;
    z-index: 9999;
    top: 100%;
    left: 0;
    right: 0;
    background-color: #fff;
    border-radius: 0 0 20px 20px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    max-height: 300px;
    overflow-y: auto;
    display: none;
}

.autocomplete-items div {
    padding: 10px 15px;
    cursor: pointer;
    border-bottom: 1px solid #eee;
    background-color: #fff;
}

.autocomplete-items div:hover {
    background-color: #f8f9fa;
}

.autocomplete-items div:last-child {
    border-bottom: none;
}

.autocomplete-active {
    background-color: #f8f9fa !important;
}

/* Stelle sicher, dass die Vorschläge über anderen Elementen angezeigt werden */
.autocomplete-items strong {
    font-weight: bold;
    color: #007bff;
}

/* Zu style.css hinzufügen - Paginierungs-Styles */

/* Paginierung Container */
.pagination-container {
    margin: 2rem 0;
    text-align: center;
}

.pagination {
    display: inline-flex;
    gap: 0.5rem;
    align-items: center;
    background: #fff;
    padding: 0.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.pagination-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.5rem;
    height: 2.5rem;
    padding: 0 0.75rem;
    font-size: 0.95rem;
    color: #4a5568;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    text-decoration: none;
    transition: all 0.2s ease;
}

.pagination-link:hover {
    background: #f7fafc;
    border-color: #cbd5e0;
    color: #2d3748;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.pagination-link.pagination-active {
    background: #007bff;
    border-color: #007bff;
    color: #fff;
    font-weight: 500;
}

.pagination-link.pagination-active:hover {
    background: #0056b3;
    border-color: #0056b3;
}

.pagination-prev,
.pagination-next {
    font-weight: 500;
    padding: 0 1rem;
}

.pagination-prev {
    margin-right: 0.5rem;
}

.pagination-next {
    margin-left: 0.5rem;
}

.pagination-info {
    font-size: 0.9rem;
    color: #718096;
    margin-top: 0.5rem;
}

@media (max-width: 768px) {
    .pagination {
        gap: 0.25rem;
        padding: 0.25rem;
    }

    .pagination-link {
        min-width: 2rem;
        height: 2rem;
        padding: 0 0.5rem;
        font-size: 0.9rem;
    }

    .pagination-prev,
    .pagination-next {
        padding: 0 0.75rem;
    }
}

@media (max-width: 480px) {
    .pagination {
        flex-wrap: wrap;
        justify-content: center;
    }

    .pagination-link {
        min-width: 1.75rem;
        height: 1.75rem;
        padding: 0 0.4rem;
        font-size: 0.85rem;
    }

    .pagination-prev,
    .pagination-next {
        padding: 0 0.5rem;
        font-size: 0.85rem;
    }

    .pagination-info {
        font-size: 0.8rem;
    }
}

/* Stil für die Ergebnisanzahl im Header */
.results-block h3 {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 10px;
}

.results-block h3 .pagination-info {
    margin-left: auto;
}

@media (max-width: 480px) {
    .results-block h3 {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }
    
    .results-block h3 .pagination-info {
        margin-left: 0;
        font-size: 0.75em;
    }
}

/* Zu style.css hinzufügen - für die API-Limit-Hinweismeldung */

.pagination-api-limit-notice {
    text-align: center;
    margin-top: 0.5rem;
    color: #6c757d;
    font-size: 0.85rem;
}

.pagination-api-limit-notice small {
    background-color: #f8f9fa;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    border: 1px solid #e9ecef;
}

/* Optional: Leichtes Pulsieren für mehr Aufmerksamkeit */
@keyframes pulse-subtle {
    0% { opacity: 0.8; }
    50% { opacity: 1; }
    100% { opacity: 0.8; }
}

.pagination-api-limit-notice small {
    animation: pulse-subtle 2s infinite ease-in-out;
}

@media (max-width: 768px) {
    .pagination-api-limit-notice {
        font-size: 0.8rem;
    }
}

@media (max-width: 480px) {
    .pagination-api-limit-notice {
        font-size: 0.75rem;
    }
    
    .pagination-api-limit-notice small {
        padding: 0.2rem 0.3rem;
    }
}
/* --- DLx modern utilities (Tailwind-inspired, lokal) --- */
:root {
  --dlx-brand: #007bff;
  --dlx-ink: #212529;
  --dlx-muted: #6c757d;
  --dlx-surface: #ffffff;
  --dlx-bg: #f8f9fa;
}

.flex { display: flex; }
.items-center { align-items: center; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.w-full { width: 100%; }
.relative { position: relative; }
.hidden { display: none !important; }
.animate-pulse {
  animation: dlx-pulse 1.4s ease-in-out infinite;
}
@keyframes dlx-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.45; }
}

.ai-loading {
  padding: 1.25rem 0.5rem;
  color: var(--dlx-muted);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.ai-loading .spinner {
  width: 1.25rem;
  height: 1.25rem;
  border: 2px solid #dee2e6;
  border-top-color: var(--dlx-brand);
  border-radius: 50%;
  animation: dlx-spin 0.8s linear infinite;
}
@keyframes dlx-spin {
  to { transform: rotate(360deg); }
}

.htmx-request .ai-loading { display: flex; }

.autocomplete-items [x-cloak],
[x-cloak] { display: none !important; }

.suggestion-active {
  background: #e9f2ff;
}
