/* AquaDzannn Stats */

:root {
    --radius-lg: 22px;
    --button-radius: 14px;
    --font: Roboto, Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

:root[data-bs-theme="light"] {
    --body-color: #16231f;
    --heading: #173d34;
    --muted: #697771;
    --muted-2: #83918b;
    --page-bg: radial-gradient(circle at top left, rgba(30, 127, 104, .10), transparent 26rem), linear-gradient(180deg, #f3f8f5 0%, #eef4f1 100%);
    --surface: rgba(255, 255, 255, .90);
    --surface-solid: #ffffff;
    --surface-muted: #f6faf8;
    --input-bg: #fbfdfc;
    --floating-bg: rgba(255, 255, 255, .90);
    --table-head: #f0f6f3;
    --border: #d8e3de;
    --border-strong: #9bcfbc;
    --accent: #1e7f68;
    --accent-alt: #3b9078;
    --accent-rgb: 30, 127, 104;
    --accent-text: #0f5d4b;
    --glow: rgba(30, 127, 104, .16);
    --warning-bg: #fff5ea;
    --warning-border: #e5c99f;
    --warning-text: #87561c;
    --danger-bg: #fff2f2;
    --danger-border: #e3bcbc;
    --danger-text: #963f3f;
    --shadow-sm: 0 16px 42px rgba(22, 35, 31, .08);
}

:root[data-bs-theme="dark"] {
    --body-color: #dce8e3;
    --heading: #edf5f1;
    --muted: #99aaa3;
    --muted-2: #75867f;
    --page-bg: radial-gradient(circle at top left, rgba(55, 126, 103, .12), transparent 28rem), linear-gradient(180deg, #111b17 0%, #0c1512 100%);
    --surface: rgba(20, 32, 28, .92);
    --surface-solid: #17251f;
    --surface-muted: #1b2b25;
    --input-bg: #14211c;
    --floating-bg: rgba(19, 31, 27, .94);
    --table-head: #1d3028;
    --border: #2b4037;
    --border-strong: #4e7f6d;
    --accent: #52977f;
    --accent-alt: #39765f;
    --accent-rgb: 82, 151, 127;
    --accent-text: #a8d3c3;
    --glow: rgba(48, 111, 90, .18);
    --warning-bg: #30271b;
    --warning-border: #665238;
    --warning-text: #d9b77f;
    --danger-bg: #312020;
    --danger-border: #633d3d;
    --danger-text: #dca1a1;
    --shadow-sm: 0 16px 42px rgba(0, 0, 0, .22);
}

* { box-sizing: border-box; }
html { min-height: 100%; scroll-behavior: smooth; }
body { min-height: 100vh; margin: 0; background: var(--page-bg); background-attachment: fixed; color: var(--body-color); font-family: var(--font); line-height: 1.6; }
button, input, select { font: inherit; }
a { color: inherit; }
code { color: var(--accent-text); font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
body.theme-transition, body.theme-transition * { transition: background-color .35s ease, color .2s ease, border-color .35s ease, box-shadow .35s ease !important; }

.app-shell { width: min(1240px, calc(100% - 24px)); margin: 0 auto; padding: 0 0 60px; }

.app-brand { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; text-decoration: none; }
.app-brand-icon { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; padding: 7px; overflow: hidden; border-radius: 16px; background: linear-gradient(135deg, var(--accent), var(--accent-alt)); box-shadow: 0 12px 30px var(--glow); }
.app-brand-logo { display: block; width: 100%; height: 100%; object-fit: contain; }
.app-brand-title { display: block; color: #f4faf7; font-weight: 850; line-height: 1.05; letter-spacing: -.03em; }
.app-brand-subtitle { display: block; margin-top: 3px; color: rgba(244, 250, 247, .68); font-size: .76rem; line-height: 1.1; }

.tool-header { padding: 32px 0 22px; }
.tool-header-card { position: relative; overflow: hidden; padding: 34px; border-radius: 32px; background: linear-gradient(135deg, #173d34 0%, #1c6757 100%); color: #fff; box-shadow: var(--shadow-sm); }
.tool-header-card::before { content: ""; position: absolute; right: -120px; top: -90px; width: 320px; height: 320px; border-radius: 50%; background: rgba(255, 255, 255, .09); }
.dashboard-topline { position: relative; z-index: 2; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.hero-logout { padding: 8px 13px; border: 1px solid rgba(255,255,255,.18); border-radius: 12px; background: rgba(255,255,255,.09); color: #fff; font-weight: 750; cursor: pointer; }
.hero-logout:hover { background: rgba(255,255,255,.15); }
.hero-copy { position: relative; z-index: 1; max-width: 850px; margin-top: 44px; }
.hero-kicker, .section-kicker { display: block; margin-bottom: 7px; color: var(--accent-text); font-size: .72rem; font-weight: 900; letter-spacing: .10em; text-transform: uppercase; }
.tool-header .hero-kicker { color: rgba(255,255,255,.68); }
.tool-header h1 { max-width: 820px; margin: 8px 0 12px; color: #fff; font-size: clamp(34px, 5vw, 58px); line-height: 1.03; letter-spacing: -.04em; }
.tool-header p { max-width: 820px; margin: 0; color: rgba(255, 255, 255, .83); font-size: 17px; }

.dashboard-layout { display: grid; gap: 18px; }
.panel { padding: clamp(18px, 3vw, 28px); border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow-sm); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); }
.panel h2, .section-title h2 { margin: 0; color: var(--heading); font-size: clamp(1.45rem, 3vw, 2rem); line-height: 1.12; letter-spacing: -.035em; }
.panel h3 { margin: 0 0 18px; color: var(--heading); font-size: 1.05rem; letter-spacing: -.02em; }
.panel-heading { display: flex; justify-content: space-between; align-items: flex-end; gap: 28px; padding-bottom: 20px; border-bottom: 1px solid var(--border); }
.panel-heading > p { max-width: 540px; margin: 0; color: var(--muted); font-size: .9rem; line-height: 1.55; }

.filters-panel { display: grid; gap: 20px; }
.filter-heading { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; }
.filter-heading h2 { margin: 0; color: var(--heading); font-size: 1.65rem; letter-spacing: -.03em; }
.filter-heading p { margin: 5px 0 0; color: var(--muted); font-size: .82rem; }
.period-presets { display: flex; flex-wrap: wrap; gap: 7px; justify-content: flex-end; }
.preset { padding: 8px 11px; border: 1px solid var(--border); border-radius: 11px; background: var(--surface-muted); color: var(--muted); font-size: .8rem; font-weight: 750; text-decoration: none; transition: .18s ease; }
.preset:hover, .preset.is-active { border-color: rgba(var(--accent-rgb), .45); background: rgba(var(--accent-rgb), .10); color: var(--accent-text); }
.filter-form { display: grid; grid-template-columns: 170px 170px minmax(220px, 1fr) auto; align-items: end; gap: 10px; }
.field { display: grid; gap: 7px; }
.field > span { color: var(--heading); font-size: .8rem; font-weight: 800; }
.field input, .field select { width: 100%; min-height: 46px; padding: 9px 12px; border: 1px solid var(--border); border-radius: 13px; outline: 0; background: var(--input-bg); color: var(--body-color); }
.field input:focus, .field select:focus { border-color: rgba(var(--accent-rgb), .60); box-shadow: 0 0 0 .22rem rgba(var(--accent-rgb), .11); }

.button { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 10px 16px; border: 1px solid transparent; border-radius: var(--button-radius); font-weight: 800; letter-spacing: -.01em; cursor: pointer; text-decoration: none; transition: transform .18s ease, box-shadow .18s ease; }
.button:hover { transform: translateY(-1px); }
.button--primary { background: linear-gradient(135deg, var(--accent), var(--accent-alt)); color: #fff; box-shadow: 0 12px 26px rgba(var(--accent-rgb), .20); }
.button--wide { width: 100%; }

.section-nav { position: sticky; top: 10px; z-index: 30; display: flex; gap: 7px; overflow-x: auto; padding: 8px; border: 1px solid var(--border); border-radius: 16px; background: var(--floating-bg); box-shadow: var(--shadow-sm); backdrop-filter: blur(16px); scrollbar-width: thin; }
.section-nav a { flex: 0 0 auto; padding: 7px 10px; border-radius: 10px; color: var(--muted); font-size: .78rem; font-weight: 750; text-decoration: none; }
.section-nav a:hover { background: rgba(var(--accent-rgb), .10); color: var(--accent-text); }

.overview-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.metric-card { padding: 20px; border: 1px solid var(--border); border-radius: 20px; background: var(--surface); box-shadow: var(--shadow-sm); }
.metric-card > span { display: block; color: var(--muted); font-size: .78rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; }
.metric-card strong { display: block; margin: 6px 0 2px; color: var(--heading); font-size: clamp(2rem, 5vw, 3.15rem); line-height: 1; letter-spacing: -.06em; }
.metric-card small { color: var(--muted-2); }

.trend-chart { display: flex; align-items: stretch; gap: 5px; height: 220px; margin-top: 22px; overflow-x: auto; padding: 10px 2px 0; }
.trend-item { flex: 1 0 22px; min-width: 22px; display: grid; grid-template-rows: 18px 1fr 28px; gap: 5px; align-items: end; text-align: center; }
.trend-value { overflow: hidden; color: var(--muted-2); font-size: .65rem; white-space: nowrap; }
.trend-bar-wrap { height: 100%; display: flex; align-items: flex-end; justify-content: center; border-bottom: 1px solid var(--border); }
.trend-bar { width: min(100%, 18px); min-height: 0; border-radius: 6px 6px 2px 2px; background: linear-gradient(180deg, var(--accent), var(--accent-alt)); opacity: .88; }
.trend-label { align-self: start; color: var(--muted-2); font-size: .64rem; transform: rotate(-35deg); transform-origin: center; white-space: nowrap; }

.table-wrap { margin-top: 20px; overflow-x: auto; border: 1px solid var(--border); border-radius: 16px; }
.data-table { width: 100%; min-width: 640px; border-collapse: collapse; }
.data-table th, .data-table td { padding: 13px 15px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: middle; }
.data-table tr:last-child td { border-bottom: 0; }
.data-table th { background: var(--table-head); color: var(--muted); font-size: .72rem; font-weight: 850; letter-spacing: .06em; text-transform: uppercase; }
.data-table td { color: var(--body-color); font-size: .88rem; }
.number-cell { width: 140px; font-variant-numeric: tabular-nums; font-weight: 850; }
.page-cell { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 2px 8px; align-items: center; }
.page-cell strong { min-width: 0; color: var(--heading); overflow-wrap: anywhere; }
.page-cell small { grid-column: 2; color: var(--muted-2); }
.app-badge { padding: 4px 7px; border-radius: 8px; background: rgba(var(--accent-rgb), .10); color: var(--accent-text); font-size: .66rem; font-weight: 850; text-transform: uppercase; }
.cell-subtitle { display: block; max-width: 520px; margin-top: 3px; color: var(--muted); overflow-wrap: anywhere; }
.country-code { margin-left: 7px; color: var(--muted-2); font-size: .7rem; }
.empty-cell { padding: 28px !important; color: var(--muted) !important; text-align: center !important; }

.section-stack { display: grid; gap: 12px; scroll-margin-top: 82px; }
.section-title { padding: 14px 4px 2px; }
.triple-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.two-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.mini-panel { min-width: 0; }
.subpanel { padding: 18px; border: 1px solid var(--border); border-radius: 17px; background: var(--surface-muted); }

.bar-list { display: grid; gap: 13px; }
.bar-row { display: grid; grid-template-columns: 1fr auto; gap: 5px 9px; align-items: center; }
.bar-meta { grid-column: 1 / -1; display: flex; justify-content: space-between; gap: 15px; }
.bar-meta span { color: var(--body-color); font-size: .86rem; }
.bar-meta strong { color: var(--heading); font-size: .85rem; }
.bar-track { height: 7px; overflow: hidden; border-radius: 999px; background: var(--surface-muted); }
.bar-track span { display: block; height: 100%; min-width: 2px; border-radius: inherit; background: linear-gradient(90deg, var(--accent), var(--accent-alt)); }
.bar-row > small { color: var(--muted-2); font-size: .7rem; }
.rank-list { display: grid; gap: 1px; }
.rank-list > div { display: flex; justify-content: space-between; gap: 15px; padding: 10px 0; border-bottom: 1px solid var(--border); font-size: .86rem; }
.rank-list > div:last-child { border-bottom: 0; }
.rank-list span { min-width: 0; overflow-wrap: anywhere; }
.rank-list strong { flex: 0 0 auto; color: var(--heading); }
.rank-list small { color: var(--muted-2); font-weight: 500; }

.behavior-metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: 20px; }
.behavior-metrics > div { padding: 15px; border: 1px solid var(--border); border-radius: 15px; background: var(--surface-muted); }
.behavior-metrics span { display: block; color: var(--muted); font-size: .75rem; }
.behavior-metrics strong { display: block; margin-top: 4px; color: var(--heading); font-size: 1.4rem; }
.behavior-grid { margin-top: 12px; }

.performance-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: 20px; }
.performance-grid article { padding: 17px; border: 1px solid var(--border); border-radius: 16px; background: var(--surface-muted); }
.performance-grid span { display: block; color: var(--muted); font-size: .75rem; font-weight: 750; }
.performance-grid strong { display: block; margin: 5px 0 2px; color: var(--heading); font-size: 1.45rem; }
.performance-grid small { color: var(--muted-2); }
.error-counter { flex: 0 0 auto; text-align: right; }
.error-counter strong { display: block; color: var(--danger-text); font-size: 2rem; line-height: 1; }
.error-counter span { color: var(--muted); font-size: .72rem; }

.empty-state { padding: 36px 18px; color: var(--muted); text-align: center; }
.empty-state.compact { padding: 18px 0; }

.footer { padding: 0 0 44px; color: var(--muted); text-align: center; font-size: 13px; }
.footer a { color: var(--accent-text); text-decoration: underline; font-weight: 600; }

.floating-tools { position: fixed; right: max(18px, env(safe-area-inset-right)); bottom: max(18px, env(safe-area-inset-bottom)); z-index: 1000; display: flex; flex-direction: column; gap: 8px; padding: 7px; border: 1px solid var(--border); border-radius: 18px; background: var(--floating-bg); box-shadow: var(--shadow-sm); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); }
.floating-tool { display: grid; place-items: center; width: 42px; height: 42px; padding: 0; border: 0; border-radius: 12px; background: transparent; color: var(--muted); cursor: pointer; }
.floating-tool:hover { background: rgba(var(--accent-rgb), .10); color: var(--accent-text); }
.floating-tool__icon { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
[data-bs-theme="dark"] .theme-icon--moon, [data-bs-theme="light"] .theme-icon--sun { display: none; }

.login-page { min-height: 100vh; display: grid; place-items: center; padding: 24px 0; }
.login-card { width: min(930px, 100%); display: grid; grid-template-columns: 1.1fr .9fr; overflow: hidden; border: 1px solid var(--border); border-radius: 30px; background: var(--surface); box-shadow: var(--shadow-sm); }
.login-hero { min-height: 500px; display: flex; flex-direction: column; justify-content: space-between; padding: 34px; background: linear-gradient(135deg, #173d34 0%, #1c6757 100%); color: #fff; }
.login-hero h1 { margin: 9px 0 10px; font-size: clamp(2.2rem, 5vw, 3.5rem); line-height: 1; letter-spacing: -.05em; }
.login-hero p { margin: 0; color: rgba(255,255,255,.76); }
.login-form-wrap { display: flex; flex-direction: column; justify-content: center; padding: clamp(24px, 5vw, 44px); }
.login-form-wrap h2 { margin: 0 0 20px; color: var(--heading); font-size: 1.8rem; }
.login-form { display: grid; gap: 14px; }
.alert { margin-bottom: 14px; padding: 12px 14px; border-radius: 13px; font-size: .84rem; }
.alert--error { border: 1px solid var(--danger-border); background: var(--danger-bg); color: var(--danger-text); }
.alert--warning { border: 1px solid var(--warning-border); background: var(--warning-bg); color: var(--warning-text); }

.error-page { display: grid; place-items: center; min-height: 100vh; padding: 24px 0; }
.error-card { position: relative; width: min(100%, 760px); overflow: hidden; padding: clamp(28px, 6vw, 56px); border-radius: 32px; background: linear-gradient(135deg, #173d34 0%, #1c6757 100%); color: #fff; box-shadow: var(--shadow-sm); }
.error-decoration { position: absolute; top: -120px; right: -120px; width: 340px; height: 340px; border-radius: 50%; background: rgba(255,255,255,.08); }
.error-brand { position: relative; z-index: 2; }
.error-code { position: relative; z-index: 1; margin-top: 44px; color: rgba(255,255,255,.16); font-size: clamp(90px, 18vw, 155px); font-weight: 900; line-height: .78; letter-spacing: -.075em; }
.error-card h1 { position: relative; z-index: 2; margin: 30px 0 12px; color: #fff; font-size: clamp(30px, 5vw, 44px); line-height: 1.08; }
.error-text { position: relative; z-index: 2; max-width: 590px; margin: 0; color: rgba(255,255,255,.76); }
.error-action { position: relative; z-index: 2; display: inline-flex; margin-top: 30px; padding: 11px 15px; border: 1px solid rgba(255,255,255,.18); border-radius: 14px; background: rgba(255,255,255,.12); color: #fff; font-weight: 750; text-decoration: none; }

#visits, #behavior, #performance, #errors, #geo { scroll-margin-top: 82px; }

@media (max-width: 950px) {
    .triple-grid { grid-template-columns: 1fr; }
    .overview-grid { grid-template-columns: repeat(2, 1fr); }
    .filter-heading { align-items: flex-start; flex-direction: column; }
    .period-presets { justify-content: flex-start; }
    .filter-form { grid-template-columns: repeat(2, 1fr); }
    .field--app { grid-column: 1 / -1; }
    .filter-form .button { grid-column: 1 / -1; }
}

@media (max-width: 720px) {
    .tool-header { padding-top: 10px; }
    .tool-header-card { padding: 26px 22px; border-radius: 24px; }
    .hero-copy { margin-top: 38px; }
    .tool-header h1 { font-size: clamp(2rem, 11vw, 2.8rem); }
    .two-grid, .performance-grid { grid-template-columns: 1fr; }
    .behavior-metrics { grid-template-columns: 1fr; }
    .panel-heading { align-items: flex-start; flex-direction: column; gap: 10px; }
    .error-counter { text-align: left; }
    .login-card { grid-template-columns: 1fr; }
    .login-hero { min-height: 300px; }
}

@media (max-width: 520px) {
    .app-shell { width: min(100% - 16px, 1240px); }
    .overview-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
    .metric-card { padding: 15px; border-radius: 16px; }
    .metric-card strong { font-size: 2rem; }
    .filter-form { grid-template-columns: 1fr; }
    .field--app, .filter-form .button { grid-column: auto; }
    .dashboard-topline { align-items: flex-start; }
    .hero-logout { padding: 7px 10px; }
    .trend-chart { height: 190px; }
    .floating-tools { right: 10px; bottom: 10px; }
}
