/* PRO ANALYTICS DESIGN SYSTEM - BAKSEY V2 */
:root {
    --primary: #4F46E5;
    --primary-light: #EEF2FF;
    --success: #10B981;
    --warning: #F59E0B;
    --danger: #EF4444;
    --background: #F8FAFC;
    --sidebar: #FFFFFF;
    --card: #FFFFFF;
    --text: #1E293B;
    --text-dim: #64748B;
    --border: #E2E8F0;
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
}

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

body { background: var(--background); color: var(--text); overflow-x: hidden; }

/* THE PRO LAYOUT */
.dashboard-container { display: grid; grid-template-columns: 260px 1fr; min-height: 100vh; }

.sidebar { background: var(--sidebar); border-right: 1px solid var(--border); padding: 40px 24px; position: sticky; top: 0; height: 100vh; }
.main-content { padding: 40px; max-width: 1400px; width: 100%; margin: 0 auto; }

/* BRANDING */
.logo-container { display: flex; align-items: center; gap: 12px; margin-bottom: 40px; font-weight: 800; font-size: 18px; color: var(--primary); }
.logo-icon { width: 32px; height: 32px; background: var(--primary); border-radius: 8px; }

/* SIDERBAR NAV */
.nav-item { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: 12px; color: var(--text-dim); text-decoration: none; font-weight: 500; transition: all 0.3s; margin-bottom: 4px; }
.nav-item:hover, .nav-item.active { background: var(--primary-light); color: var(--primary); }

/* HEADER SECTION */
header { display: flex; justify-content: space-between; align-items: start; margin-bottom: 40px; }
header h1 { font-size: 28px; font-weight: 800; letter-spacing: -0.025em; margin-bottom: 4px; }
header p { color: var(--text-dim); font-size: 15px; }

/* KPI CARDS (PRO HIGH DENSITY) */
.metrics-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 24px; margin-bottom: 32px; }
.metric-card { background: var(--card); padding: 24px; border-radius: 20px; border: 1px solid var(--border); box-shadow: var(--shadow-sm); transition: transform 0.3s; }
.metric-card:hover { transform: translateY(-4px); }
.metric-label { color: var(--text-dim); font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; display: flex; justify-content: space-between; align-items: center; }
.metric-value { font-size: 32px; font-weight: 800; margin: 12px 0; color: var(--text); }
.metric-trend { font-size: 12px; display: flex; align-items: center; gap: 4px; }
.trend-up { color: var(--success); }

/* ANALYTICS GRID */
.analytics-grid { display: grid; grid-template-columns: 1.5fr 1fr; gap: 24px; margin-bottom: 32px; }
.chart-card { background: var(--card); padding: 24px; border-radius: 24px; border: 1px solid var(--border); }
.chart-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }
.chart-title { font-weight: 700; font-size: 16px; }

/* MASTER LOG TABLE (PRO VERSION) */
.table-card { background: var(--card); border-radius: 24px; border: 1px solid var(--border); overflow: hidden; box-shadow: var(--shadow-sm); }
table { width: 100%; border-collapse: collapse; text-align: left; }
thead th { background: #F8FAFC; padding: 16px 24px; font-size: 12px; font-weight: 700; color: var(--text-dim); border-bottom: 1px solid var(--border); }
tbody td { padding: 16px 24px; font-size: 14px; border-bottom: 1px solid var(--border); color: var(--text); }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--primary-light); }

/* TAGS & BADGES */
.tag { padding: 4px 10px; border-radius: 8px; font-size: 11px; font-weight: 700; text-transform: uppercase; }
.tag-ios { background: #000; color: #FFF; }
.tag-android { background: #3DDC84; color: #000; }
.tag-other { background: #E2E8F0; color: var(--text-dim); }

/* BUTTONS */
.btn { display: inline-flex; align-items: center; background: var(--primary); color: white; padding: 10px 20px; border-radius: 12px; font-weight: 600; text-decoration: none; border: none; cursor: pointer; transition: all 0.3s; gap: 8px; font-size: 14px; }
.btn:hover { opacity: 0.9; transform: scale(0.98); }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text); }

/* MODAL PRO */
.modal { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 1000; backdrop-filter: blur(4px); }
.modal-content { background: white; border-radius: 24px; width: min(90%, 500px); margin: 10vh auto; padding: 40px; box-shadow: var(--shadow); }

/* SKELETON LOADING */
.skeleton { background: #f1f5f9; border-radius: 4px; position: relative; overflow: hidden; }
.skeleton::after { content: ""; position: absolute; top: 0; right: 0; bottom: 0; left: 0; transform: translateX(-100%); background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent); animation: shimmer 1.5s infinite; }
@keyframes shimmer { 100% { transform: translateX(100%); } }

.ghost-text { height: 20px; width: 60%; margin: 8px 0; }
.ghost-value { height: 32px; width: 40%; margin-bottom: 8px; }
.ghost-btn { height: 40px; width: 100%; border-radius: 12px; }

/* MOBILE HEADER DEFAULTS */
.mobile-header { display: none; position: fixed; top: 0; left: 0; right: 0; height: 64px; background: rgba(255,255,255,0.8); backdrop-filter: blur(12px); border-bottom: 1px solid var(--border); z-index: 1000; padding: 0 24px; align-items: center; justify-content: space-between; }
.menu-toggle { background: transparent; border: none; font-size: 24px; cursor: pointer; color: var(--text); }
.sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.3); backdrop-filter: blur(2px); z-index: 1001; opacity: 0; transition: opacity 0.3s; pointer-events: none; }
.sidebar-overlay.active { display: block; opacity: 1; pointer-events: auto; }

/* HEADER ACTIONS */
.filter-group { display: flex; gap: 12px; align-items: center; }

@media (max-width: 1024px) {
    .dashboard-container { grid-template-columns: 1fr; }
    .mobile-header { display: flex; }
    .sidebar { position: fixed; left: -280px; top: 0; bottom: 0; z-index: 1002; transition: left 0.3s ease-in-out; width: 260px; }
    .sidebar.active { left: 0; }
    .main-content { padding: 84px 16px 40px 16px; }
    header { flex-direction: column; gap: 20px; align-items: flex-start; }
    .filter-group { width: 100%; flex-wrap: wrap; gap: 8px; }
    .filter-group .btn { flex: 1; min-width: 120px; justify-content: center; height: 44px; font-size: 13px; }
    
    .metrics-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
    .metric-card { padding: 16px; border-radius: 16px; }
    .metric-value { font-size: 24px; margin: 8px 0; }
    
    .analytics-grid { grid-template-columns: 1fr; gap: 16px; }
    .chart-card { padding: 16px; border-radius: 20px; }
    .table-card { overflow-x: auto; }
    table { min-width: 800px; }
}

@media (max-width: 640px) {
    .metrics-grid { grid-template-columns: 1fr; }
    .filter-group { flex-direction: column; }
    .filter-group .btn { width: 100%; min-width: 100%; }
    header h1 { font-size: 24px; }
    .modal-content { padding: 24px; width: 95%; margin: 5vh auto; }
}
