:root {
    --bg-color: #f3f6fc;
    --sidebar-bg: #ffffff;
    --card-bg: rgba(255, 255, 255, 0.7);
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --primary: #4361ee;
    --primary-light: #4cc9f0;
    --success: #10b981;
    --danger: #ef476f;
    --warning: #f59e0b;
    --info: #0ea5e9;
    --border-color: rgba(226, 232, 240, 0.8);
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 15px rgba(0,0,0,0.05);
    --shadow-lg: 0 10px 25px rgba(67, 97, 238, 0.15);
    --glass-blur: blur(12px);
}

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

body {
    font-family: 'Inter', 'Prompt', sans-serif;
    background-color: var(--bg-color);
    background-image: 
        radial-gradient(at 0% 0%, hsla(253,16%,7%,1) 0, transparent 50%), 
        radial-gradient(at 50% 0%, hsla(225,39%,30%,1) 0, transparent 50%), 
        radial-gradient(at 100% 0%, hsla(339,49%,30%,1) 0, transparent 50%);
    background-attachment: fixed;
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

/* Base UI modifications to blend with gradient */
body::before {
    content: '';
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(243, 246, 252, 0.85); /* Light frosted glass overlay */
    z-index: -1;
}

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

/* Glassmorphism Utilities */
.glass-panel {
    background: var(--card-bg);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid rgba(255, 255, 255, 0.6);
    box-shadow: var(--shadow-md);
    border-radius: 16px;
}

/* Sidebar */
.sidebar {
    width: 280px;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: var(--glass-blur);
    border-right: 1px solid var(--border-color);
    padding: 24px;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    transition: width 0.3s ease, padding 0.3s ease;
    overflow: hidden;
}

.sidebar.collapsed {
    width: 80px;
    padding: 24px 15px;
}

.sidebar.collapsed h2, 
.sidebar.collapsed .filter-section h3, 
.sidebar.collapsed .form-group label,
.sidebar.collapsed .form-control,
.sidebar.collapsed .btn-primary span,
.sidebar.collapsed .data-source-info,
.sidebar.collapsed .logo-icon + h2 {
    display: none;
}

.sidebar.collapsed .logo-icon {
    margin: 0 auto;
}

.sidebar.collapsed .filter-section h3 i,
.sidebar.collapsed .form-group i {
    font-size: 1.5rem;
    margin: 0 auto;
}

.sidebar.collapsed .btn-primary {
    width: 50px;
    height: 50px;
    padding: 0;
    margin: 0 auto;
    border-radius: 12px;
}

.sidebar-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 40px;
}

.logo-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.2rem;
    box-shadow: var(--shadow-lg);
}

.sidebar-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
}

.toggle-btn {
    position: absolute;
    right: -15px;
    top: 32px;
    width: 30px;
    height: 30px;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    color: var(--primary);
    z-index: 10;
    transition: all 0.3s ease;
}

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

.highlight {
    color: var(--primary);
}

.filter-section h3 {
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-secondary);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-secondary);
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.9);
    font-family: inherit;
    font-size: 0.95rem;
    color: var(--text-primary);
    transition: all 0.3s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.15);
}

.btn-primary {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, var(--primary), #3a0ca3);
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 4px 10px rgba(67, 97, 238, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(67, 97, 238, 0.4);
}

.data-source-info {
    margin-top: 40px;
    padding: 15px;
    background: rgba(248, 250, 252, 0.7);
    border-radius: 12px;
    border: 1px dashed #cbd5e1;
}

.data-source-info h4 {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 10px;
}

.path-display code {
    display: block;
    font-size: 0.8rem;
    color: #334155;
    margin-bottom: 10px;
    background: rgba(255,255,255,0.8);
    padding: 4px 8px;
    border-radius: 4px;
}

.badge {
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
}

.gn-badge { background: #dbeafe; color: #1e40af; }
.sap-badge { background: #fce7f3; color: #be185d; }

/* Main Content */
.main-content {
    flex: 1;
    padding: 30px 40px;
    max-width: 1400px;
    transition: padding 0.3s ease;
}

.main-content.expanded {
    padding-left: 60px;
}

.top-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 40px;
}

.page-title {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 4px;
    background: linear-gradient(135deg, #1e293b, var(--primary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.page-subtitle {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.user-profile img {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 2px solid white;
    box-shadow: var(--shadow-sm);
}

/* KPI Cards */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    margin-bottom: 40px;
}

.kpi-card {
    padding: 24px;
    display: flex;
    align-items: flex-start;
    gap: 20px;
    position: relative;
    overflow: hidden;
    transition: transform 0.3s ease;
}

.kpi-card:hover {
    transform: translateY(-5px);
}

.primary-gradient::before {
    content: ''; position: absolute; top: 0; left: 0; width: 4px; height: 100%; background: var(--primary);
}
.secondary-gradient::before {
    content: ''; position: absolute; top: 0; left: 0; width: 4px; height: 100%; background: var(--success);
}
.alert-gradient::before {
    content: ''; position: absolute; top: 0; left: 0; width: 4px; height: 100%; background: var(--danger);
}

.kpi-icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    background: rgba(255,255,255,0.9);
    box-shadow: var(--shadow-sm);
}

.primary-gradient .kpi-icon { color: var(--primary); }
.secondary-gradient .kpi-icon { color: var(--success); }
.alert-gradient .kpi-icon { color: var(--danger); }

.kpi-details {
    flex: 1;
}

.kpi-label {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.kpi-stats {
    display: flex;
    align-items: center;
    gap: 15px;
}

.divider {
    width: 1px;
    height: 30px;
    background: var(--border-color);
}

.stat-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
}

.diff-value.positive { color: var(--success); }
.diff-value.negative { color: var(--danger); }

/* Tables Section */
.tables-section {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.tabs-header {
    display: flex;
    padding: 10px;
    gap: 10px;
    border-radius: 12px;
}

.tab-btn {
    flex: 1;
    padding: 14px 20px;
    background: transparent;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s;
}

.tab-btn:hover {
    background: rgba(255, 255, 255, 0.5);
}

.tab-btn.active {
    background: white;
    color: var(--primary);
    box-shadow: var(--shadow-sm);
}

.count-badge {
    background: #f1f5f9;
    color: #64748b;
    padding: 2px 8px;
    border-radius: 10px;
}

.tab-btn.active .count-badge {
    background: #e0e7ff;
    color: var(--primary);
}

.tab-content {
    display: none;
    padding: 24px;
    animation: fadeIn 0.4s ease forwards;
}

.tab-content.active {
    display: block;
}

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

.table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.table-header h3 {
    font-size: 1.2rem;
    color: var(--text-primary);
}

.btn-icon {
    padding: 8px 16px;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.9rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    color: #10b981;
    font-weight: 500;
    transition: background 0.2s;
}

.btn-icon:hover {
    background: #f0fdf4;
}

.search-box {
    position: relative;
    width: 250px;
}

.search-box i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
}

.search-box input {
    width: 100%;
    padding: 8px 12px 8px 36px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.9rem;
}

.table-responsive {
    overflow-x: auto;
}

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

.data-table th {
    padding: 14px 16px;
    background: rgba(248, 250, 252, 0.6);
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid var(--border-color);
}

.data-table td {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.9rem;
    color: var(--text-primary);
}

.data-table tr:hover td {
    background: rgba(248, 250, 252, 0.8);
}

.status-match {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    border-radius: 6px;
    background: #d1fae5;
    color: #047857;
    font-size: 0.8rem;
    font-weight: 600;
}

.status-diff {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    border-radius: 6px;
    background: #fee2e2;
    color: #b91c1c;
    font-size: 0.8rem;
    font-weight: 600;
}

.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-info { color: var(--info); }
.font-bold { font-weight: 600; }

/* Loader */
.loader-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(5px);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 20px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.loader-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.spinner {
    width: 50px;
    height: 50px;
    position: relative;
}

.double-bounce1, .double-bounce2 {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background-color: var(--primary);
    opacity: 0.6;
    position: absolute;
    top: 0;
    left: 0;
    animation: sk-bounce 2.0s infinite ease-in-out;
}

.double-bounce2 {
    animation-delay: -1.0s;
}

@keyframes sk-bounce {
    0%, 100% { transform: scale(0.0) }
    50% { transform: scale(1.0) }
}
