/* ============================================================
   EU NOPR Analysis – Dark Theme Stylesheet
   Preserves the existing dark gradient theme from the original
   index.html while adding production UI components.
   ============================================================ */

/* ── Reset & Base ──────────────────────────────────────────── */

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    min-height: 100vh;
    color: #e4e4e4;
    padding: 2rem;
    line-height: 1.6;
}

/* ── Layout ────────────────────────────────────────────────── */

.container {
    max-width: 720px;
    margin: 0 auto;
}

h1 {
    text-align: center;
    margin-bottom: 2rem;
    color: #fff;
    font-weight: 300;
    font-size: 1.75rem;
}

/* ── Card ──────────────────────────────────────────────────── */

.card {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 2rem;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* ── Upload Area ───────────────────────────────────────────── */

.upload-area {
    position: relative;
    border: 2px dashed rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    padding: 2.5rem 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.3s, background-color 0.3s;
    margin-bottom: 1.5rem;
}

.upload-area:hover,
.upload-area:focus-within {
    border-color: #4a9eff;
    background: rgba(74, 158, 255, 0.05);
}

.upload-area.drag-over {
    border-color: #4a9eff;
    background: rgba(74, 158, 255, 0.1);
}

.upload-area .upload-icon {
    font-size: 2.5rem;
    margin-bottom: 0.75rem;
    display: block;
}

.upload-area .upload-text {
    color: #a0a0a0;
    font-size: 0.95rem;
}

.upload-area .upload-hint {
    color: #666;
    font-size: 0.8rem;
    margin-top: 0.5rem;
}

/* Hidden native file input – covers the entire drop zone for click support */
.upload-area input[type="file"] {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

/* ── File Info ─────────────────────────────────────────────── */

.file-info {
    display: none;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    margin-bottom: 1.5rem;
    background: rgba(74, 158, 255, 0.1);
    border: 1px solid rgba(74, 158, 255, 0.25);
    border-radius: 8px;
    font-size: 0.9rem;
}

.file-info.visible {
    display: flex;
}

.file-info .file-name {
    color: #4a9eff;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 80%;
}

.file-info .file-remove {
    background: none;
    border: none;
    color: #a0a0a0;
    cursor: pointer;
    font-size: 1.1rem;
    padding: 0 0.25rem;
    width: auto;
    transition: color 0.2s;
}

.file-info .file-remove:hover {
    color: #ff4757;
}

/* ── Buttons ───────────────────────────────────────────────── */

button {
    width: 100%;
    padding: 0.9rem 1.25rem;
    border: none;
    border-radius: 8px;
    color: #fff;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, opacity 0.2s;
}

button:hover:not(:disabled) {
    transform: translateY(-2px);
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

button:focus-visible {
    outline: 2px solid #4a9eff;
    outline-offset: 2px;
}

.btn-primary {
    background: linear-gradient(135deg, #4a9eff 0%, #6c5ce7 100%);
}

.btn-download {
    background: linear-gradient(135deg, #00ff88 0%, #00b894 100%);
    color: #1a1a2e;
}

.btn-copy {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.btn-copy:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.15);
}

/* ── Report Action Buttons Row ─────────────────────────────── */

.report-actions {
    display: none;
    gap: 0.75rem;
    margin-top: 1.25rem;
}

.report-actions.visible {
    display: flex;
}

.report-actions button {
    flex: 1;
}

/* ── Progress Section ──────────────────────────────────────── */

.progress-section {
    display: none;
    margin-top: 1.5rem;
    padding: 1.25rem;
    border-radius: 8px;
    background: rgba(74, 158, 255, 0.1);
    border: 1px solid rgba(74, 158, 255, 0.3);
}

.progress-section.visible {
    display: block;
}

.progress-section .spinner {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #4a9eff;
    animation: spin 1s linear infinite;
    margin-right: 0.5rem;
    vertical-align: middle;
}

.progress-section .progress-text {
    vertical-align: middle;
    color: #e4e4e4;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ── Error Section ─────────────────────────────────────────── */

.error-section {
    display: none;
    margin-top: 1.5rem;
    padding: 1.25rem;
    border-radius: 8px;
    background: rgba(255, 71, 87, 0.1);
    border: 1px solid rgba(255, 71, 87, 0.3);
    color: #ff6b7a;
    font-size: 0.95rem;
}

.error-section.visible {
    display: block;
}

/* ── Report Section ────────────────────────────────────────── */

.report-section {
    display: none;
    margin-top: 1.5rem;
}

.report-section.visible {
    display: block;
}

.report-section .report-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.report-section .report-header h2 {
    font-size: 1.1rem;
    font-weight: 500;
    color: #fff;
}

.report-section .report-content {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    padding: 1.5rem;
    max-height: 60vh;
    overflow-y: auto;
    line-height: 1.7;
}

/* ── Report Content Typography ─────────────────────────────── */

.report-content h1,
.report-content h2,
.report-content h3,
.report-content h4,
.report-content h5,
.report-content h6 {
    color: #fff;
    margin-top: 1.25rem;
    margin-bottom: 0.5rem;
}

.report-content h1 { font-size: 1.5rem; }
.report-content h2 { font-size: 1.3rem; }
.report-content h3 { font-size: 1.15rem; }

.report-content p {
    margin-bottom: 0.75rem;
}

.report-content ul,
.report-content ol {
    margin-left: 1.5rem;
    margin-bottom: 0.75rem;
}

.report-content li {
    margin-bottom: 0.25rem;
}

.report-content table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.report-content th,
.report-content td {
    padding: 0.5rem 0.75rem;
    border: 1px solid rgba(255, 255, 255, 0.12);
    text-align: left;
}

.report-content th {
    background: rgba(255, 255, 255, 0.06);
    color: #fff;
    font-weight: 600;
}

.report-content code {
    background: rgba(255, 255, 255, 0.08);
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 0.85em;
}

.report-content pre {
    background: rgba(0, 0, 0, 0.3);
    padding: 1rem;
    border-radius: 6px;
    overflow-x: auto;
    margin-bottom: 1rem;
}

.report-content pre code {
    background: none;
    padding: 0;
}

.report-content blockquote {
    border-left: 3px solid #4a9eff;
    padding-left: 1rem;
    margin-bottom: 0.75rem;
    color: #a0a0a0;
}

.report-content a {
    color: #4a9eff;
    text-decoration: none;
}

.report-content a:hover {
    text-decoration: underline;
}

.report-content strong {
    color: #fff;
}

.report-content hr {
    border: none;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    margin: 1rem 0;
}

/* ── Success Banner ────────────────────────────────────────── */

.success-banner {
    display: none;
    margin-top: 1.5rem;
    padding: 1rem 1.25rem;
    border-radius: 8px;
    background: rgba(0, 255, 136, 0.1);
    border: 1px solid rgba(0, 255, 136, 0.3);
    color: #00ff88;
    font-size: 0.95rem;
}

.success-banner.visible {
    display: block;
}

/* ── Scrollbar (Webkit) ────────────────────────────────────── */

.report-content::-webkit-scrollbar {
    width: 6px;
}

.report-content::-webkit-scrollbar-track {
    background: transparent;
}

.report-content::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 3px;
}

.report-content::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.25);
}

/* ── Accessibility ─────────────────────────────────────────── */

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ── Responsive ────────────────────────────────────────────── */

@media (max-width: 600px) {
    body {
        padding: 1rem;
    }

    .card {
        padding: 1.25rem;
    }

    .report-actions {
        flex-direction: column;
    }

    h1 {
        font-size: 1.4rem;
    }
}
