/* ===== CSS Variables ===== */
:root {
    --primary: #d4af37; /* Royal Gold */
    --primary-hover: #b5952f;
    --primary-light: rgba(212, 175, 55, 0.15);
    --secondary: #3b82f6; /* Intermediate Light Blue */
    --secondary-dark: #2563eb;
    --success: #10b981;
    --success-light: #d1fae5;
    --warning: #f59e0b;
    --warning-light: #fef3c7;
    --danger: #ef4444;
    --danger-light: #fee2e2;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    --white: #ffffff;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --radius: 8px;
    --radius-lg: 12px;
    --glass-border: 1px solid var(--gray-200);
}

/* ===== Reset & Base ===== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--gray-50);
    color: var(--gray-800);
    line-height: 1.5;
    min-height: 100vh;
    overflow: hidden; /* Hide main body scroll to allow internal layout scrolling */
}

/* ===== App Layout ===== */
.app-container {
    display: flex;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
}

.sidebar {
    width: 260px;
    background: var(--white);
    border-right: 1px solid var(--gray-200);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    z-index: 200;
    box-shadow: var(--shadow-sm);
}

.sidebar-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--gray-100);
    display: flex;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--secondary-dark);
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 1.5rem 1rem;
    flex: 1;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    color: var(--gray-600);
    transition: all 0.2s;
    text-align: left;
}

.nav-item:hover {
    background: var(--gray-50);
    color: var(--secondary);
}

.nav-item.active {
    background: var(--secondary-dark);
    color: var(--white);
    box-shadow: var(--shadow);
}

.nav-item.active svg {
    color: var(--primary);
}

.main-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* ===== Header ===== */
.header {
    background: var(--secondary);
    color: var(--white);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-md);
}

.header-content {
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.page-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--white);
}

/* removed old logo classes */

/* ===== Status Badge ===== */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.375rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.875rem;
    font-weight: 500;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

.status-checking {
    background: var(--gray-100);
    color: var(--gray-600);
}

.status-checking .status-dot {
    background: var(--gray-400);
}

.status-connected {
    background: var(--success-light);
    color: var(--success);
}

.status-connected .status-dot {
    background: var(--success);
}

.status-disconnected {
    background: var(--danger-light);
    color: var(--danger);
}

.status-disconnected .status-dot {
    background: var(--danger);
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

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

/* ===== Card ===== */
.card {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    margin-bottom: 1.5rem;
    overflow: hidden;
}

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

.card-header h2 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--gray-800);
}

.card-header h2 svg {
    color: var(--secondary);
}

.card-body {
    padding: 1.5rem;
}

/* ===== Form ===== */
.upload-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--gray-700);
}

/* ===== Radio Group ===== */
.radio-group {
    display: flex;
    gap: 1rem;
}

.radio-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    padding: 0.75rem 1rem;
    border: 1px solid var(--gray-200);
    background: var(--white);
    border-radius: var(--radius);
    transition: all 0.2s;
}

.radio-label:hover {
    border-color: var(--primary);
    background: var(--primary-light);
}

.radio-label input {
    display: none;
}

.radio-custom {
    width: 20px;
    height: 20px;
    border: 2px solid var(--gray-300);
    border-radius: 50%;
    position: relative;
    transition: all 0.2s;
    background: var(--white);
}

.radio-label input:checked + .radio-custom {
    border-color: var(--primary);
}

.radio-label input:checked + .radio-custom::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 10px;
    height: 10px;
    background: var(--primary);
    border-radius: 50%;
}

.radio-label input:checked ~ .radio-text {
    color: var(--primary);
    font-weight: 500;
}

.radio-text {
    font-size: 0.9375rem;
    color: var(--gray-700);
}

/* ===== File Upload ===== */
.file-upload {
    border: 2px dashed var(--gray-300);
    border-radius: var(--radius);
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    background: var(--gray-50);
    transition: all 0.2s;
}

.file-upload:hover,
.file-upload.dragover {
    border-color: var(--primary);
    background: var(--primary-light);
}

.file-upload-content svg {
    color: var(--gray-400);
    margin-bottom: 1rem;
}

.file-upload-text {
    color: var(--gray-600);
    margin-bottom: 0.25rem;
}

.file-upload-link {
    color: var(--primary);
    font-weight: 500;
}

.file-upload-hint {
    font-size: 0.8125rem;
    color: var(--gray-400);
}

.file-selected {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
}

.file-selected svg {
    color: var(--primary);
}

.file-selected span {
    flex: 1;
    font-weight: 500;
    color: var(--gray-700);
}

/* ===== Buttons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    font-size: 0.9375rem;
    font-weight: 500;
    border-radius: var(--radius);
    border: none;
    cursor: pointer;
    transition: all 0.2s;
}

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

.btn-primary {
    background: var(--primary);
    color: var(--white);
    font-weight: 500;
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--gray-300);
    color: var(--gray-700);
}

.btn-outline:hover:not(:disabled) {
    background: var(--gray-50);
    border-color: var(--gray-400);
    color: var(--gray-900);
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.8125rem;
}

.btn-lg {
    padding: 0.875rem 1.5rem;
    font-size: 1rem;
}

.btn-icon {
    background: transparent;
    border: none;
    padding: 0.25rem;
    cursor: pointer;
    color: var(--gray-400);
    border-radius: 4px;
    transition: all 0.2s;
}

.btn-icon:hover {
    background: var(--gray-100);
    color: var(--gray-600);
}

.btn-danger {
    background: var(--danger);
    color: var(--white);
}

.btn-danger:hover:not(:disabled) {
    background: #dc2626;
}

/* ===== Table ===== */
.table-container {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 0.875rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--gray-100);
}

.data-table th {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--gray-500);
    background: var(--gray-50);
}

.data-table td {
    font-size: 0.9375rem;
    color: var(--gray-700);
}

.data-table tbody tr:hover {
    background: var(--gray-50);
}

.empty-row:hover {
    background: transparent !important;
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 3rem 1rem;
    color: var(--gray-400);
}

.empty-state svg {
    margin-bottom: 1rem;
}

.empty-state p {
    font-weight: 500;
    color: var(--gray-600);
    margin-bottom: 0.25rem;
}

.empty-state span {
    font-size: 0.875rem;
}

/* ===== Status Tags ===== */
.status-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.25rem 0.625rem;
    border-radius: 9999px;
    font-size: 0.8125rem;
    font-weight: 500;
}

.status-pending {
    background: var(--gray-100);
    color: var(--gray-600);
}

.status-running {
    background: var(--primary-light);
    color: var(--primary);
}

.status-completed {
    background: var(--success-light);
    color: var(--success);
}

.status-failed {
    background: var(--danger-light);
    color: var(--danger);
}

/* ===== Badge ===== */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.625rem;
    background: var(--gray-100);
    color: var(--gray-600);
    border-radius: 9999px;
    font-size: 0.8125rem;
    font-weight: 500;
}

/* ===== Output Grid ===== */
.output-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1rem;
}

.output-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    transition: all 0.2s;
}

.output-item:hover {
    background: var(--gray-100);
    border-color: var(--primary);
}

.output-item svg {
    color: var(--primary);
    flex-shrink: 0;
}

.output-item-info {
    flex: 1;
    min-width: 0;
}

.output-item-name {
    font-weight: 500;
    color: var(--gray-800);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.output-item-type {
    font-size: 0.75rem;
    color: var(--gray-500);
}

/* ===== Toast ===== */
.toast-container {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    z-index: 1000;
}

.toast {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    animation: slideIn 0.3s ease;
    min-width: 300px;
}

.toast-success {
    border-left: 4px solid var(--success);
}

.toast-error {
    border-left: 4px solid var(--danger);
}

.toast-info {
    border-left: 4px solid var(--primary);
}

.toast svg {
    flex-shrink: 0;
}

.toast-success svg {
    color: var(--success);
}

.toast-error svg {
    color: var(--danger);
}

.toast-info svg {
    color: var(--primary);
}

.toast-content {
    flex: 1;
}

.toast-title {
    font-weight: 600;
    color: var(--gray-800);
    margin-bottom: 0.125rem;
}

.toast-message {
    font-size: 0.875rem;
    color: var(--gray-600);
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* ===== Loading Overlay ===== */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    z-index: 1000;
}

.loading-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--gray-200);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.loading-overlay p {
    font-weight: 500;
    color: var(--gray-600);
}

/* ===== Action Buttons ===== */
.action-buttons {
    display: flex;
    gap: 0.5rem;
}

/* ===== Upload Progress Overlay ===== */
.upload-progress-overlay {
    position: fixed;
    inset: 0;
    background: rgba(17, 24, 39, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    animation: fadeIn 0.2s ease;
}

.upload-progress-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 2rem;
    min-width: 480px;
    max-width: 90%;
    box-shadow: var(--shadow-lg);
    animation: slideUp 0.3s ease;
}

.upload-progress-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.upload-progress-icon {
    width: 56px;
    height: 56px;
    background: var(--primary-light);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    flex-shrink: 0;
}

.upload-progress-header h3 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--gray-800);
    margin-bottom: 0.25rem;
}

.upload-progress-header p {
    color: var(--gray-600);
    font-size: 0.875rem;
    margin: 0;
}

.upload-file-size {
    color: var(--gray-400) !important;
    font-size: 0.8125rem !important;
}

.progress-bar-container {
    width: 100%;
    height: 8px;
    background: var(--gray-100);
    border-radius: 9999px;
    overflow: hidden;
    margin-bottom: 0.75rem;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary) 0%, #3b82f6 100%);
    border-radius: 9999px;
    transition: width 0.3s ease;
    position: relative;
    overflow: hidden;
}

.progress-bar::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(255, 255, 255, 0.4) 50%,
        transparent 100%
    );
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.upload-progress-stats {
    display: flex;
    justify-content: space-between;
    font-size: 0.875rem;
    color: var(--gray-600);
    margin-bottom: 1rem;
}

.upload-progress-stats span:first-child {
    font-weight: 600;
    color: var(--primary);
}

.upload-progress-note {
    text-align: center;
    font-size: 0.8125rem;
    color: var(--gray-400);
    margin-top: 0.5rem;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* ===== Active Job Row Animation ===== */
.job-row-active {
    background: linear-gradient(90deg, 
        rgba(212, 175, 55, 0.02) 0%, 
        rgba(212, 175, 55, 0.08) 50%, 
        rgba(212, 175, 55, 0.02) 100%) !important;
    background-size: 200% 100%;
    animation: shimmer-bg 2s linear infinite;
}

@keyframes shimmer-bg {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ===== Processing Dots Animation ===== */
.processing-indicator {
    display: inline-flex;
    gap: 4px;
    margin-top: 4px;
    align-items: center;
}

.processing-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--primary);
    animation: processing-bounce 1.4s infinite ease-in-out both;
}

.processing-dot:nth-child(1) { animation-delay: -0.32s; }
.processing-dot:nth-child(2) { animation-delay: -0.16s; }
.processing-dot:nth-child(3) { animation-delay: 0s; }

@keyframes processing-bounce {
    0%, 80%, 100% {
        transform: scale(0.6);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* ===== SOE Pipeline Status Section ===== */
.pipeline-status-section {
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border: 1px solid #bae6fd;
}

.pipeline-venue-selector {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.venue-select {
    padding: 0.375rem 0.75rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    background: var(--white);
    font-size: 0.875rem;
    color: var(--gray-700);
    cursor: pointer;
}

.venue-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.pipeline-today-card {
    margin-bottom: 1rem;
}

.pipeline-status-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 2rem;
    color: var(--gray-500);
}

.pipeline-status-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    border: 1px solid var(--gray-200);
}

.pipeline-status-card.pipeline-status-success {
    border-left: 4px solid var(--success);
}

.pipeline-status-card.pipeline-status-failed {
    border-left: 4px solid var(--danger);
}

.pipeline-status-card.pipeline-status-running {
    border-left: 4px solid var(--primary);
}

.pipeline-status-card.pipeline-status-pending {
    border-left: 4px solid var(--warning);
}

.pipeline-status-card.pipeline-status-error {
    border-left: 4px solid var(--gray-400);
}

.pipeline-status-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.pipeline-status-icon {
    font-size: 2rem;
}

.pipeline-status-info {
    flex: 1;
}

.pipeline-status-title {
    font-weight: 600;
    font-size: 1.125rem;
    color: var(--gray-800);
}

.pipeline-status-date {
    font-size: 0.875rem;
    color: var(--gray-500);
}

.pipeline-status-badge {
    padding: 0.375rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.pipeline-status-badge.pipeline-status-success {
    background: var(--success-light);
    color: var(--success);
}

.pipeline-status-badge.pipeline-status-failed {
    background: var(--danger-light);
    color: var(--danger);
}

.pipeline-status-badge.pipeline-status-running {
    background: var(--primary-light);
    color: var(--primary);
}

.pipeline-status-badge.pipeline-status-pending {
    background: var(--warning-light);
    color: var(--warning);
}

.pipeline-status-badge.pipeline-status-error {
    background: var(--gray-100);
    color: var(--gray-600);
}

.pipeline-status-metrics {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--gray-100);
}

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

.pipeline-metric-label {
    font-size: 0.75rem;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.25rem;
}

.pipeline-metric-value {
    font-size: 1rem;
    font-weight: 600;
    color: var(--gray-800);
}

.pipeline-error-message {
    margin-top: 1rem;
    padding: 0.75rem;
    background: var(--danger-light);
    border-radius: var(--radius);
    font-size: 0.875rem;
    color: #991b1b;
}

.pipeline-file-count {
    margin-top: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--gray-600);
}

/* Lookup Status */
.lookup-status {
    background: var(--white);
    border-radius: var(--radius);
    padding: 1rem;
    margin-bottom: 1rem;
    border: 1px solid var(--gray-200);
}

.lookup-status-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--gray-700);
    margin-bottom: 0.75rem;
}

.lookup-status-content {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.lookup-status-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
}

.lookup-status-label {
    color: var(--gray-500);
}

.lookup-status-value {
    font-weight: 500;
    color: var(--gray-800);
}

/* Pipeline History */
.pipeline-history-toggle {
    margin-bottom: 1rem;
}

.pipeline-history {
    margin-top: 1rem;
    background: var(--white);
    border-radius: var(--radius);
    border: 1px solid var(--gray-200);
    padding: 1rem;
}

.pipeline-history-table {
    font-size: 0.875rem;
}

.pipeline-history-table th,
.pipeline-history-table td {
    padding: 0.75rem;
}

.loading-row,
.error-row {
    text-align: center;
    padding: 2rem !important;
    color: var(--gray-500);
}

.loading-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .header-content {
        padding: 0.75rem 1rem;
    }

    .main-content {
        padding: 1rem;
    }

    .radio-group {
        flex-direction: column;
    }

    .card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }

    .output-grid {
        grid-template-columns: 1fr;
    }

    .pipeline-status-metrics {
        grid-template-columns: repeat(2, 1fr);
    }

    .lookup-status-content {
        flex-direction: column;
        gap: 0.5rem;
    }
}
