/* Main Application Styles */

* {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Inter', sans-serif !important;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background: #f8f9fa;
    color: #374151;
    overflow-x: hidden;
    overflow-y: hidden;
}

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

/* Navigation Sidebar - FIXED WIDTH FOR ICONS */
.nav-sidebar {
    width: 180px;
    background: white;
    border-right: 1px solid #e5e7eb;
    transition: width 200ms ease;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    z-index: 100;
}

.nav-sidebar.collapsed {
    width: 50px;
}

/* Navigation Menu */
.nav-menu {
    padding: 8px;
}

/* FIXED: Consistent icon spacing */
.nav-item {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    margin-bottom: 2px;
    border-radius: 6px;
    color: #6b7280;
    text-decoration: none;
    transition: all 150ms ease;
    position: relative;
    font-size: 12px;
    font-weight: 400;
}

.nav-item .icon {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 8px;
    font-size: 14px;
    flex-shrink: 0;
}

.nav-sidebar.collapsed .nav-item {
    justify-content: center;
}

.nav-sidebar.collapsed .nav-item .icon {
    margin-right: 0;
}

.nav-sidebar.collapsed .nav-text {
    display: none;
}

.nav-item:hover {
    background: #f3f4f6;
    color: #111827;
}

.nav-item.active {
    background: #eff6ff;
    color: #2563eb;
    font-weight: 500;
}

/* Main Content Area */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: #f8f9fa;
    margin-left: 180px;
    transition: margin-left 200ms ease;
    height: 100vh;
    overflow: hidden;
}

.nav-sidebar.collapsed + .main-content {
    margin-left: 50px;
}

/* Header Bar */
.header-bar {
    background: white;
    padding: 16px 24px;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 60px;
    flex-shrink: 0;
}

/* Page Content */
.page-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
}

/* KPI Cards for Dashboard */
.kpi-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

.kpi-card {
    background: white;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    min-height: 140px;
}

.kpi-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    color: #9ca3af;
    margin-bottom: 8px;
    letter-spacing: 0.5px;
}

.kpi-value {
    font-size: 32px;
    font-weight: 600;
    color: #111827;
    margin-bottom: 8px;
}

.kpi-change {
    font-size: 12px;
    color: #6b7280;
}

.kpi-change.positive {
    color: #10b981;
}

.kpi-change.negative {
    color: #ef4444;
}

/* Filter Sidebar */
.filter-sidebar {
    width: 260px;
    background: white;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    height: fit-content;
}

/* Data Table */
.table-container {
    background: white;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    overflow: hidden;
}

.table-header {
    padding: 20px 24px;
    border-bottom: 1px solid #f3f4f6;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

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

.data-table thead {
    background: #f9fafb;
}

.data-table th {
    padding: 16px 24px;
    text-align: left;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    color: #6b7280;
    letter-spacing: 0.5px;
    border-bottom: 1px solid #f3f4f6;
}

.data-table tbody tr {
    border-bottom: 1px solid #f9fafb;
    transition: background 150ms ease;
}

.data-table tbody tr:hover {
    background: #f9fafb;
}

.data-table td {
    padding: 20px 24px;
    font-size: 14px;
    color: #374151;
}

/* Buttons */
.btn {
    padding: 10px 16px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 150ms ease;
    border: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-primary {
    background: #2563eb;
    color: white;
}

.btn-primary:hover {
    background: #1d4ed8;
    transform: translateY(-1px);
}

.btn-secondary {
    background: #f3f4f6;
    color: #374151;
    border: 1px solid #e5e7eb;
}

.btn-secondary:hover {
    background: #e5e7eb;
}

/* Status Badges */
.status-badge {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    text-transform: capitalize;
}

.status-new {
    background: #e0e7ff;
    color: #3730a3;
}

.status-matched {
    background: #dcfce7;
    color: #16a34a;
}

.status-partial {
    background: #fed7aa;
    color: #ea580c;
}

.status-exception {
    background: #fee2e2;
    color: #dc2626;
}

.status-approved {
    background: #ecfccb;
    color: #65a30d;
}

/* Match Percentage Bar */
.match-bar {
    display: flex;
    align-items: center;
    gap: 12px;
}

.match-bar-bg {
    width: 80px;
    height: 10px;
    background: #e5e7eb;
    border-radius: 5px;
    overflow: hidden;
}

.match-bar-fill {
    height: 100%;
    background: #10b981;
    transition: width 300ms ease;
}

/* Pagination */
.pagination {
    padding: 20px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid #f3f4f6;
}

.pagination-info {
    font-size: 14px;
    color: #6b7280;
}

.pagination-controls {
    display: flex;
    gap: 12px;
    align-items: center;
}

.page-selector {
    padding: 8px 12px;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    font-size: 14px;
    background: white;
}

/* Loading States */
.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 48px;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #e5e7eb;
    border-top-color: #2563eb;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Responsive */
@media (max-width: 1200px) {
    .filter-sidebar {
        width: 240px;
    }
}

@media (max-width: 992px) {
    .kpi-cards {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    }
}

@media (max-width: 768px) {
    .nav-sidebar {
        position: fixed;
        z-index: 1000;
        height: 100vh;
        transform: translateX(-100%);
    }
    
    .nav-sidebar.open {
        transform: translateX(0);
    }
}