/* ------------------------------------------------------------------
   Cookietracker admin styles. Single file, no framework.
   ------------------------------------------------------------------ */
:root {
    --sidebar-w: 245px;
    --topbar-h: 70px;
    --c-sidebar: #2c2e3e;
    --c-sidebar-dark: #23242f;
    --c-sidebar-text: #c9cbd8;
    --c-bg: #f2f3f8;
    --c-card: #ffffff;
    --c-text: #575962;
    --c-heading: #3f4047;
    --c-muted: #9699a2;
    --c-border: #e2e5ec;
    --c-primary: #a3c93a;
    --c-primary-dark: #8fb32b;
    --c-danger: #f4516c;
    --c-danger-dark: #e63d59;
    --c-purple: #716aca;
    --c-thead: #575962;
    --c-success: #34bfa3;
    --radius: 4px;
    --shadow: 0 1px 15px 1px rgba(69, 65, 78, .08);
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { font-size: 14px; }
body {
    margin: 0;
    font-family: var(--font);
    color: var(--c-text);
    background: var(--c-bg);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}
a { color: var(--c-purple); text-decoration: none; }
a:hover { text-decoration: underline; }
svg { width: 1.15em; height: 1.15em; fill: currentColor; vertical-align: -0.2em; }
h1, h2, h3, h4 { color: var(--c-heading); font-weight: 500; margin: 0; }
b, strong { font-weight: 600; }
small { color: var(--c-muted); font-weight: 400; }

/* Layout ---------------------------------------------------------- */
.app { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-w);
    background: var(--c-sidebar);
    color: var(--c-sidebar-text);
    flex-shrink: 0;
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 30;
    display: flex;
    flex-direction: column;
    transition: transform .2s;
}
.brand {
    height: var(--topbar-h);
    background: var(--c-sidebar-dark);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px 0 24px;
}
.brand a { color: #fff; font-size: 20px; font-weight: 500; }
.brand a:hover { text-decoration: none; }
.brand-toggle, .topbar-menu {
    background: none; border: 0; cursor: pointer; padding: 6px; width: 30px;
    display: flex; flex-direction: column; gap: 4px;
}
.brand-toggle span, .topbar-menu span { display: block; height: 2px; background: #6f7286; border-radius: 2px; }
.brand-toggle span:nth-child(2) { width: 70%; }
.topbar-menu { display: none; }
.topbar-menu span { background: var(--c-text); }

.menu { padding: 20px 0; overflow-y: auto; }
.menu-item {
    display: flex; align-items: center; gap: 14px; width: 100%;
    padding: 11px 30px; color: var(--c-sidebar-text); font-size: 14px;
    background: none; border: 0; cursor: pointer; text-align: left; font-family: inherit;
}
.menu-item svg { width: 22px; height: 22px; color: #6f7286; flex-shrink: 0; }
.menu-item:hover, .menu-item.active { background: #383a4c; color: #fff; text-decoration: none; }
.menu-item.active svg { color: var(--c-primary); }
.menu-item .chev { margin-left: auto; width: 16px; height: 16px; transition: transform .2s; }
.menu-group.open .chev { transform: rotate(90deg); }
.submenu { display: none; background: var(--c-sidebar-dark); padding: 6px 0; }
.menu-group.open .submenu { display: block; }
.submenu-item {
    display: block; padding: 9px 30px 9px 52px; color: var(--c-sidebar-text); font-size: 13.5px; position: relative;
}
.submenu-item::before {
    content: ""; position: absolute; left: 36px; top: 50%; width: 4px; height: 4px; border-radius: 50%;
    background: #6f7286; transform: translateY(-50%);
}
.submenu-item:hover, .submenu-item.active { color: #fff; text-decoration: none; }
.submenu-item.active::before { background: var(--c-primary); }

.main { flex: 1; margin-left: var(--sidebar-w); display: flex; flex-direction: column; min-width: 0; }

.topbar {
    height: var(--topbar-h); background: var(--c-card); box-shadow: 0 1px 15px 1px rgba(69, 65, 78, .1);
    display: flex; align-items: center; justify-content: flex-end; padding: 0 30px; position: sticky; top: 0; z-index: 20;
}
.topbar-user { position: relative; }
.avatar {
    width: 42px; height: 42px; border-radius: 50%; border: 0; cursor: pointer;
    background: #e8e9f0; color: #aaacb8; display: grid; place-items: center;
}
.avatar svg { width: 30px; height: 30px; }
.dropdown {
    display: none; position: absolute; right: 0; top: 52px; width: 260px; background: var(--c-card);
    box-shadow: var(--shadow); border-radius: var(--radius); overflow: hidden;
}
.topbar-user.open .dropdown { display: block; }
.dropdown-head { background: var(--c-sidebar); color: #fff; padding: 20px; display: flex; flex-direction: column; }
.dropdown-head small { color: #b8bacb; }
.dropdown form { padding: 14px; }

.content { padding: 24px 30px 40px; flex: 1; }
.footer { padding: 16px 30px; color: var(--c-muted); font-size: 13px; }

/* Page head -------------------------------------------------------- */
.page-head { display: flex; align-items: center; gap: 14px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head h3 { font-size: 20px; padding-right: 16px; border-right: 1px solid #d5d6de; }
.breadcrumbs { list-style: none; margin: 0; padding: 0; display: flex; gap: 10px; align-items: center; color: var(--c-muted); font-size: 13px; }
.breadcrumbs a { color: var(--c-muted); }
.breadcrumbs svg { width: 18px; height: 18px; }

/* Card -------------------------------------------------------------- */
.card { background: var(--c-card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px 16px; }
.card-head { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.card-title { font-size: 21px; margin-right: auto; }
.card-title small { font-size: 13px; margin-left: 8px; }

.range-form { display: flex; align-items: center; gap: 0; }
.range-form .input-icon {
    display: grid; place-items: center; width: 42px; height: 40px; background: #f4f5f8;
    border: 1px solid var(--c-border); border-right: 0; border-radius: var(--radius) 0 0 var(--radius); color: var(--c-muted);
}
.range-form .form-control { border-radius: 0; width: 150px; }
.range-form .range-sep { padding: 0 8px; border: 1px solid var(--c-border); border-left: 0; border-right: 0; height: 40px; line-height: 38px; color: var(--c-muted); }
.range-form .btn { border-radius: 0 var(--radius) var(--radius) 0; height: 40px; }
.range-form .btn + .btn { margin-left: 6px; border-radius: var(--radius); }

/* Forms ------------------------------------------------------------- */
.form-group { margin-bottom: 18px; }
.form-group label { display: block; font-weight: 600; color: var(--c-heading); margin-bottom: 6px; }
.form-control {
    display: block; width: 100%; height: 40px; padding: 0 12px; font: inherit; color: var(--c-text);
    background: #fff; border: 1px solid var(--c-border); border-radius: var(--radius); outline: 0;
}
.form-control:focus { border-color: #b6b9c4; }
select.form-control { padding-right: 30px; }
.form-control-sm { height: 32px; padding: 0 8px; }
input[type="number"].form-control { width: 90px; }

/* Buttons ----------------------------------------------------------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    height: 40px; padding: 0 18px; font: inherit; font-weight: 500; color: #fff;
    background: #ccc; border: 1px solid transparent; border-radius: var(--radius); cursor: pointer; white-space: nowrap;
}
.btn:hover { text-decoration: none; filter: brightness(.96); }
.btn:active { filter: brightness(.9); }
.btn-primary { background: var(--c-primary); }
.btn-danger { background: var(--c-danger); }
.btn-purple { background: var(--c-purple); }
.btn-light { background: #f4f5f8; color: var(--c-text); border-color: var(--c-border); }
.btn-sm { height: 32px; padding: 0 12px; }
.btn-block { width: 100%; }
.btn-pill { border-radius: 60px; padding: 0 34px; }
.btn-group { display: inline-flex; }
.btn-group .btn { border-radius: 0; }
.btn-group .btn:first-child { border-radius: var(--radius) 0 0 var(--radius); }
.btn-group .btn:last-child { border-radius: 0 var(--radius) var(--radius) 0; }

/* Copy-link group (campaign link) */
.copy-group { display: flex; }
.copy-group .form-control { width: 320px; border-radius: var(--radius) 0 0 var(--radius); font-size: 12px; }
.copy-group .btn { border-radius: 0; padding: 0 10px; }
.copy-group .btn:last-child { border-radius: 0 var(--radius) var(--radius) 0; }

/* Table ------------------------------------------------------------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; white-space: nowrap; }
.table th, .table td { padding: 12px 10px; border: 1px solid var(--c-border); vertical-align: middle; }
.table thead th {
    background: var(--c-thead); color: #fff; font-weight: 600; text-align: left; border-color: #6a6c75;
    user-select: none;
}
.table thead th[data-sort] { cursor: pointer; padding-right: 26px; position: relative; }
.table thead th[data-sort]::after {
    content: "\2195"; position: absolute; right: 10px; opacity: .45; font-size: 12px;
}
.table thead th.asc::after { content: "\2191"; opacity: 1; }
.table thead th.desc::after { content: "\2193"; opacity: 1; }
.table tbody tr:hover { background: #fafbfd; }
.table tr.empty td { text-align: center; color: var(--c-muted); padding: 30px; white-space: normal; }
.text-right { text-align: right; }
.table-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 16px; flex-wrap: wrap; gap: 10px; }
.table-info { color: var(--c-text); }

.badge {
    display: inline-block; min-width: 88px; padding: 4px 14px; text-align: center; border-radius: 4px;
    background: var(--c-purple); color: #fff; font-weight: 600; font-size: 15px;
}
.badge:hover { text-decoration: none; filter: brightness(1.08); }

/* Pager */
.pager { display: flex; gap: 6px; }
.pager button {
    min-width: 30px; height: 30px; border-radius: 50%; border: 0; background: #f0f1f5; color: var(--c-muted);
    cursor: pointer; font: inherit;
}
.pager button.active { background: var(--c-purple); color: #fff; }
.pager button:disabled { opacity: .5; cursor: default; }
.pager-link {
    display: inline-flex; align-items: center; justify-content: center; min-width: 30px; height: 30px; padding: 0 8px;
    border-radius: 15px; background: #f0f1f5; color: var(--c-muted);
}
.pager-link:hover { text-decoration: none; background: #e4e6ee; }
.pager-link.active { background: var(--c-purple); color: #fff; }
.pager-link.disabled { opacity: .5; pointer-events: none; }
.range-form .search-input { width: 300px; }

/* Toggle switch (Enable / Disable) ---------------------------------- */
.switch { position: relative; display: inline-block; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch-track {
    display: flex; align-items: center; width: 142px; height: 36px; border-radius: 3px; border: 1px solid var(--c-border);
    background: #f4f5f8; overflow: hidden; position: relative; font-weight: 500; color: #fff;
}
.switch-on, .switch-off { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; transition: transform .2s; }
.switch-on { background: var(--c-primary); transform: translateX(-100%); padding-right: 14px; }
.switch-off { background: #dfe1e8; color: #6a6c75; transform: translateX(0); padding-left: 14px; }
.switch-knob {
    position: absolute; top: 2px; left: 2px; width: 12px; height: 30px; background: #fff; border-radius: 2px;
    box-shadow: 0 0 3px rgba(0,0,0,.2); transition: transform .2s;
}
.switch input:checked + .switch-track .switch-on { transform: translateX(0); }
.switch input:checked + .switch-track .switch-off { transform: translateX(100%); }
.switch input:checked + .switch-track .switch-knob { transform: translateX(124px); }

/* Compact table variant */
.table-compact th, .table-compact td { padding: 6px 10px; font-size: 13px; }
.table-compact thead th { padding-top: 9px; padding-bottom: 9px; }
.table-compact .btn-sm { height: 26px; padding: 0 9px; }
.table-compact .btn-sm svg { width: 14px; height: 14px; }
.table-compact .switch-sm .switch-track { width: 74px; height: 24px; font-size: 12px; }
.table-compact .switch-sm .switch-knob { height: 18px; width: 9px; }
.table-compact .switch-sm input:checked + .switch-track .switch-knob { transform: translateX(59px); }
.table-compact .switch-sm .switch-on { padding-right: 9px; }
.table-compact .switch-sm .switch-off { padding-left: 9px; }

/* Small On/Off variant */
.switch-sm .switch-track { width: 90px; height: 32px; }
.switch-sm .switch-knob { height: 26px; }
.switch-sm input:checked + .switch-track .switch-knob { transform: translateX(72px); }

/* Alerts & toasts --------------------------------------------------- */
.alert {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 12px 16px; border-radius: var(--radius); margin-bottom: 18px; color: #fff;
}
.alert-success { background: var(--c-success); }
.alert-danger { background: var(--c-danger); }
.alert-close { background: none; border: 0; color: inherit; font-size: 22px; line-height: 1; cursor: pointer; opacity: .8; }
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 60; display: flex; flex-direction: column; gap: 8px; }
.toast {
    padding: 11px 16px; border-radius: var(--radius); color: #fff; background: var(--c-success);
    box-shadow: var(--shadow); animation: toast-in .2s;
}
.toast.error { background: var(--c-danger); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* Modal -------------------------------------------------------------- */
.modal {
    display: none; position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,.5);
    align-items: flex-start; justify-content: center; padding: 40px 16px; overflow-y: auto;
}
.modal.open { display: flex; }
.modal-dialog { width: 100%; max-width: 800px; background: #fff; border-radius: var(--radius); box-shadow: 0 10px 40px rgba(0,0,0,.3); animation: modal-in .15s; }
@keyframes modal-in { from { opacity: 0; transform: translateY(-10px); } }
.modal-head { display: flex; align-items: center; justify-content: space-between; background: var(--c-primary); color: #fff; padding: 12px 24px; border-radius: var(--radius) var(--radius) 0 0; }
.modal-head h4 { color: #fff; font-size: 16px; }
.modal-close { background: none; border: 0; color: #fff; font-size: 24px; line-height: 1; cursor: pointer; }
.modal-body { padding: 24px 24px 6px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 16px 24px; border-top: 1px solid var(--c-border); }
.modal-dialog.modal-sm { max-width: 440px; }
.modal-body p { margin: 0 0 8px; }

/* Loading overlay ---------------------------------------------------- */
.loading { display: none; position: fixed; inset: 0; z-index: 70; background: rgba(255,255,255,.6); place-items: center; }
.loading.show { display: grid; }
.spinner { width: 40px; height: 40px; border: 4px solid #d9dbe3; border-top-color: var(--c-purple); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.overlay { display: none; position: fixed; inset: 0; z-index: 25; background: rgba(0,0,0,.4); }

/* Dashboard stats ---------------------------------------------------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; }
.stat { background: var(--c-card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px; display: flex; flex-direction: column; }
.stat-value { font-size: 30px; font-weight: 600; color: var(--c-purple); }
.stat-label { color: var(--c-muted); }

/* Login -------------------------------------------------------------- */
.login-page { background: var(--c-sidebar); display: grid; place-items: center; min-height: 100vh; }
.login-box { width: 100%; max-width: 420px; padding: 40px; background: #fff; border-radius: 6px; box-shadow: 0 10px 40px rgba(0,0,0,.3); }
.login-box h1 { text-align: center; margin-bottom: 30px; font-size: 28px; }
.login-actions { text-align: center; margin-top: 26px; }

/* Responsive --------------------------------------------------------- */
@media (max-width: 1024px) {
    .sidebar { transform: translateX(-100%); }
    body.sidebar-open .sidebar { transform: none; }
    body.sidebar-open .overlay { display: block; }
    .main { margin-left: 0; }
    .topbar { justify-content: space-between; }
    .topbar-menu { display: flex; }
    .brand-toggle { display: none; }
    .content { padding: 16px; }
    .card-head { flex-direction: column; align-items: stretch; }
    .card-title { margin-right: 0; }
    .range-form { flex-wrap: wrap; }
    .range-form .form-control { flex: 1; }
}
