/* ============================================
   MARGIQO BRANDING - Qonnection Dashboard
   ============================================ */

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

:root {
    /* Brand / Primary (Oranje) */
    --primary-600: #EA580C;
    --primary-500: #F97316;
    --primary-400: #FB923C;
    --primary-100: #FFEDD5;

    /* Achtergronden (dark-only) */
    --bg: #07090D;
    --sidebar-bg: #0B0E14;
    --card-bg: #10141C;
    --surface: #151A24;
    --border: #222938;

    /* Tekst */
    --text-primary: #F8FAFC;
    --text-secondary: #94A3B8;

    /* Semantisch */
    --green: #22C55E;
    --red: #EF4444;
    --yellow: #F59E0B;

    /* Structuur */
    --sidebar-width: 240px;
    --topbar-height: 60px;
    --radius: 8px;
    --radius-lg: 12px;
    --radius-sm: 6px;
    --radius-pill: 100px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.5;
}

.container { display: flex; height: 100vh; }

/* SIDEBAR */
.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border);
    padding: 20px 0;
    overflow-y: auto;
    flex-shrink: 0;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 30px;
    padding: 0 20px;
    font-weight: 700;
    font-size: 18px;
    letter-spacing: -0.3px;
    color: var(--primary-500);
}

.sidebar-menu { list-style: none; margin-bottom: 20px; }
.sidebar-menu li { margin-bottom: 2px; }

.sidebar-menu a {
    display: block;
    padding: 9px 20px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 13.5px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    border-right: 2px solid transparent;
}

.sidebar-menu a:hover {
    background: rgba(234, 88, 12, 0.08);
    color: var(--text-primary);
}

.sidebar-menu a.active {
    background: rgba(234, 88, 12, 0.15);
    color: var(--primary-400);
    border-right: 2px solid var(--primary-500);
    font-weight: 600;
}

.sidebar-section {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

.sidebar-section-title {
    font-size: 10px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 12px;
    padding: 0 20px;
}

/* MAIN / TOPBAR */
.main { flex: 1; display: flex; flex-direction: column; overflow: hidden; }

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

.header-title { font-size: 16px; font-weight: 600; color: var(--text-primary); }

.refresh-btn {
    background: var(--primary-600);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.15s;
}

.refresh-btn:hover { background: var(--primary-500); }

.content { flex: 1; overflow-y: auto; padding: 24px; }

.page { display: none; }
.page.active { display: block; }

/* KPI CARDS */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.metric-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    position: relative;
    overflow: hidden;
}

.metric-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 2px;
    background: var(--primary-600);
    opacity: 0;
    transition: opacity 0.2s;
}

.metric-card:hover::before { opacity: 1; }
.metric-card.highlight { border-color: var(--primary-600); }

.metric-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 8px;
}

.metric-value {
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -0.5px;
    line-height: 1.1;
    color: var(--text-primary);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    margin-bottom: 8px;
}

.metric-sub {
    font-size: 12px;
    font-weight: 400;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* CARDS / SECTIONS */
.section-title { font-size: 14px; font-weight: 600; margin-bottom: 20px; color: var(--text-primary); }

.chart-section, .table-section {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 24px;
}

.chart-container { position: relative; height: 300px; margin-bottom: 20px; }

/* TABLES */
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }

table th {
    text-align: left;
    padding: 10px 14px;
    color: var(--text-secondary);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 0.06em;
    border-bottom: 1px solid var(--border);
}

table td { padding: 12px 14px; border-bottom: 1px solid var(--border); font-weight: 400; }

table tr:hover { background: rgba(255, 255, 255, 0.025); transition: background 0.1s; }

.status-ok {
    color: var(--green); font-weight: 600; background: rgba(34, 197, 94, 0.12);
    padding: 3px 8px; border-radius: var(--radius-pill); font-size: 11px; display: inline-block;
}

.status-error {
    color: var(--red); font-weight: 600; background: rgba(239, 68, 68, 0.12);
    padding: 3px 8px; border-radius: var(--radius-pill); font-size: 11px; display: inline-block;
}

.status-warning {
    color: var(--yellow); font-weight: 600; background: rgba(245, 158, 11, 0.12);
    padding: 3px 8px; border-radius: var(--radius-pill); font-size: 11px; display: inline-block;
}

/* FORMS */
.form-group { margin-bottom: 16px; }

.form-label {
    display: block; font-size: 12px; font-weight: 600; letter-spacing: 0.03em;
    margin-bottom: 8px; color: var(--text-secondary);
}

.form-input {
    width: 100%;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 9px 12px;
    color: var(--text-primary);
    font-size: 13px;
    font-family: inherit;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary-500);
    box-shadow: 0 0 0 3px rgba(234, 88, 12, 0.15);
}

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* BUTTONS */
.btn-primary {
    background: var(--primary-600); border: none; color: white;
    padding: 8px 16px; border-radius: var(--radius); cursor: pointer;
    font-size: 13px; font-weight: 500; transition: all 0.15s;
}
.btn-primary:hover { background: var(--primary-500); }

.btn-secondary {
    background: var(--surface); border: 1px solid var(--border); color: var(--text-secondary);
    padding: 8px 16px; border-radius: var(--radius); cursor: pointer;
    font-size: 13px; font-weight: 500; transition: all 0.15s;
}
.btn-secondary:hover { background: rgba(234, 88, 12, 0.08); color: var(--text-primary); border-color: var(--primary-600); }

.btn-danger {
    background: rgba(239, 68, 68, 0.12); color: var(--red); border: 1px solid var(--red);
    padding: 8px 16px; border-radius: var(--radius); cursor: pointer;
    font-size: 13px; font-weight: 500; transition: all 0.15s;
}
.btn-danger:hover { background: var(--red); color: white; }

/* MESSAGES */
.success-message {
    background: rgba(34, 197, 94, 0.12); color: var(--green); border: 1px solid var(--green);
    border-left: 3px solid var(--green); padding: 12px 16px; border-radius: var(--radius);
    margin-bottom: 16px; font-size: 13px;
}

.error-message {
    background: rgba(239, 68, 68, 0.12); color: var(--red); border: 1px solid var(--red);
    border-left: 3px solid var(--red); padding: 12px 16px; border-radius: var(--radius);
    margin-bottom: 16px; font-size: 13px;
}

.empty-message { text-align: center; padding: 48px 24px; color: var(--text-secondary); font-size: 13px; }
.loading { text-align: center; padding: 48px 24px; color: var(--text-secondary); font-size: 13px; }

/* TABS */
.tab-buttons {
    display: flex; gap: 8px; margin-bottom: 20px;
    border-bottom: 1px solid var(--border); padding-bottom: 12px;
}

.tab-btn {
    background: transparent; border: none; color: var(--text-secondary);
    padding: 8px 16px; cursor: pointer; font-size: 13px; font-weight: 500;
    border-bottom: 2px solid transparent; transition: all 0.15s;
}
.tab-btn.active { color: var(--primary-400); border-bottom-color: var(--primary-500); }

/* ACCOUNT CARDS */
.account-card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 16px; margin-bottom: 12px;
}

.account-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.account-name { font-weight: 600; font-size: 13.5px; color: var(--text-primary); }

.account-remove {
    background: rgba(239, 68, 68, 0.12); color: var(--red); border: none;
    padding: 5px 10px; border-radius: var(--radius-pill); cursor: pointer;
    font-size: 12px; font-weight: 500; transition: all 0.15s;
}
.account-remove:hover { background: var(--red); color: white; }

/* BADGES */
.badge { display: inline-block; padding: 3px 8px; border-radius: var(--radius-pill); font-size: 11px; font-weight: 600; }
.badge-green { background: rgba(34, 197, 94, 0.12); color: var(--green); }
.badge-red { background: rgba(239, 68, 68, 0.12); color: var(--red); }
.badge-yellow { background: rgba(245, 158, 11, 0.12); color: var(--yellow); }
.badge-orange { background: rgba(234, 88, 12, 0.12); color: var(--primary-400); }
.badge-gray { background: rgba(148, 163, 184, 0.12); color: var(--text-secondary); }

/* NOTIFICATIE BADGE */
#notifBadge {
    background: var(--red) !important; color: white; border-radius: 50%;
    padding: 1px 7px; font-size: 11px; font-weight: 600; margin-left: 6px;
}

/* SPINNER */
.spinner {
    width: 18px; height: 18px; border: 2px solid var(--border);
    border-top-color: var(--primary-500); border-radius: 50%;
    animation: spin 0.6s linear infinite; display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* TOAST */
.toast {
    position: fixed; bottom: 20px; right: 20px;
    background: var(--card-bg); border-left: 3px solid var(--primary-500);
    border-radius: var(--radius); padding: 12px 16px; font-size: 13px;
    color: var(--text-primary); box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.2s ease; z-index: 1000;
}
.toast.success { border-left-color: var(--green); }
.toast.error { border-left-color: var(--red); }
.toast.warning { border-left-color: var(--yellow); }
@keyframes slideUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* SCROLLBAR */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--surface); }

/* RESPONSIVE */
@media (max-width: 900px) {
    .content { padding: 16px; }
    .header { padding: 0 16px; }
    .metrics-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
}

@media (max-width: 500px) {
    .metrics-grid { grid-template-columns: 1fr; }
    .header { padding: 0 16px; }
}
