/* Dark Theme Styles - Matching CARBONEX Design */

:root {
    --bg-primary: #03111E;
    --bg-secondary: #0C1B29;
    --bg-card: #1E293B;
    --bg-hover: #253548;
    --text-primary: #FFFFFF;
    --text-secondary: #CBD5E1;
    --accent-blue: #3B82F6;
    --accent-blue-hover: #2563EB;
    --border-color: #334155;
    --success-green: #10B981;
    --error-red: #EF4444;
    --warning-yellow: #F59E0B;
}

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

body.dark-theme {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
}

.app-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Top Header */
.top-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 2rem;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    height: 70px;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.menu-toggle {
    background: none;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    padding: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s;
}

.menu-toggle--disabled {
    cursor: not-allowed;
    opacity: 0.45;
    pointer-events: none;
}

.menu-toggle:hover {
    opacity: 0.85;
}

.menu-toggle img {
    height: 24px;
    width: 24px;
    display: block;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo-icon {
    width: 40px;
    height: 40px;
    background: var(--accent-blue);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1.5rem;
    color: white;
}

.logo-text {
    display: flex;
    flex-direction: column;
}

.logo-main {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
}

.logo-sub {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.header-center {
    flex: 1;
    max-width: 500px;
    margin: 0 2rem;
}

.search-bar {
    position: relative;
    width: 100%;
}

.search-bar input {
    width: 100%;
    padding: 0.75rem 1rem 0.75rem 2.5rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.9rem;
}

.search-bar input:focus {
    outline: none;
    border-color: var(--accent-blue);
}

.search-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-name {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.btn-logout {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9rem;
    padding: 0.4rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    transition: color 0.2s, border-color 0.2s;
}

.btn-logout:hover {
    color: var(--text-primary);
    border-color: var(--accent-blue);
}

.icon-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0.5rem;
    transition: color 0.2s;
}

.icon-btn:hover {
    color: var(--text-primary);
}

.user-profile {
    display: flex;
    align-items: center;
}

.profile-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--bg-card);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

/* Main Layout */
.main-layout {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* Sidebars */
.left-sidebar,
.right-sidebar {
    width: 70px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    padding: 1rem 0;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.right-sidebar {
    border-right: none;
    border-left: 1px solid var(--border-color);
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    width: 100%;
}

.nav-item {
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    border-radius: 8px;
    margin: 0 auto;
    transition: all 0.2s;
}

.nav-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.nav-item.active {
    background: var(--accent-blue);
    color: white;
}

/* Main Content */
.main-content {
    flex: 1;
    overflow-y: auto;
    padding: 2rem;
    background: var(--bg-primary);
}

/* Main content inner - aligns with page cards */
.main-content-inner {
    max-width: 900px;
    margin: 0 auto;
    width: 100%;
}

/* Top-of-page back link - top-left per standard UX */
.page-top-bar {
    display: flex;
    justify-content: flex-start;
    margin-bottom: 0.5rem;
}

.link-back {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: none;
    border: none;
    padding: 0.4rem 0.5rem;
    color: var(--text-secondary);
    font-size: 0.875rem;
    cursor: pointer;
    transition: color 0.2s;
    border-radius: 6px;
}

.link-back:hover {
    color: var(--accent-blue);
    background: rgba(59, 130, 246, 0.08);
}

.link-back-icon {
    font-size: 1rem;
    line-height: 1;
}

/* Powered by branding */
.powered-by {
    position: fixed;
    bottom: 0.5rem;
    right: 1rem;
    font-size: 0.75rem;
    color: var(--text-secondary);
    opacity: 0.85;
}

/* Page Container */
.page-container {
    max-width: 900px;
    margin: 0 auto;
}

.page-container--narrow {
    max-width: 640px;
}

.page-header {
    margin-bottom: 2rem;
}

.page-title {
    font-size: 2rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.page-subtitle {
    font-size: 1.25rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.page-description {
    font-size: 1rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 0.5rem;
}

.page-hint {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-style: italic;
}

/* Home: centered welcome (proposal typography) */
.welcome-page {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: calc(100vh - 70px - 5rem);
    text-align: center;
    padding: 1rem;
}

.welcome-page__inner {
    max-width: min(100%, 48rem);
    width: 100%;
    font-family: Georgia, 'Times New Roman', Times, serif;
}

.welcome-page__title {
    font-size: clamp(1.65rem, 1.1rem + 2.8vw, 2.65rem);
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 0.75rem;
    line-height: 1.2;
    white-space: normal;
}

/* Keep the full heading on one line on typical desktop/tablet widths */
@media (min-width: 31.25rem) {
    .welcome-page__title {
        white-space: nowrap;
    }
}

.welcome-page__subtitle {
    margin: 0;
    font-size: clamp(0.95rem, 2.2vw, 1.05rem);
    font-weight: 400;
    color: var(--text-secondary);
    line-height: 1.5;
}

.welcome-page__modules {
    list-style: none;
    margin: 1.5rem 0 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: center;
}

.welcome-page__modules a {
    display: inline-block;
    padding: 0.85rem 1.5rem;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    background: var(--bg-card);
    color: var(--text-primary);
    text-decoration: none;
    font-family: inherit;
    font-size: 1rem;
    transition: border-color 0.15s ease, background 0.15s ease;
}

.welcome-page__modules a:hover {
    border-color: var(--accent-color, #4a9eff);
    background: var(--bg-hover, rgba(255, 255, 255, 0.04));
}

/* Cards */
.form-card,
.setup-card,
.upload-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 2rem;
    margin-bottom: 2rem;
}

.form-card--elevated {
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.25);
    padding: 2.25rem;
}

.setup-section {
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--border-color);
}

.setup-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.section-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: var(--text-primary);
}

.section-description {
    font-size: 1rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 1.5rem;
}

/* Form Elements */
.form-group {
    margin-bottom: 1.5rem;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.form-row--single {
    grid-template-columns: 1fr;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
}

.form-input,
.form-select {
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 1rem;
    transition: all 0.2s;
}

.form-input:focus,
.form-select:focus {
    outline: none;
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23CBD5E1' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    padding-right: 2.5rem;
}

/* Buttons */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-primary {
    background: var(--accent-blue);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: var(--accent-blue-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-secondary {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--bg-hover);
}

.btn-download {
    width: 100%;
    justify-content: center;
    margin-top: 1rem;
}

.form-actions {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 2rem;
}

.form-actions--spaced {
    margin-top: 2.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

/* Checkbox in forms */
.form-group--checkbox {
    display: flex;
    align-items: flex-end;
}

.checkbox-label {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 0;
    min-height: 2.75rem;
}

.checkbox-input {
    width: 1.25rem;
    height: 1.25rem;
    accent-color: var(--accent-blue);
    cursor: pointer;
    flex-shrink: 0;
}

.checkbox-text {
    color: var(--text-primary);
}

/* Upload Zone */
.upload-zone {
    border: 2px dashed var(--border-color);
    border-radius: 12px;
    padding: 3rem 2rem;
    text-align: center;
    background: var(--bg-secondary);
    transition: all 0.3s;
    cursor: pointer;
}

.upload-zone:hover {
    border-color: var(--accent-blue);
    background: var(--bg-hover);
}

.upload-zone.dragover {
    border-color: var(--accent-blue);
    background: rgba(59, 130, 246, 0.1);
}

.upload-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.upload-text {
    color: var(--text-primary);
    font-size: 1rem;
    margin-bottom: 0.5rem;
}

.upload-link {
    margin-bottom: 0.5rem;
}

.browse-link {
    color: var(--accent-blue);
    cursor: pointer;
    text-decoration: underline;
    font-weight: 500;
}

.browse-link:hover {
    color: var(--accent-blue-hover);
}

.upload-hint {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-top: 0.5rem;
}

.file-list,
.file-preview {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

.file-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem;
    background: var(--bg-card);
    border-radius: 8px;
    margin-bottom: 0.5rem;
}

.file-name {
    color: var(--text-primary);
    font-size: 0.9rem;
}

.file-size {
    color: var(--text-secondary);
    font-size: 0.8rem;
}

/* Loading State */
.loading-state {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 20, 25, 0.95);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.loading-state.hidden {
    display: none;
}

.spinner {
    width: 60px;
    height: 60px;
    border: 4px solid var(--border-color);
    border-top-color: var(--accent-blue);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.loading-text {
    margin-top: 1.5rem;
    color: var(--text-primary);
    font-size: 1.1rem;
}

.loading-sub {
    margin-top: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.95rem;
    max-width: 28rem;
    text-align: center;
    line-height: 1.45;
}
.upload-progress-frame {
    margin-top: 1.25rem;
    /* width: ; */
}
.upload-progress-bar {
    height: 8px;
    background: var(--border-color);
    border-radius: 4px;
    overflow: hidden;
}
.upload-progress-fill {
    height: 100%;
    background: var(--accent-blue);
    border-radius: 4px;
    transition: width 0.12s ease-out;
}
.upload-progress-meta {
    margin-top: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
    text-align: center;
}

.hidden {
    display: none !important;
}

.timeout-message {
    margin-top: 1.5rem;
    max-width: 420px;
    text-align: center;
}

.timeout-message p {
    margin-bottom: 0.75rem;
    color: var(--text-secondary);
    font-size: 1rem;
}

.timeout-message .timeout-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    justify-content: center;
    margin-top: 1.25rem;
}

.download-btn--pending {
    opacity: 0.85;
    cursor: default;
    pointer-events: none;
}

.inline-spinner {
    width: 22px;
    height: 22px;
    border: 3px solid var(--border-color);
    border-top-color: var(--accent-blue);
    border-radius: 50%;
    animation: spin 0.9s linear infinite;
}

/* Success Message */
.success-message {
    background: var(--success-green);
    color: white;
    padding: 1rem 1.5rem;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 2rem;
}

.success-icon {
    font-size: 1.5rem;
}

/* Error Message */
.error-message {
    background: var(--error-red);
    color: white;
    padding: 1.5rem;
    border-radius: 8px;
    margin-bottom: 2rem;
    text-align: center;
}

.error-message p {
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.warning-message {
    background: rgba(245, 158, 11, 0.15);
    border: 1px solid var(--warning-yellow);
    color: var(--text-primary);
    padding: 1rem 1.25rem;
    border-radius: 8px;
    margin-top: 1rem;
    margin-bottom: 1.5rem;
    font-size: 0.95rem;
}

.warning-message p {
    margin: 0;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 20, 25, 0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    color: var(--text-primary);
}

.loading-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid var(--border-color);
    border-top-color: var(--accent-blue);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

/* Modal (for errors and alerts) */
.modal {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1100;
}

.modal.hidden {
    display: none;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.8);
}

.modal-dialog {
    position: relative;
    z-index: 1;
    background: var(--bg-card);
    border-radius: 12px;
    padding: 1.75rem 2rem 1.5rem;
    max-width: 420px;
    width: 90%;
    box-shadow: 0 20px 40px rgba(15, 23, 42, 0.6);
}

.modal-dialog--error {
    border: 1px solid var(--error-red);
}

.modal-title {
    margin: 0 0 0.5rem 0;
    font-size: 1.2rem;
    color: var(--text-primary);
}

.modal-message {
    margin: 0 0 1.25rem 0;
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
}

.modal-close {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.2rem;
    cursor: pointer;
}

.modal-close:hover {
    color: var(--text-primary);
}

/* Results Page */
.results-container {
    text-align: center;
}

.download-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.download-btn {
    padding: 1.5rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    text-decoration: none;
    color: var(--text-primary);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    transition: all 0.2s;
}

.download-btn:hover {
    border-color: var(--accent-blue);
    background: var(--bg-hover);
    transform: translateY(-2px);
}

.download-btn-icon {
    font-size: 2.5rem;
}

.download-btn-text {
    font-size: 0.9rem;
    font-weight: 500;
}

/* Utility Classes */
.link-secondary {
    color: var(--accent-blue);
    font-size: 0.9rem;
    text-decoration: none;
}

.link-secondary:hover {
    text-decoration: underline;
    color: var(--accent-blue-hover);
}

.hidden {
    display: none !important;
}

.text-center {
    text-align: center;
}

.mt-2 {
    margin-top: 2rem;
}

/* Responsive */
@media (max-width: 768px) {
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .left-sidebar,
    .right-sidebar {
        width: 60px;
    }
    
    .main-content {
        padding: 1rem;
    }
    
    .download-section {
        grid-template-columns: 1fr;
    }
}

/* Hamburger modules drawer */
.nav-drawer {
    position: fixed;
    inset: 0;
    z-index: 2000;
    pointer-events: none;
    visibility: hidden;
}

.nav-drawer.nav-drawer--open {
    pointer-events: auto;
    visibility: visible;
}

.nav-drawer-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.65);
    opacity: 0;
    transition: opacity 0.2s;
}

.nav-drawer--open .nav-drawer-backdrop {
    opacity: 1;
}

.nav-drawer-panel {
    position: absolute;
    top: 0;
    left: 0;
    width: min(280px, 90vw);
    height: 100%;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    box-shadow: 8px 0 24px rgba(0, 0, 0, 0.35);
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    padding: 0;
}

.nav-drawer--open .nav-drawer-panel {
    transform: translateX(0);
}

.nav-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
}

.nav-drawer-title {
    font-weight: 600;
    color: var(--text-primary);
}

.nav-drawer-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    padding: 0.25rem;
}

.nav-drawer-close:hover {
    color: var(--text-primary);
}

.nav-drawer-list {
    list-style: none;
    margin: 0;
    padding: 0.75rem 0;
}

.nav-drawer-list a {
    display: block;
    padding: 0.85rem 1.25rem;
    color: var(--text-secondary);
    text-decoration: none;
    transition: background 0.15s, color 0.15s;
}

.nav-drawer-list a:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

/* PDF Duplicate Review module */
.pdf-dup-page .pdf-dup-upload-zone {
    cursor: pointer;
}

.pdf-dup-scan-stage {
    margin-top: 1rem;
    width: min(100%, 42rem);
}

.pdf-dup-scan-hint {
    margin-top: 0.35rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-align: center;
}

.pdf-dup-scan-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    justify-content: center;
    align-content: flex-start;
    max-height: min(42vh, 380px);
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0.5rem;
    margin-top: 0.5rem;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.pdf-dup-scan-thumb {
    width: 64px;
    height: auto;
    max-height: 90px;
    object-fit: contain;
    border: 2px solid var(--border-color);
    border-radius: 4px;
    background: #0f172a;
}

.pdf-dup-scan-thumb--dup {
    border-color: var(--warning-yellow);
    box-shadow: 0 0 0 1px rgba(245, 158, 11, 0.35);
}

.pdf-dup-file-name {
    margin-top: 0.75rem;
    color: var(--accent-blue);
    font-size: 0.9rem;
}

.pdf-dup-review .pdf-dup-top {
    margin-bottom: 1rem;
}

.pdf-dup-info {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.pdf-dup-loading-overlay {
    position: fixed;
    inset: 0;
    z-index: 10050;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(15, 23, 42, 0.72);
    backdrop-filter: blur(2px);
}

.pdf-dup-loading-overlay.hidden {
    display: none !important;
}

.pdf-dup-loading-inner {
    text-align: center;
    padding: 1.5rem 2rem;
    border-radius: 12px;
    background: var(--bg-card, #1e293b);
    border: 1px solid var(--border-color, #334155);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
    max-width: 22rem;
}

.pdf-dup-spinner {
    width: 44px;
    height: 44px;
    margin: 0 auto 1rem;
    border: 3px solid rgba(148, 163, 184, 0.35);
    border-top-color: var(--accent-blue, #3b82f6);
    border-radius: 50%;
    animation: pdf-dup-spin 0.75s linear infinite;
}

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

.pdf-dup-loading-text {
    margin: 0;
    font-size: 0.95rem;
    line-height: 1.45;
    color: var(--text-primary, #f1f5f9);
}

.pdf-dup-panels {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1.5rem;
    align-items: start;
}

@media (max-width: 900px) {
    .pdf-dup-panels {
        grid-template-columns: 1fr;
    }
}

.pdf-dup-panel {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
}

.pdf-dup-panel-label {
    background: var(--bg-hover);
    padding: 0.5rem 0.75rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-align: center;
    border-bottom: 1px solid var(--border-color);
}

.pdf-dup-img-wrap {
    background: #e2e8f0;
    text-align: center;
    max-height: 70vh;
    overflow: auto;
}

.pdf-dup-img {
    max-width: 100%;
    height: auto;
    vertical-align: top;
    display: inline-block;
}

.pdf-dup-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.pdf-dup-controls .pdf-dup-save {
    margin-left: auto;
}

.pdf-dup-save--highlight {
    box-shadow: 0 0 0 2px var(--accent-blue), 0 0 16px rgba(59, 130, 246, 0.45);
    animation: pdf-dup-pulse 1.5s ease-in-out infinite;
}

@keyframes pdf-dup-pulse {
    50% {
        box-shadow: 0 0 0 3px var(--accent-blue-hover), 0 0 20px rgba(59, 130, 246, 0.55);
    }
}

.pdf-dup-key {
    opacity: 0.75;
    font-size: 0.85em;
}

.pdf-dup-hint {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* Django messages (flash alerts) */
.app-messages {
    margin-bottom: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.app-message {
    padding: 0.85rem 1rem;
    border-radius: 8px;
    font-size: 0.95rem;
    line-height: 1.45;
}

.app-message--error,
.app-message--debug {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid var(--error-red);
    color: var(--text-primary);
}

.app-message--success {
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid var(--success-green);
    color: var(--text-primary);
}

.app-message--info,
.app-message {
    background: rgba(59, 130, 246, 0.12);
    border: 1px solid var(--accent-blue);
    color: var(--text-secondary);
}

.app-message--warning {
    background: rgba(245, 158, 11, 0.15);
    border: 1px solid var(--warning-yellow);
    color: var(--text-primary);
}

