/**
 * eRechnung.new - Main Stylesheet
 * Custom styles for the invoice conversion application.
 *
 * Colour tokens and component primitives live in theme.css - load it first and
 * reference its var(--...) tokens here. Never hardcode a colour in this file.
 */

/* Drop Zone Styles */
.drop-zone {
    transition: all 0.3s ease;
    border: 3px dashed var(--line-strong);
}

.drop-zone.dragover {
    background-color: var(--accent-surface);
    border-color: var(--accent);
    transform: scale(1.01);
}

/* JSON Syntax Highlighting - kept on the brand axis, not a rainbow */
.json-key {
    color: var(--interactive);
    font-weight: 600;
}

.json-string {
    color: var(--success-600);
}

.json-number {
    color: var(--accent-ink);
}

.json-null {
    color: var(--ink-muted);
}

/* PDF Canvas */
#pdf-canvas {
    max-width: 100%;
    max-height: 100%;
    height: auto !important;
    width: auto !important;
    display: block;
    /* Tinted, never neutral black - the page is a white surface */
    box-shadow: 0 4px 12px rgba(26, 67, 110, 0.12);
    border-radius: 0.5rem;
}

/* Responsive PDF Container Height */
@media (min-width: 1024px) and (max-height: 900px) {
    #results-section .lg\:sticky > div {
        height: calc(100vh - 120px) !important;
    }
}

@media (min-width: 1024px) and (max-height: 768px) {
    #results-section .lg\:sticky > div {
        height: calc(100vh - 140px) !important;
    }
}

/* Loading Spinner */
.loader {
    border: 3px solid var(--surface-tint);
    border-top: 3px solid var(--accent);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
}

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

/* Validation Toggle Icon */
#validation-toggle-icon {
    transition: transform 0.3s ease;
}

/* Text Decoration */
.double-underline {
    text-decoration: underline;
    text-decoration-style: double;
}

/* Input Validation Styles */
input:invalid:not(:placeholder-shown) {
    border-color: var(--danger) !important;
    background-color: var(--danger-surface);
}

input:invalid:not(:placeholder-shown):focus {
    ring-color: var(--danger) !important;
    border-color: var(--danger) !important;
}

input:valid:not(:placeholder-shown) {
    border-color: var(--success);
}

/* Validierung Tooltip */
input[type="email"]:invalid:not(:placeholder-shown),
input[pattern]:invalid:not(:placeholder-shown) {
    position: relative;
}

/* Responsive Scaling for smaller laptops and compact screens */
@media (min-width: 1024px) and (max-height: 900px) {
    /* Scale based on viewport height for better fit on smaller screens */
    html {
        font-size: 13px; /* Scale down base font size more aggressively */
    }

    /* Smaller upload section */
    #upload-section {
        padding-top: 2rem !important;
        padding-bottom: 2rem !important;
    }

    #upload-section .drop-zone {
        padding: 2rem !important;
        margin-bottom: 2rem !important;
    }

    /* Compact header spacing */
    #main-header {
        padding-top: 0.5rem !important;
        padding-bottom: 0.5rem !important;
    }

    /* Reduce logo and header spacing */
    #upload-section .mb-16 {
        margin-bottom: 2rem !important;
    }

    #upload-section .mb-12 {
        margin-bottom: 1.5rem !important;
    }
}

/* Additional scaling for very compact screens */
@media (min-width: 1024px) and (max-height: 768px) {
    html {
        font-size: 12px;
    }

    #upload-section {
        padding-top: 1.5rem !important;
        padding-bottom: 1.5rem !important;
    }
}

/* Download Page Animations */
.download-success-icon {
    animation: scaleIn 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes scaleIn {
    0% {
        transform: scale(0) rotate(-180deg);
        opacity: 0;
    }
    100% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
}

/* Fade-in for download section */
#download-section {
    animation: fadeIn 0.5s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
