@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* =========================================
   1. CRITICAL BLAZOR DEFAULT STYLES
   (Do not remove, required for loading screen)
   ========================================= */
html, body {
    font-family: 'Inter', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    background-color: #f8fafc; /* Light gray background */
    color: #334155;
    margin: 0;
    padding: 0;
}

#blazor-error-ui {
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}

.loading-progress {
    position: relative;
    display: block;
    width: 8rem;
    height: 8rem;
    margin: 20vh auto 1rem auto;
}

.loading-progress circle {
    fill: none;
    stroke: #e0e0e0;
    stroke-width: 0.6rem;
    transform-origin: 50% 50%;
    transform: rotate(-90deg);
}

.loading-progress circle:last-child {
    stroke: #2563eb;
    stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%;
    transition: stroke-dasharray 0.05s ease-in-out;
}

.loading-progress-text {
    position: absolute;
    text-align: center;
    font-weight: bold;
    inset: calc(20vh + 3.25rem) 0 auto 0.2rem;
}

.loading-progress-text:after {
    content: var(--blazor-load-percentage-text, "Loading");
}

/* =========================================
   2. CUSTOM APP UI STYLES
   ========================================= */

:root {
    --primary: #2563eb;       /* Blue 600 */
    --primary-hover: #1d4ed8; /* Blue 700 */
    --success: #16a34a;       /* Green 600 */
    --surface: #ffffff;
    --border: #e2e8f0;
    --text-main: #334155;
    --text-muted: #64748b;
}

.app-container {
    max-width: 1000px;
    margin: 3rem auto;
    padding: 0 1.5rem;
}

/* Header */
.app-header {
    text-align: center;
    margin-bottom: 3rem;
}

.app-title {
    font-size: 2rem;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 0.5rem;
}

.app-subtitle {
    color: var(--text-muted);
    font-size: 1.1rem;
}

/* Grid Layout */
.card-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-bottom: 3rem;
}

@media (max-width: 768px) {
    .card-grid { grid-template-columns: 1fr; }
}

/* Cards */
.upload-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
    height: 100%;
    display: flex;
    flex-direction: column;
}

.card-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.text-primary { color: var(--primary) !important; }
.text-success { color: var(--success) !important; }

/* Upload Area Styling */
.input-group-stack {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    flex: 1;
}

.file-drop-area {
    position: relative; /* Essential for overlaying input */
    border: 2px dashed #cbd5e1;
    border-radius: 8px;
    padding: 1.5rem 1rem;
    text-align: center;
    background-color: #f8fafc;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.file-drop-area:hover {
    border-color: var(--primary);
    background-color: #eff6ff;
}

/* Make the actual input invisible but clickable over the entire area */
.file-drop-area input[type="file"] {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    z-index: 10;
}

.drop-label {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-main);
    pointer-events: none; /* Let clicks pass to input */
}

.drop-sub {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
    pointer-events: none;
}

.badge-count {
    margin-top: 0.75rem;
    font-size: 0.75rem;
    background: #e2e8f0;
    color: #475569;
    padding: 2px 10px;
    border-radius: 99px;
    font-weight: 600;
    pointer-events: none;
}

.badge-count.active {
    background: var(--primary);
    color: white;
}

/* Action Button */
.action-container {
    text-align: center;
    margin-bottom: 3rem;
    padding-top: 30px;
}

.btn-process {
    background: var(--primary);
    color: white;
    border: none;
    font-size: 1.1rem;
    font-weight: 600;
    padding: 0.75rem 3rem;
    border-radius: 99px;
    cursor: pointer;
    box-shadow: 0 4px 6px -1px rgba(37, 99, 235, 0.3);
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-process:hover:not(:disabled) {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(37, 99, 235, 0.4);
}

.btn-process:disabled {
    background: #94a3b8;
    cursor: not-allowed;
    box-shadow: none;
}

/* Results / Log */
.result-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.result-header {
    background: #f1f5f9;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.btn-download {
    background: var(--success);
    color: white;
    border: none;
    padding: 0.5rem 1.25rem;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-download:hover {
    background: #15803d;
}

.log-viewer {
    background: #1e293b;
    color: #e2e8f0;
    padding: 1rem;
    font-family: 'Consolas', monospace;
    font-size: 0.85rem;
    max-height: 400px;
    overflow-y: auto;
}

.log-line {
    display: flex;
    gap: 1rem;
    padding: 4px 0;
    border-bottom: 1px solid #334155;
}

.log-line:last-child {
    border-bottom: none;
}

.log-tag {
    font-weight: bold;
    font-size: 0.7rem;
    text-transform: uppercase;
    padding: 2px 8px;
    border-radius: 4px;
    min-width: 80px;
    text-align: center;
    height: fit-content;
}

.tag-info { background: #3b82f6; color: white; }
.tag-warn { background: #eab308; color: black; }
.tag-error { background: #ef4444; color: white; }
.tag-forbidden { background: #ef4444; color: white; }