:root {
    --primary: #2563eb;
    --primary-dark: #1e40af;
    --secondary: #64748b;
    --bg-body: #f8fafc;
    --bg-card: #ffffff;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;
    
    --sidebar-width: 260px;
    --header-height: 70px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

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

body {
    background-color: var(--bg-body);
    color: var(--text-main);
    -webkit-font-smoothing: antialiased;
}

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

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: #0f172a;
    color: #fff;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    transition: var(--transition);
    z-index: 100;
    box-shadow: 4px 0 24px rgba(0,0,0,0.1);
}

.sidebar-header {
    height: var(--header-height);
    display: flex;
    align-items: center;
    padding: 0 24px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    justify-content: space-between;
}

.logo {
    font-size: 1.25rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 12px;
    color: #fff;
    letter-spacing: -0.025em;
}

.logo i {
    color: var(--primary);
    background: rgba(37, 99, 235, 0.2);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    font-size: 1rem;
}

.sidebar-nav {
    flex: 1;
    padding: 24px 0;
    overflow-y: auto;
}

.sidebar-nav ul {
    list-style: none;
    padding: 0 12px;
}

.sidebar-nav li {
    margin-bottom: 4px;
}

.sidebar-nav li a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: #94a3b8;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: var(--transition);
    border-radius: 8px;
}

.sidebar-nav li a:hover {
    background: rgba(255,255,255,0.05);
    color: #fff;
}

.sidebar-nav li.active a {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.sidebar-nav .divider {
    height: 1px;
    background: rgba(255,255,255,0.05);
    margin: 20px 16px;
}

.sidebar-footer {
    padding: 20px 24px;
    border-top: 1px solid rgba(255,255,255,0.05);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(0,0,0,0.2);
}

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

.user-info img {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    border: 2px solid rgba(255,255,255,0.1);
}

.user-info h4 {
    font-size: 0.9rem;
    font-weight: 600;
    color: #fff;
}

.user-info span {
    font-size: 0.75rem;
    color: #94a3b8;
    display: block;
}

.logout-btn {
    background: rgba(255,255,255,0.05);
    border: none;
    color: #94a3b8;
    cursor: pointer;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.logout-btn:hover {
    background: rgba(239, 68, 68, 0.2);
    color: var(--danger);
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    transition: var(--transition);
    width: calc(100% - var(--sidebar-width));
}

/* Header */
.top-header {
    height: var(--header-height);
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 99;
}

#sidebar-toggle {
    background: none;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    color: var(--text-muted);
    padding: 8px;
    border-radius: 8px;
    transition: var(--transition);
}

#sidebar-toggle:hover {
    background: #f1f5f9;
    color: var(--text-main);
}

.search-bar {
    display: flex;
    align-items: center;
    background: #f1f5f9;
    padding: 10px 16px;
    border-radius: 12px;
    width: 320px;
    border: 1px solid transparent;
    transition: var(--transition);
}

.search-bar:focus-within {
    background: #fff;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.search-bar i {
    color: var(--text-muted);
    margin-right: 12px;
}

.search-bar input {
    border: none;
    background: none;
    outline: none;
    width: 100%;
    color: var(--text-main);
    font-size: 0.9rem;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 24px;
}

.notification-box {
    position: relative;
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    transition: var(--transition);
}

.notification-box:hover {
    background: #f1f5f9;
}

.notification-box i {
    font-size: 1.25rem;
    color: var(--text-muted);
}

.notification-box .badge {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 8px;
    height: 8px;
    background: var(--danger);
    border-radius: 50%;
    border: 2px solid #fff;
}

.profile-menu img {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    cursor: pointer;
    border: 2px solid #fff;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.profile-menu img:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* Dashboard Content */
.dashboard-content {
    padding: 32px;
    max-width: 1600px;
    margin: 0 auto;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 32px;
}

.page-header h1 {
    font-size: 1.875rem;
    font-weight: 700;
    color: var(--text-main);
    letter-spacing: -0.025em;
    margin-bottom: 4px;
}

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

.date-picker {
    background: #fff;
    padding: 10px 20px;
    border-radius: 10px;
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-main);
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}

.date-picker:hover {
    border-color: var(--text-muted);
}

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

.kpi-card {
    background: var(--bg-card);
    padding: 24px;
    border-radius: 16px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.kpi-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: rgba(37, 99, 235, 0.2);
}

.kpi-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 16px;
}

.kpi-title {
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.kpi-icon {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.kpi-icon.positive {
    background: #dcfce7;
    color: #15803d;
}

.kpi-icon.negative {
    background: #fee2e2;
    color: #b91c1c;
}

.kpi-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 4px;
    letter-spacing: -0.025em;
}

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

/* Charts */
.charts-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px;
    margin-bottom: 32px;
}

.chart-card {
    background: var(--bg-card);
    padding: 24px;
    border-radius: 16px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}

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

.card-header h3 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-main);
}

.btn-icon {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1.1rem;
    padding: 8px;
    border-radius: 8px;
    transition: var(--transition);
}

.btn-icon:hover {
    background: #f1f5f9;
    color: var(--text-main);
}

.chart-container {
    height: 320px;
    position: relative;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}

/* CSS Bar Chart Refined */
.bar-chart {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    width: 100%;
    height: 100%;
    padding: 0 10px;
}

.bar-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
    justify-content: flex-end;
    width: 8%;
}

.bar {
    width: 100%;
    background: linear-gradient(180deg, #3b82f6 0%, #2563eb 100%);
    border-radius: 6px 6px 0 0;
    transition: all 0.4s ease;
    opacity: 0.8;
    position: relative;
    cursor: pointer;
}

.bar:hover {
    opacity: 1;
    transform: scaleY(1.02);
    box-shadow: 0 0 15px rgba(37, 99, 235, 0.3);
}

.bar::after {
    content: attr(data-tooltip);
    position: absolute;
    top: -40px;
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    background: #1e293b;
    color: #fff;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    opacity: 0;
    transition: all 0.2s;
    white-space: nowrap;
    pointer-events: none;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.bar:hover::after {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.bar-group::after {
    content: attr(data-label);
    margin-top: 12px;
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* Donut Chart Refined */
.donut-container {
    align-items: center;
    flex-direction: column;
    justify-content: center;
}

.donut-chart {
    width: 200px;
    height: 200px;
    border-radius: 50%;
    background: conic-gradient(
        var(--primary) 0% 45%,
        var(--info) 45% 75%,
        #e2e8f0 75% 100%
    );
    position: relative;
    margin-bottom: 24px;
    box-shadow: var(--shadow-md);
}

.donut-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 150px;
    height: 150px;
    background: var(--bg-card);
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.05);
}

.donut-center span {
    font-size: 0.875rem;
    color: var(--text-muted);
}

.donut-center strong {
    font-size: 1.5rem;
    color: var(--text-main);
    font-weight: 800;
}

.chart-legend {
    list-style: none;
    width: 100%;
    padding: 0 20px;
}

.chart-legend li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.9rem;
    color: var(--text-main);
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid #f1f5f9;
}

.chart-legend li:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.chart-legend div {
    display: flex;
    align-items: center;
    gap: 8px;
}

.dot {
    width: 12px;
    height: 12px;
    border-radius: 4px;
}

.dot.color-1 { background: var(--primary); }
.dot.color-2 { background: var(--info); }
.dot.color-3 { background: #e2e8f0; }

/* Table */
.table-card {
    background: var(--bg-card);
    border-radius: 16px;
    border: 1px solid var(--border);
    padding: 0;
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.table-card .card-header {
    padding: 24px;
    margin-bottom: 0;
    border-bottom: 1px solid var(--border);
}

.btn-link {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    transition: var(--transition);
}

.btn-link:hover {
    color: var(--primary-dark);
}

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

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

th, td {
    padding: 16px 24px;
    text-align: left;
    border-bottom: 1px solid #f1f5f9;
}

th {
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: #f8fafc;
}

tr:hover td {
    background: #f8fafc;
}

td {
    font-size: 0.95rem;
    color: var(--text-main);
}

.client-cell {
    display: flex;
    align-items: center;
    gap: 12px;
}

.client-cell img {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
}

.client-cell span {
    font-weight: 500;
}

.status-badge {
    padding: 6px 12px;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.status-badge::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

.status-badge.completed {
    background: #dcfce7;
    color: #15803d;
}

.status-badge.pending {
    background: #fef3c7;
    color: #b45309;
}

.status-badge.processing {
    background: #dbeafe;
    color: #1d4ed8;
}

.status-badge.cancelled {
    background: #fee2e2;
    color: #b91c1c;
}

.btn-action {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition);
    padding: 8px;
    border-radius: 6px;
}

.btn-action:hover {
    background: #f1f5f9;
    color: var(--primary);
}

/* Mobile Responsive */
@media (max-width: 991px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .main-content {
        margin-left: 0;
        width: 100%;
    }

    .sidebar.active {
        transform: translateX(0);
    }

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

@media (max-width: 768px) {
    .search-bar {
        display: none;
    }
    
    .kpi-grid {
        grid-template-columns: 1fr;
    }
    
    .mobile-only {
        display: block;
    }
    
    .dashboard-content {
        padding: 20px;
    }
    
    .top-header {
        padding: 0 20px;
    }
}

.mobile-only {
    display: none;
    background: none;
    border: none;
    color: #fff;
    font-size: 1.2rem;
    cursor: pointer;
}
