/* =============================================
   Upload page
   ============================================= */

/* Hero */
.upload-hero {
    text-align: center;
    padding: 3.5rem 1.5rem 3rem;
    background: var(--surface-container-lowest);
    border-bottom: 1px solid rgba(190, 200, 201, 0.15);
}

.upload-hero-label {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    color: var(--primary);
    text-transform: uppercase;
    margin: 0 0 0.5rem;
}

.upload-hero-title {
    font-size: clamp(2rem, 5vw, 3rem);
    font-weight: 800;
    color: var(--on-surface);
    margin: 0 0 0.5rem;
    line-height: 1.15;
}

.upload-hero-subtitle {
    font-size: 1rem;
    color: var(--secondary);
    margin: 0;
}

/* Page grid */
.upload-page-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
    max-width: 72rem;
    margin: 0 auto;
    padding: 2rem 1.5rem 3rem;
    align-items: start;
}

@media (min-width: 768px) {
    .upload-page-grid {
        grid-template-columns: 1fr 22rem;
    }
}

/* Main left panel */
.upload-main-panel {
    background: var(--surface-container-lowest);
    border: 1px solid var(--outline-variant);
    border-radius: 1rem;
    overflow: hidden;
}

/* Drop zone */
.upload-dropzone {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 3rem 2rem;
    cursor: pointer;
    transition: background 0.2s;
    user-select: none;
    outline: none;
}

.upload-dropzone:hover,
.upload-dropzone:focus,
.upload-dropzone.drag-over {
    background: rgba(0, 69, 87, 0.04);
}

.upload-dropzone.drag-over {
    box-shadow: inset 0 0 0 2px var(--primary);
}

.upload-dropzone-icon-wrap {
    width: 4rem;
    height: 4rem;
    background: rgba(0, 69, 87, 0.12);
    border-radius: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.25rem;
    color: var(--primary);
}

.upload-dropzone-icon-wrap .material-symbols-outlined {
    font-size: 2rem;
}

.upload-dropzone-heading {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--on-surface);
    margin: 0 0 0.4rem;
    text-align: center;
}

.upload-dropzone-sub {
    font-size: 0.8125rem;
    color: var(--secondary);
    margin: 0 0 1rem;
    text-align: center;
}

.upload-format-badges {
    display: flex;
    justify-content: center;
    gap: 0.4rem;
}

.upload-format-badge {
    font-size: 0.6875rem;
    font-weight: 700;
    padding: 0.15rem 0.55rem;
    border-radius: 0.25rem;
    border: 1px solid var(--outline-variant);
    color: var(--secondary);
    background: var(--surface-container-low);
    letter-spacing: 0.04em;
}

/* Selected files list (JS) */
.upload-selected-list {
    list-style: none;
    padding: 0 1.5rem;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.upload-selected-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.6rem;
    background: var(--surface-container-low);
    border-radius: 0.4rem;
    font-size: 0.8125rem;
}

.upload-selected-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.upload-selected-size {
    color: var(--secondary);
    font-size: 0.75rem;
    flex-shrink: 0;
}

.upload-remove-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    color: var(--secondary);
    display: flex;
    flex-shrink: 0;
}

/* Submit row */
.upload-submit-row {
    padding: 0.75rem 1.5rem 1rem;
    justify-content: flex-end;
}

/* Divider */
.upload-divider {
    height: 1px;
    background: var(--outline-variant);
    opacity: 0.4;
    margin: 0 1.5rem;
}

/* Files section */
.upload-files-details {
    /* no extra styles needed */
}

.upload-files-details summary {
    list-style: none;
}

.upload-files-details summary::-webkit-details-marker {
    display: none;
}

.upload-files-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.875rem 1.5rem;
    cursor: pointer;
}

.upload-files-title {
    font-size: 0.8125rem;
    font-weight: 700;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.upload-file-count-badge {
    background: var(--surface-container-high);
    color: var(--secondary);
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0.15rem 0.55rem;
    border-radius: 1rem;
}

.upload-expand-icon {
    font-size: 1.25rem;
    color: var(--secondary);
    transition: transform 0.2s;
}

details[open] .upload-expand-icon {
    transform: rotate(180deg);
}

/* Files table */
.upload-files-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8125rem;
}

.upload-files-table th {
    text-align: left;
    padding: 0.6rem 1.5rem;
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--secondary);
    background: var(--surface-container-low);
    border-top: 1px solid rgba(190, 200, 201, 0.3);
    border-bottom: 1px solid rgba(190, 200, 201, 0.3);
}

.upload-files-table td {
    padding: 0.75rem 1.5rem;
    border-bottom: 1px solid rgba(190, 200, 201, 0.12);
    color: var(--on-surface);
    vertical-align: middle;
}

.upload-files-table tr:last-child td {
    border-bottom: none;
}

.upload-table-empty {
    text-align: center;
    padding: 2.5rem 1.5rem;
    color: var(--secondary);
    font-size: 0.875rem;
}

.upload-table-empty .material-symbols-outlined {
    font-size: 2rem;
    display: block;
    margin-bottom: 0.5rem;
    opacity: 0.4;
}

.upload-table-error {
    padding: 0.75rem 1.5rem;
    color: #dc2626;
    font-size: 0.875rem;
}

/* Status badges */
.file-status-badge {
    display: inline-block;
    padding: 0.18rem 0.65rem;
    border-radius: 1rem;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.file-status-badge--klar {
    background: rgba(34, 197, 94, 0.12);
    color: #15803d;
}

.file-status-badge--behandlas {
    background: rgba(59, 130, 246, 0.12);
    color: #1d4ed8;
}

.file-status-badge--misslyckades {
    background: rgba(239, 68, 68, 0.12);
    color: #dc2626;
}

.file-status-badge--pending {
    background: var(--surface-container-high);
    color: var(--secondary);
}

/* ---- Right sidebar ---- */
.upload-sidebar {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.upload-sidebar-card {
    background: var(--surface-container-lowest);
    border: 1px solid var(--outline-variant);
    border-radius: 0.75rem;
    padding: 1.125rem 1.25rem;
}

.upload-sidebar-card-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.6rem;
}

.upload-sidebar-card-header .material-symbols-outlined {
    font-size: 1.125rem;
    color: var(--primary);
}

.upload-sidebar-card-header h3 {
    font-size: 0.8125rem;
    font-weight: 700;
    color: var(--primary);
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.upload-sidebar-card-desc {
    font-size: 0.8rem;
    color: var(--secondary);
    margin: 0 0 0.75rem;
    line-height: 1.45;
}

.upload-capacity-track {
    height: 4px;
    background: var(--surface-container-high);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 0.4rem;
}

.upload-capacity-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 2px;
    transition: width 0.3s;
}

.upload-capacity-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.6875rem;
    font-weight: 700;
    color: var(--secondary);
    letter-spacing: 0.05em;
}

.upload-demo-note {
    margin-top: 0.6rem;
    font-size: 0.75rem;
    color: var(--secondary);
}

.upload-guidelines-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.upload-guidelines-list li {
    display: flex;
    gap: 0.5rem;
    align-items: flex-start;
    font-size: 0.8125rem;
    color: var(--secondary);
    line-height: 1.4;
}

.upload-check-icon {
    font-size: 0.9rem !important;
    color: #22c55e;
    flex-shrink: 0;
    margin-top: 0.15rem;
}

/* Security card */
.upload-security-card {
    background: var(--primary);
    color: var(--on-primary);
    border-radius: 0.75rem;
    padding: 1rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.upload-security-icon {
    font-size: 1.75rem;
    opacity: 0.9;
}

.upload-security-title {
    font-size: 0.8125rem;
    font-weight: 700;
    margin: 0 0 0.2rem;
}

.upload-security-desc {
    font-size: 0.75rem;
    margin: 0;
    color: rgba(255,255,255,0.75);
}

/* Disabled notice */
.upload-disabled-notice {
    background: var(--surface-container-low);
    border: 1px solid var(--outline-variant);
    border-radius: 0.75rem;
    padding: 2rem;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    color: var(--secondary);
    font-size: 0.875rem;
}

.upload-disabled-notice .material-symbols-outlined {
    font-size: 2.5rem;
    opacity: 0.5;
}

/* =============================================
   Flash alerts (bottom toasts)
   ============================================= */

@keyframes toast-in {
    from {
        opacity: 0;
        transform: translateY(1.5rem);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes toast-out {
    from {
        opacity: 1;
        transform: translateY(0);
        max-height: 8rem;
        margin-bottom: 0.5rem;
    }
    to {
        opacity: 0;
        transform: translateY(1.5rem);
        max-height: 0;
        margin-bottom: 0;
    }
}

.toast-container {
    position: fixed;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    width: min(calc(100vw - 2rem), 42rem);
    pointer-events: none;
}

.alert {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    border-radius: 0.75rem;
    border: 1px solid transparent;
    border-left-width: 4px;
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1.5;
    width: 100%;
    box-sizing: border-box;
    background: #ffffff;
    box-shadow: 0 8px 32px -4px rgba(25, 28, 30, 0.18), 0 2px 8px rgba(25, 28, 30, 0.08);
    color: #191c1e;
    pointer-events: auto;
    animation: toast-in 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.alert.is-hiding {
    animation: toast-out 0.35s ease-in both;
}

.alert .alert-icon {
    flex-shrink: 0;
    font-variation-settings: 'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' 24;
    font-size: 1.25rem;
}

.alert-success {
    border-left-color: #004557;
}

.alert-success .alert-icon {
    color: #004557;
}

.alert-danger {
    border-left-color: #ba1a1a;
}

.alert-danger .alert-icon {
    color: #ba1a1a;
}

[data-theme="dark"] .alert {
    background: #1e2729;
    color: #eff1f3;
    box-shadow: 0 8px 32px -4px rgba(0, 0, 0, 0.45), 0 2px 8px rgba(0, 0, 0, 0.25);
}

[data-theme="dark"] .alert-success {
    border-left-color: #81d1f0;
}

[data-theme="dark"] .alert-success .alert-icon {
    color: #81d1f0;
}

[data-theme="dark"] .alert-danger {
    border-left-color: #ffb4ab;
}

[data-theme="dark"] .alert-danger .alert-icon {
    color: #ffb4ab;
}

