/* Global Styles */
:root {
    --primary: #007bff;
    --primary-hover: #0056b3;
    --success: #28a745;
    --success-hover: #218838;
    --bg-main: #f0f4f8;
    --bg-panel: #ffffff;
    --border-color: #d1d9e6;
    --text-main: #2d3748;
    --text-muted: #718096;
    --error-color: #e53e3e;
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.07), 0 10px 15px rgba(0,0,0,0.05);
    --radius: 12px;
}

body {
    font-family: 'Inter', 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    margin: 0;
    padding: 0;
    background-color: var(--bg-main);
    color: var(--text-main);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    line-height: 1.5;
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(26, 32, 44, 0.8);
    backdrop-filter: blur(4px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.modal-content {
    background: var(--bg-panel);
    padding: 40px;
    border-radius: var(--radius);
    max-width: 600px;
    width: 90%;
    text-align: center;
    box-shadow: var(--shadow-md);
    position: relative;
}

.modal-content h2 {
    margin-top: 0;
    color: var(--primary);
    font-size: 1.75rem;
    margin-bottom: 20px;
}

.modal-content p {
    line-height: 1.6;
    margin-bottom: 30px;
    text-align: left;
    color: #4a5568;
}

.modal-button {
    background-color: var(--success);
    color: white;
    border: none;
    padding: 14px 40px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(40, 167, 69, 0.3);
}

.modal-button:hover {
    background-color: var(--success-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 6px rgba(40, 167, 69, 0.4);
}

/* Header / Upload Area */
#fileUpload {
    margin: 20px 20px;
    width: calc(100% - 40px);
    background-color: var(--bg-panel);
    border: 2px dashed var(--border-color);
    border-radius: var(--radius);
    padding: 30px;
    text-align: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-sm);
    box-sizing: border-box;
}

#fileUpload.compact {
    padding: 10px 30px;
    margin: 20px 20px 20px 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    border-style: solid;
    border-width: 1px;
}

#fileUpload.compact ~ .main-seo {
    display: none;
}

.mobile-only-seo {
    display: none;
}

#fileUpload.compact h3 {
    margin: 0;
    font-size: 1rem;
}

#fileUpload.compact p, 
#fileUpload.compact .info-footer {
    display: none;
}

#fileUpload.compact button#fileSelectButton {
    margin: 0;
    padding: 8px 16px;
    font-size: 0.85rem;
}

#fileUpload.dragover {
    background-color: #ebf4ff;
    border-color: var(--primary);
    transform: scale(1.01);
}

#fileUpload h3 {
    margin-top: 0;
    color: var(--text-main);
    font-weight: 600;
    font-size: 1.25rem;
    text-decoration: none;
}

button#fileSelectButton {
    margin-top: 20px;
    padding: 14px 28px;
    border: none;
    background-color: var(--primary);
    color: white;
    font-weight: 600;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 123, 255, 0.3);
}

button#fileSelectButton:hover {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 6px rgba(0, 123, 255, 0.4);
}

/* Three Column Layout */
#validate {
    flex: 1;
    display: flex;
    gap: 24px;
    padding: 0 20px 20px 20px;
    width: 100%;
    box-sizing: border-box;
    min-height: 0;
}

#filesContainer {
    flex: 0 0 200px;
    display: flex;
    flex-direction: column;
}

#previewContainer {
    flex: 0 0 400px;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

#previewContainer .panel-content {
    flex: 1;
}

#previewFile.panel-content {
    padding: 15px;
    overflow: auto;
    white-space: pre;
    font-family: 'Fira Code', 'Cascadia Code', 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 0.85rem;
    line-height: 1.45;
    color: #4a5568;
    max-height: calc(100vh - 250px);
}

.evaluation-header-block {
    background: #f8fafc;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
    font-size: 0.95rem;
    line-height: 1.6;
}

.plausibility-check {
    background: #fffaf0;
    border: 1px solid #feebc8;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
}

.plausibility-check h4 {
    margin-top: 0;
    margin-bottom: 10px;
    font-size: 1rem;
    color: #c05621;
    display: flex;
    align-items: center;
    gap: 8px;
}

.plausibility-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 5px;
    font-size: 0.9rem;
}

.plausibility-icon {
    font-size: 1.1rem;
}

.plausibility-text {
    flex: 1;
}

.plausibility-status-ok {
    color: var(--success);
}

.plausibility-status-warning {
    color: #dd6b20;
}

.plausibility-status-error {
    color: #e53e3e;
}

/* Entfernt da pre nicht mehr genutzt wird */
#previewFile pre {
    display: none;
}

#logContainer {
    flex: 1;
    display: flex;
    flex-direction: column;
}

#filesContainer .panel-content,
#previewContainer .panel-content,
#logContainer .panel-content {
    flex: 1;
}

.panel-label {
    font-weight: 700;
    margin-bottom: 12px;
    color: var(--text-muted);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.panel-label::after {
    display: none;
}

.panel-actions {
    display: flex;
    gap: 8px;
}

.action-btn {
    background: none;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--primary);
    font-size: 0.7rem;
    padding: 2px 8px;
    cursor: pointer;
    transition: all 0.2s;
    text-transform: none;
    letter-spacing: normal;
}

.action-btn:hover {
    background-color: var(--primary);
    color: white;
    border-color: var(--primary);
}

.action-btn.success {
    background-color: var(--success);
    color: white;
    border-color: var(--success);
}


.profile-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    background-color: var(--primary);
    color: white;
    font-size: 0.75rem;
    font-weight: 700;
    margin-left: 10px;
    vertical-align: middle;
    cursor: help;
    position: relative;
}

.profile-info-icon {
    display: inline-block;
    width: 14px;
    height: 14px;
    background: rgba(255,255,255,0.2);
    border-radius: 50%;
    text-align: center;
    line-height: 14px;
    font-size: 10px;
    margin-left: 4px;
}

.profile-badge:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    background: #333;
    color: #fff;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.8rem;
    white-space: normal;
    font-weight: normal;
    width: 200px;
    z-index: 100;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

/* FAQ Accordion */
.faq-section {
    margin: 10px 20px 40px 20px;
    width: calc(100% - 40px);
}

.faq-title {
    text-align: center;
    margin-bottom: 25px;
}

.faq-item {
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 10px;
    overflow: hidden;
}

.faq-question {
    padding: 15px 20px;
    cursor: pointer;
    font-weight: 600;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.2s;
}

.faq-question:hover {
    background: #f9f9f9;
}

.faq-question::after {
    content: '▼';
    font-size: 0.8rem;
    transition: transform 0.3s;
}

.faq-item.active .faq-question::after {
    transform: rotate(180deg);
}

.faq-answer {
    padding: 0 20px;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out, padding 0.3s ease;
    border-top: 0 solid transparent;
}

.faq-item.active .faq-answer {
    padding: 15px 20px;
    max-height: 800px;
    border-top: 1px solid var(--border-color);
}

.security-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: #2e7d32;
    font-weight: 600;
    margin-bottom: 15px;
    font-size: 1rem;
}

.security-badge i {
    font-size: 1.2rem;
}

.panel-content {
    border: 1px solid var(--border-color);
    background-color: var(--bg-panel);
    border-radius: var(--radius);
    overflow: auto;
    height: calc(100vh - 250px);
    max-height: calc(100vh - 250px);
    min-height: 400px;
    padding: 20px;
    box-shadow: var(--shadow-sm);
    box-sizing: border-box; /* Sicherstellen, dass Padding die Höhe nicht beeinflusst */
}

/* Files List Items */
.filesItem {
    cursor: pointer;
    background-color: #f8fafc;
    border: 1px solid #edf2f7;
    border-radius: 8px;
    color: var(--text-main);
    margin-bottom: 10px;
    padding: 12px 16px;
    transition: all 0.2s ease;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 500;
}

.filesItem:hover {
    background-color: #fff;
    border-color: var(--primary);
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    transform: translateX(4px);
}

.filesItem.selected {
    background-color: #ebf8ff;
    border-color: var(--primary);
    color: var(--primary-hover);
    font-weight: 600;
    box-shadow: inset 0 0 0 1px rgba(0, 123, 255, 0.1);
}

/* Log & Details */
.logDetails {
    cursor: pointer;
    padding: 10px 14px;
    background-color: #f7fafc;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin: 12px 0;
    font-size: 0.8rem;
    transition: all 0.2s ease;
}

.logDetails:hover {
    background-color: #edf2f7;
    border-color: var(--primary);
}

.logDetailsHint {
    color: var(--text-muted);
    font-weight: 600;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logDetailsHint::after {
    content: "🔎";
    font-size: 0.9rem;
    opacity: 0.7;
}


.logDetailsContent {
    display: none;
}

.logDetailsContent pre {
    margin-top: 10px;
    border-top: 1px solid #fbd38d;
    padding-top: 10px;
    max-width: 100%;
    box-sizing: border-box;
}

pre {
    background: #f8fafc;
    padding: 15px;
    border-radius: 8px;
    font-size: 0.85rem;
    border: 1px solid #e2e8f0;
    color: #4a5568;
    line-height: 1.45;
    overflow-x: auto;
    white-space: pre;
    max-width: 100%;
    box-sizing: border-box;
}

h3 {
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    font-size: 1.1rem;
    color: #2d3748;
    border-bottom: 2px solid #edf2f7;
    padding-bottom: 5px;
    text-decoration: none;
}

/* Log Modal Specific */
.log-modal-content {
    max-width: 900px;
    width: 90%;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    position: relative;
    padding: 30px;
    text-align: left;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-right: 30px;
}

.modal-header h2 {
    margin: 0;
}

#logDetailBody {
    flex: 1;
    overflow: hidden; /* Verhindert Scrollen auf dem Body, wir wollen es auf dem pre */
    background: #f8fafc;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    display: flex; /* Nutzt Flexbox um das pre zu füllen */
}

#logDetailBody pre {
    margin: 0;
    border: none;
    background: transparent;
    flex: 1;
    overflow: auto; /* Scrollen findet hier statt */
    padding: 15px; /* Padding hierher verschoben für schönes Scrollen */
}

.close-modal {
    position: absolute;
    top: 20px;
    right: 25px;
    font-size: 30px;
    font-weight: bold;
    color: var(--text-muted);
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s;
}

.close-modal:hover {
    color: var(--text-main);
}

/* Error Message */
.uploadError {
    color: #e53e3e;
    font-weight: 700;
    font-size: 1.25rem;
    text-align: center;
    margin: 40px auto;
    padding: 20px;
    background: #fff5f5;
    border-radius: 8px;
    border: 1px solid #feb2b2;
    max-width: 600px;
}

/* SEO Section */
.seo-section {
    margin: 0 20px 40px 20px;
    padding: 40px;
    background: var(--bg-panel);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
}

.seo-container {
    max-width: 1000px;
    margin: 0 auto;
}

.seo-container h2 {
    color: var(--text-main);
    font-size: 1.5rem;
    margin-top: 0;
    margin-bottom: 20px;
    border-bottom: 2px solid var(--bg-main);
    padding-bottom: 10px;
}

.seo-container p {
    color: #4a5568;
    line-height: 1.7;
    margin-bottom: 20px;
}

.seo-container strong {
    color: var(--primary);
}

@media (max-width: 1024px) {
    .seo-section {
        margin: 20px 20px;
        padding: 20px;
        box-sizing: border-box;
        width: calc(100% - 40px);
    }
    #validate .mobile-only-seo {
        margin: 0 0 24px 0;
        width: 100%;
    }
}

/* Footer Styles */
.footer-links {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 20px;
}

.language-switcher select {
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 0.85rem;
    color: var(--text-main);
    cursor: pointer;
    outline: none;
    transition: border-color 0.2s;
}

.language-switcher select:hover {
    border-color: var(--primary);
}

footer {
    background-color: var(--bg-panel);
    border-top: 1px solid var(--border-color);
    padding: 20px 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    color: var(--text-muted);
}

.footer-logo img {
    height: 45px;
    transition: all 0.3s ease;
    filter: grayscale(100%);
    opacity: 0.6;
}

.footer-logo img:hover {
    filter: grayscale(0%);
    opacity: 1;
    transform: scale(1.05);
}

.footer-info {
    text-align: center;
    flex: 1;
    padding: 0 30px;
}

.footer-text {
    margin-bottom: 6px;
    line-height: 1.4;
}

.footer-links a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s;
}

.footer-links a:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

/* Spinner Styles */
.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255,255,255,.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
    margin-right: 10px;
    vertical-align: middle;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* XML Syntax Highlighting */
.xml-tag { color: #880000; font-weight: bold; }
.xml-attr { color: #ff0000; }
.xml-val { color: #0000ff; }
.xml-comment { color: #808080; font-style: italic; }
.xml-text { color: #000000; }

/* Responsive */
@media (max-width: 1200px) {
    #validate {
        padding: 0 20px 20px 20px;
        gap: 16px;
    }
}

@media (max-width: 1024px) {
    #fileUpload {
        margin: 20px 20px;
        width: calc(100% - 40px);
    }
    #fileUpload.compact {
        margin: 20px 20px;
        width: calc(100% - 40px);
    }
    #validate {
        flex-direction: column;
        padding: 0 20px 20px 20px;
    }
    #filesContainer, #previewContainer, #logContainer {
        flex: none;
        width: 100%;
    }
    #filesContainer {
        order: 1;
    }
    #logContainer {
        order: 2;
    }
    #previewContainer {
        order: 3;
    }
    .panel-content {
        height: auto;
        max-height: none;
        min-height: 0;
    }
    #previewFile.panel-content {
        max-height: none;
        white-space: pre-wrap;
        word-wrap: break-word;
    }
    #filesContainer .panel-content {
        min-height: 0;
    }

    #fileUpload.compact ~ .main-seo {
        display: none;
    }

    #fileUpload.compact ~ #validate .mobile-only-seo {
        display: block;
    }

    .mobile-only-seo {
        display: block;
    }

    footer {
        flex-direction: column;
        align-items: flex-start;
        padding: 20px;
        gap: 15px;
    }

    .footer-logo {
        margin-bottom: 5px;
    }

    .footer-info {
        text-align: left;
        padding: 0;
    }

    .footer-links {
        align-self: flex-end;
        flex-wrap: wrap;
        justify-content: flex-end;
        gap: 10px 20px;
    }
}

.disclaimer-footer {
    display: none;
}

.panel-disclaimer {
    font-size: 0.65rem;
    color: var(--text-muted);
    font-style: italic;
    text-transform: none;
    letter-spacing: normal;
    font-weight: normal;
}

/* Verhindert Scrollen auf Desktop bei aktiver Auswertung */
@media (min-width: 1025px) {
    body.evaluation-active {
        overflow: hidden;
        height: 100vh;
    }
    
    body.evaluation-active #validate {
        height: calc(100vh - 160px); /* Platz für Header/Upload und Footer */
    }

    body.evaluation-active .panel-content {
        height: calc(100vh - 250px);
        max-height: calc(100vh - 250px);
    }
}

.vat-check-link {
    text-decoration: none;
    margin-left: 5px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: transform 0.2s ease;
    display: inline-block;
}

.vat-check-link:hover {
    transform: scale(1.2);
}
