/* ==========================================================================
   FinOps Board - Core Design System & CSS Stylesheet
   ========================================================================== */

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

:root {
    /* Color Palette */
    --bg-primary: #090d16;
    --bg-secondary: #0f172a;
    --card-bg: rgba(22, 30, 49, 0.7);
    --glass-border: rgba(255, 255, 255, 0.06);
    --glass-border-focus: rgba(99, 102, 241, 0.4);
    
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --primary-glow: rgba(99, 102, 241, 0.15);
    
    --success: #10b981;
    --success-bg: rgba(16, 185, 129, 0.1);
    --danger: #ef4444;
    --danger-bg: rgba(239, 68, 68, 0.1);
    --warning: #f59e0b;
    --warning-bg: rgba(245, 158, 11, 0.1);
    --info: #3b82f6;
    --info-bg: rgba(59, 130, 246, 0.1);

    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --border-color: #1e293b;
    
    /* Layout Sizes */
    --sidebar-width: 280px;
    --header-height: 70px;
    --border-radius-lg: 16px;
    --border-radius-md: 10px;
    --border-radius-sm: 6px;
}

/* Light Theme Variables */
[data-theme="light"] {
    --bg-primary: #f8fafc;
    --bg-secondary: #ffffff;
    --card-bg: rgba(255, 255, 255, 0.9);
    --glass-border: rgba(0, 0, 0, 0.08);
    --glass-border-focus: rgba(99, 102, 241, 0.4);
    
    --primary: #4f46e5;
    --primary-hover: #3730a3;
    --primary-glow: rgba(79, 70, 229, 0.08);
    
    --success: #059669;
    --success-bg: rgba(5, 150, 105, 0.08);
    --danger: #dc2626;
    --danger-bg: rgba(220, 38, 38, 0.08);
    --warning: #d97706;
    --warning-bg: rgba(217, 119, 6, 0.08);
    --info: #2563eb;
    --info-bg: rgba(37, 99, 235, 0.08);

    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
}

/* Light Theme Overrides */
[data-theme="light"] input,
[data-theme="light"] select,
[data-theme="light"] textarea {
    background-color: #f1f5f9;
    color: #0f172a;
}

[data-theme="light"] .table th {
    background-color: rgba(0, 0, 0, 0.03);
}

[data-theme="light"] .detail-transaction-card {
    background-color: #f1f5f9;
}

[data-theme="light"] .inbox-header {
    background-color: rgba(0, 0, 0, 0.02);
}

[data-theme="light"] .sidebar-footer {
    background-color: rgba(0, 0, 0, 0.02);
}

[data-theme="light"] .card {
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
}

[data-theme="light"] .forecast-week {
    background-color: rgba(0, 0, 0, 0.01);
}

[data-theme="light"] .btn-secondary:hover {
    background-color: rgba(0, 0, 0, 0.03);
}

[data-theme="light"] .brand-btn:hover {
    background: rgba(0, 0, 0, 0.03);
}


/* Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.75;
    font-weight: 300;
    letter-spacing: 0.04em;
    overflow-x: hidden;
}

b, strong {
    font-weight: 500;
}

h1, h2, h3, h4, h5, h6 {
    font-weight: 400;
    letter-spacing: 0.02em;
}

/* App Container Layout */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar Navigation */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    left: 0;
    top: 0;
    z-index: 100;
}

.brand {
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--border-color);
}

.brand-icon {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--primary), var(--info));
    border-radius: var(--border-radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    color: white;
    font-size: 1.25rem;
}

.brand-name {
    font-size: 1.25rem;
    font-weight: 500;
    letter-spacing: 0.02em;
}

.nav-menu {
    list-style: none;
    padding: 24px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-grow: 1;
    overflow-y: auto;
}

.nav-item a {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--border-radius-md);
    font-weight: 400;
    font-size: 0.95rem;
    letter-spacing: 0.02em;
    transition: all 0.2s ease;
}

.nav-item a svg {
    color: var(--text-muted);
    transition: color 0.2s ease;
}

.nav-item a:hover {
    background-color: rgba(255, 255, 255, 0.03);
    color: var(--text-primary);
}

.nav-item a:hover svg {
    color: var(--text-primary);
}

.nav-item.active a {
    background-color: var(--primary-glow);
    color: var(--primary);
}

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

.sidebar-footer {
    padding: 20px 16px;
    border-top: 1px solid var(--border-color);
    background-color: rgba(0, 0, 0, 0.1);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.user-avatar {
    width: 36px;
    height: 36px;
    background-color: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: white;
}

.logout-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 10px;
    background-color: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: var(--danger);
    text-decoration: none;
    border-radius: var(--border-radius-sm);
    font-size: 0.85rem;
    font-weight: 600;
    transition: all 0.2s ease;
}

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

/* Main Content Workspace */
.main-content {
    margin-left: var(--sidebar-width);
    flex-grow: 1;
    padding: 40px;
    background-color: var(--bg-primary);
    min-height: 100vh;
}

/* Page Header */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
}

.page-title h1 {
    font-size: 1.75rem;
    font-weight: 500;
    letter-spacing: 0.01em;
    margin-bottom: 4px;
}

.page-title p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.header-actions {
    display: flex;
    gap: 12px;
}

/* Cards & UI Panels */
.card {
    background-color: var(--card-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--border-radius-lg);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 24px;
}

/* Dashboard Metrics Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 24px;
}

.kpi-card {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 180px;
}

.kpi-title {
    font-size: 0.8rem;
    font-weight: 400;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.kpi-value {
    font-size: 2.1rem;
    font-weight: 400;
    margin: 12px 0 6px 0;
    letter-spacing: 0.01em;
}

.kpi-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.cash-accounts-list {
    margin-top: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    border-top: 1px solid var(--border-color);
    padding-top: 12px;
}

.cash-account-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.825rem;
}

.cash-account-name {
    color: var(--text-secondary);
}

.cash-account-val {
    font-weight: 400;
}

/* Full Width Dashboard Card */
.dashboard-card-full {
    grid-column: 1 / -1;
    margin-top: 12px;
}

/* Cash Forecast Table Grid */
.forecast-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-top: 16px;
}

.forecast-week {
    background-color: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    padding: 16px;
    transition: transform 0.2s ease;
}

.forecast-week:hover {
    transform: translateY(-2px);
}

.forecast-week.warning-week {
    border-color: rgba(239, 68, 68, 0.4);
    background: rgba(239, 68, 68, 0.03);
}

.forecast-week-num {
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.08em;
    color: var(--text-muted);
}

.forecast-week-val {
    font-size: 1.25rem;
    font-weight: 400;
    margin-top: 4px;
}

/* Tables */
.table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.table th,
.table td {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
}

.table th {
    font-size: 0.8rem;
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-secondary);
    background-color: rgba(0, 0, 0, 0.15);
}

.table tbody tr {
    transition: background-color 0.2s ease;
}

.table tbody tr:hover {
    background-color: rgba(255, 255, 255, 0.015);
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 8px;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 400;
    letter-spacing: 0.02em;
    line-height: 1;
}

.badge-success {
    background-color: rgba(16, 185, 129, 0.15);
    color: var(--success);
}

.badge-danger {
    background-color: rgba(239, 68, 68, 0.15);
    color: var(--danger);
}

.badge-warning {
    background-color: rgba(245, 158, 11, 0.15);
    color: var(--warning);
}

.badge-muted {
    background-color: rgba(255, 255, 255, 0.08);
    color: var(--text-secondary);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: var(--border-radius-md);
    font-size: 0.9rem;
    font-weight: 400;
    letter-spacing: 0.02em;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

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

.btn-primary:hover {
    background-color: var(--primary-hover);
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

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

.btn-secondary:hover {
    background-color: rgba(255, 255, 255, 0.03);
    border-color: var(--text-secondary);
}

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

.btn-success:hover {
    opacity: 0.9;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}

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

.btn-danger:hover {
    opacity: 0.9;
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.3);
}

/* Bank Inbox Email Layout */
.inbox-container {
    display: flex;
    gap: 24px;
    height: calc(100vh - 180px);
}

.inbox-list {
    width: 380px;
    background-color: var(--card-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--border-radius-lg);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.inbox-header {
    padding: 16px 20px;
    font-weight: 700;
    border-bottom: 1px solid var(--border-color);
    background-color: rgba(0,0,0,0.1);
}

.inbox-item {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    transition: background-color 0.2s ease;
    cursor: pointer;
}

.inbox-item:hover {
    background-color: rgba(255,255,255,0.02);
}

.inbox-item.active {
    background-color: rgba(99, 102, 241, 0.08);
    border-left: 4px solid var(--primary);
    padding-left: 16px;
}

.inbox-item-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    margin-bottom: 6px;
}

.inbox-item-date {
    color: var(--text-muted);
}

.inbox-item-amount {
    font-weight: 700;
}

.inbox-item-amount.positive {
    color: var(--success);
}

.inbox-item-amount.negative {
    color: var(--danger);
}

.inbox-item-desc {
    font-size: 0.875rem;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.inbox-detail {
    flex-grow: 1;
    background-color: var(--card-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--border-radius-lg);
    padding: 30px;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.detail-transaction-card {
    background-color: rgba(0,0,0,0.2);
    border-radius: var(--border-radius-md);
    padding: 20px;
    margin-bottom: 24px;
    border: 1px solid var(--border-color);
}

.detail-row {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid rgba(255,255,255,0.02);
}

.detail-row:last-child {
    border-bottom: none;
}

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

.detail-val {
    font-weight: 500;
}

.detail-match-section {
    margin-top: 10px;
}

.match-proposal-card {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.05) 0%, rgba(245, 158, 11, 0.1) 100%);
    border: 1px solid rgba(245, 158, 11, 0.2);
    border-radius: var(--border-radius-md);
    padding: 20px;
    margin-top: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.match-proposal-card.high-confidence {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.05) 0%, rgba(16, 185, 129, 0.1) 100%);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.match-proposal-confidence {
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 1px;
}

/* Forms layout */
.form-split-layout {
    display: flex;
    gap: 24px;
}

.form-card-left {
    flex-grow: 1;
}

.form-card-right {
    width: 360px;
    flex-shrink: 0;
}

.form-row {
    display: flex;
    gap: 16px;
}

.form-row .form-group {
    flex: 1;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 16px;
}

.form-group label {
    font-size: 0.85rem;
    font-weight: 400;
    color: var(--text-secondary);
    letter-spacing: 0.03em;
}

input, select, textarea {
    background-color: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--border-color);
    padding: 12px 16px;
    border-radius: var(--border-radius-md);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.925rem;
    font-weight: 300;
    letter-spacing: 0.03em;
    width: 100%;
    transition: all 0.2s ease;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 10px rgba(99, 102, 241, 0.15);
}

/* Audit logs timeline styling */
.timeline-item {
    position: relative;
    padding-bottom: 16px;
}
.timeline-item:last-child {
    padding-bottom: 0;
}
.audit-timeline::-webkit-scrollbar {
    width: 6px;
}
.audit-timeline::-webkit-scrollbar-thumb {
    background-color: var(--border-color);
    border-radius: 4px;
}

/* Global Brand Selector Styles */
.global-brand-selector {
    padding: 16px 24px;
    border-bottom: 1px solid var(--border-color);
}
.brand-switch-buttons {
    display: flex;
    background: rgba(0, 0, 0, 0.15);
    border-radius: var(--border-radius-sm);
    padding: 2px;
}
.brand-btn {
    flex: 1;
    text-align: center;
    font-size: 0.75rem;
    padding: 6px 4px;
    border-radius: 4px;
    text-decoration: none;
    color: var(--text-secondary);
    font-weight: 500;
    transition: all 0.2s ease;
}
.brand-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.03);
}
.brand-btn.active {
    color: var(--text-primary) !important;
    background: var(--primary) !important;
    box-shadow: 0 2px 10px rgba(99, 102, 241, 0.3);
}
[data-theme="light"] .brand-switch-buttons {
    background: rgba(0, 0, 0, 0.05);
}
[data-theme="light"] .brand-btn.active {
    color: white !important;
}
