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

:root {
    --bg-dark: #0f172a;
    --bg-panel: rgba(30, 41, 59, 0.7);
    --border-color: rgba(255, 255, 255, 0.1);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --accent-blue: #3b82f6;
    --accent-green: #10b981;
    --accent-red: #ef4444;
    --accent-warning: #f59e0b;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Header */
header {
    height: 70px;
    background: var(--bg-panel);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 2rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, #60a5fa, #a78bfa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.header-actions {
    display: flex;
    gap: 1rem;
}

.btn {
    padding: 0.5rem 1.25rem;
    border-radius: 8px;
    font-weight: 500;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid transparent;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-reject {
    background: rgba(239, 68, 68, 0.1);
    color: var(--accent-red);
    border-color: rgba(239, 68, 68, 0.2);
}

.btn-reject:hover {
    background: rgba(239, 68, 68, 0.2);
}

.btn-approve {
    background: var(--accent-blue);
    color: white;
    box-shadow: 0 0 15px rgba(59, 130, 246, 0.4);
}

.btn-approve:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.6);
}

/* Main Workspace */
.workspace {
    display: flex;
    height: calc(100vh - 70px);
}

/* Sidebar (Left) */
.sidebar {
    width: 280px;
    background: var(--bg-dark);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

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

.sidebar-header h2 {
    font-size: 1.125rem;
    font-weight: 600;
}

.sidebar-section {
    padding: 1rem;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.sidebar-section h3 {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
}

.buyer-list {
    list-style: none;
}

.buyer-item {
    padding: 0.75rem 1rem;
    margin-bottom: 0.25rem;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-muted);
}

.buyer-item:hover {
    background: rgba(255,255,255,0.05);
    color: white;
}

.buyer-item.active {
    background: rgba(59, 130, 246, 0.15);
    color: var(--accent-blue);
    font-weight: 600;
}

.doc-history-item {
    padding: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 4px;
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 0.25rem;
}

.doc-history-item:hover {
    background: rgba(255,255,255,0.05);
    color: white;
}

/* PDF Viewer Side (Middle) */
.pdf-viewer {
    flex: 1;
    background: #1e293b;
    border-right: 1px solid var(--border-color);
    position: relative;
    padding: 2rem;
    display: flex;
    justify-content: center;
    overflow-y: auto;
}

.pdf-page {
    width: 100%;
    max-width: 800px;
    aspect-ratio: 1 / 1.414; /* A4 Ratio */
    background: white;
    border-radius: 4px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.5);
    position: relative;
    padding: 3rem;
    color: #333;
}

.pdf-header {
    border-bottom: 2px solid #ccc;
    padding-bottom: 1rem;
    margin-bottom: 2rem;
    text-align: center;
}

/* Bounding Box Highlights on PDF */
.bounding-box {
    position: absolute;
    border: 2px solid var(--accent-warning);
    background: rgba(245, 158, 11, 0.1);
    border-radius: 4px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 0;
    pointer-events: none;
}

.bounding-box.active {
    opacity: 1;
    transform: scale(1.02);
    box-shadow: 0 0 15px rgba(245, 158, 11, 0.5);
}

/* Extracted Data Side (Right) */
.extracted-data {
    width: 450px;
    background: var(--bg-dark);
    display: flex;
    flex-direction: column;
}

.data-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.data-header h2 {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.data-header p {
    color: var(--text-muted);
    font-size: 0.875rem;
}

.data-body {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

/* Form Groups */
.form-group {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1rem;
    transition: all 0.2s ease;
    position: relative;
}

.form-group:hover, .form-group.focused {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(59, 130, 246, 0.5);
    transform: translateX(4px);
}

.form-label-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.form-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    font-weight: 600;
}

.confidence-badge {
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
}

.confidence-high { background: rgba(16, 185, 129, 0.15); color: var(--accent-green); }
.confidence-med { background: rgba(245, 158, 11, 0.15); color: var(--accent-warning); }
.confidence-low { background: rgba(239, 68, 68, 0.15); color: var(--accent-red); }

.form-input {
    width: 100%;
    background: transparent;
    border: none;
    color: var(--text-main);
    font-size: 1rem;
    font-weight: 500;
    outline: none;
    padding: 0.25rem 0;
    border-bottom: 1px solid transparent;
    transition: border-color 0.2s;
}

.form-input:focus {
    border-bottom-color: var(--accent-blue);
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.form-group {
    animation: fadeIn 0.4s ease forwards;
    opacity: 0;
}

.form-group:nth-child(1) { animation-delay: 0.1s; }
.form-group:nth-child(2) { animation-delay: 0.15s; }
.form-group:nth-child(3) { animation-delay: 0.2s; }
.form-group:nth-child(4) { animation-delay: 0.25s; }
.form-group:nth-child(5) { animation-delay: 0.3s; }

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* ==========================================================================
   Master Settings Menu & Control Center Styles
   ========================================================================== */

.settings-modal-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    z-index: 1200;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    animation: fadeIn 0.2s ease-out;
}

.settings-window {
    background: #0f172a;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 16px;
    width: 1040px;
    max-width: 95vw;
    height: 720px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.8), 0 0 40px rgba(139, 92, 246, 0.1);
    overflow: hidden;
}

.settings-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 1.75rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(30, 41, 59, 0.4);
}

.settings-header-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.settings-header-title i {
    font-size: 1.6rem;
    color: #a78bfa;
}

.settings-header-title h2 {
    font-size: 1.2rem;
    font-weight: 700;
    color: white;
    margin: 0;
    letter-spacing: -0.3px;
}

.settings-header-title span {
    font-size: 0.8rem;
    color: #94a3b8;
    margin-left: 0.25rem;
}

.settings-body {
    display: flex;
    flex: 1;
    overflow: hidden;
}

.settings-nav {
    width: 240px;
    background: rgba(15, 23, 42, 0.6);
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    padding: 1rem 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    overflow-y: auto;
}

.settings-nav-btn {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    background: transparent;
    border: 1px solid transparent;
    color: #94a3b8;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    text-align: left;
    transition: all 0.2s ease;
}

.settings-nav-btn i {
    font-size: 1.2rem;
}

.settings-nav-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #f8fafc;
}

.settings-nav-btn.active {
    background: rgba(139, 92, 246, 0.15);
    border-color: rgba(139, 92, 246, 0.4);
    color: #c4b5fd;
    font-weight: 600;
}

.settings-content-area {
    flex: 1;
    padding: 1.75rem 2rem;
    overflow-y: auto;
    background: #0f172a;
}

.settings-panel {
    display: none;
    flex-direction: column;
    gap: 1.5rem;
    animation: fadeIn 0.2s ease;
}

.settings-panel.active {
    display: flex;
}

.settings-section-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: #f8fafc;
    margin-bottom: 0.25rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.settings-section-desc {
    font-size: 0.85rem;
    color: #94a3b8;
    margin-bottom: 1rem;
}

.settings-card {
    background: rgba(30, 41, 59, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.settings-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.settings-input-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.settings-input-group label {
    font-size: 0.8rem;
    font-weight: 600;
    color: #cbd5e1;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.settings-input {
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 6px;
    padding: 0.65rem 0.85rem;
    color: white;
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.2s;
}

.settings-input:focus {
    border-color: #8b5cf6;
    box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.2);
}

.settings-stat-badge {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.settings-stat-badge .stat-num {
    font-size: 1.25rem;
    font-weight: 700;
    color: #38bdf8;
}

.settings-stat-badge .stat-label {
    font-size: 0.75rem;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Custom Switch Toggle */
.switch-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
}

.switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background-color: rgba(255, 255, 255, 0.15);
    transition: .3s;
    border-radius: 24px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .3s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: #8b5cf6;
}

input:checked + .slider:before {
    transform: translateX(20px);
}

.settings-range-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.15);
    outline: none;
}

.settings-range-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #8b5cf6;
    cursor: pointer;
    box-shadow: 0 0 10px rgba(139, 92, 246, 0.5);
    transition: transform 0.1s;
}

.settings-range-slider::-webkit-slider-thumb:hover {
    transform: scale(1.15);
}

.settings-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.75rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(30, 41, 59, 0.4);
}

/* ERP Editor & Entity Management */
.erp-subtab-btn {
    transition: all 0.2s ease;
}
.erp-subtab-btn:hover {
    color: white !important;
}
.erp-subtab-btn.active {
    background: #6366f1 !important;
    color: white !important;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.4);
}

.erp-table tr {
    transition: background 0.15s ease;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}
.erp-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.04);
}
.erp-table td {
    padding: 0.6rem 0.9rem;
    color: #cbd5e1;
    vertical-align: middle;
}

.erp-id-badge {
    background: rgba(99, 102, 241, 0.15);
    color: #a5b4fc;
    border: 1px solid rgba(99, 102, 241, 0.3);
    border-radius: 4px;
    padding: 0.15rem 0.45rem;
    font-size: 0.75rem;
    font-weight: 600;
    font-family: monospace;
    display: inline-block;
}

.settings-stat-badge.interactive {
    cursor: pointer;
    transition: all 0.2s ease;
}
.settings-stat-badge.interactive:hover {
    background: rgba(255, 255, 255, 0.09);
    border-color: rgba(168, 85, 247, 0.4);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.erp-action-btn {
    background: transparent;
    border: 1px solid transparent;
    border-radius: 4px;
    padding: 0.3rem 0.5rem;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.15s;
    color: #94a3b8;
}
.erp-action-btn.edit:hover {
    color: #a78bfa;
    background: rgba(167, 139, 250, 0.15);
    border-color: rgba(167, 139, 250, 0.3);
}
.erp-action-btn.delete:hover {
    color: #f87171;
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.3);
}


