/* =========================================================================
   Dibi Tech — Tabler brand overrides + polish (loaded AFTER tabler.min.css)
   ========================================================================= */

/* Inter (local, no Google Fonts fetch) */
@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
    src: url('/tabler/fonts/inter/inter-latin.woff2') format('woff2');
}

:root {
    --tblr-primary: #1FA855;            /* WhatsApp green */
    --tblr-primary-rgb: 31, 168, 85;
    --tblr-primary-darker: #178D43;
    --tblr-link-color: #1FA855;
    --tblr-link-color-rgb: 31, 168, 85;
    --dt-slate: #111B21;                /* WhatsApp dark slate */

    /* Elevation system — use these exclusively for box-shadows */
    --elevation-1: 0 1px 2px 0 rgba(15, 23, 42, 0.04), 0 1px 1px 0 rgba(15, 23, 42, 0.03);
    --elevation-2: 0 1px 3px 0 rgba(15, 23, 42, 0.06), 0 1px 2px 0 rgba(15, 23, 42, 0.04);
    --elevation-3: 0 4px 12px -2px rgba(15, 23, 42, 0.08), 0 2px 4px -1px rgba(15, 23, 42, 0.04);
    --elevation-4: 0 12px 32px -8px rgba(15, 23, 42, 0.12), 0 4px 8px -2px rgba(15, 23, 42, 0.06);

    /* Transition standard */
    --transition-fast:   100ms ease;
    --transition-base:   150ms ease;
    --transition-smooth: 250ms ease-out;
}

/* Sidebar: dark slate (Tabler beta20 themes the navbar via data-bs-theme="dark") */
.navbar-vertical[data-bs-theme="dark"] {
    background-color: var(--dt-slate) !important;
    border-color: #1d2c34 !important;
}
.navbar-vertical[data-bs-theme="dark"] .navbar-brand-text { color: #fff; font-weight: 600; }
.navbar-vertical[data-bs-theme="dark"] .navbar-brand-subtitle { color: #8a96a3; font-size: .75rem; }
.navbar-vertical[data-bs-theme="dark"] .navbar-brand a { color: #fff; }

/* Primary buttons + links use brand green */
.btn-primary {
    --tblr-btn-bg: #1FA855;
    --tblr-btn-border-color: #1FA855;
    --tblr-btn-hover-bg: #178D43;
    --tblr-btn-hover-border-color: #178D43;
    --tblr-btn-active-bg: #178D43;
    --tblr-btn-active-border-color: #178D43;
}
a { color: #1FA855; }
.text-primary { color: #1FA855 !important; }

/* -------------------------------------------------------------------------
   TIER 1 — sidebar bug fixes
   Tabler beta20 ships NO .nav-header rule, so style it ourselves: a small
   light-on-dark uppercase section label that stays INSIDE the sidebar.
   ------------------------------------------------------------------------- */
.navbar-vertical .navbar-nav .nav-header,
.navbar-vertical[data-bs-theme="dark"] .nav-header {
    display: block;
    width: 100%;
    color: rgba(255, 255, 255, 0.42);
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 1rem 1rem 0.25rem;
    margin: 0;
}
/* Bug 2 — no horizontal scrollbar; clip long labels */
.navbar-vertical { overflow-x: hidden; }
.navbar-vertical .nav-link { overflow: hidden; }
.navbar-vertical .nav-link-icon svg { max-width: 1.25rem; max-height: 1.25rem; }
/* Bug 3 — badge must not eat the label ("Get Started" → "Ne…") */
.navbar-vertical .nav-link-title {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.navbar-vertical .nav-link .badge {
    flex: 0 0 auto;
    font-size: 0.625rem;
    padding: 0.125rem 0.375rem;
}

/* Number inputs: no spinner arrows (convention) */
input[type=number]::-webkit-inner-spin-button,
input[type=number]::-webkit-outer-spin-button { display: none; }
input[type=number] { -moz-appearance: textfield; appearance: textfield; }

/* Tag chip / status badge / quality dot */
.tag-chip { display: inline-flex; align-items: center; padding: .125rem .5rem; font-size: .75rem; border-radius: 999px; margin-right: .25rem; margin-bottom: .25rem; }
.status-badge { font-size: .75rem; font-weight: 500; padding: .25rem .625rem; border-radius: 4px; }
.quality-dot { display:inline-block; width:.6rem; height:.6rem; border-radius:50%; }
.quality-dot.green { background:#2FB344; } .quality-dot.yellow { background:#F76707; } .quality-dot.red { background:#D63939; }

/* Page fade-in */
body.page-loading .page-body { opacity: 0; }
.page-body { transition: opacity .18s ease-in; }

/* -------------------------------------------------------------------------
   TIER 2 — elevation system (apply only to these surfaces)
   ------------------------------------------------------------------------- */
.card { box-shadow: var(--elevation-2); }
.card:hover { box-shadow: var(--elevation-3); }
.dropdown-menu { box-shadow: var(--elevation-4); }
.modal-content { box-shadow: var(--elevation-4); }
.btn { box-shadow: var(--elevation-1); }
.btn:hover { box-shadow: var(--elevation-2); }

/* TIER 2 — micro-interactions (selective, never bouncy) */
.btn { transition: transform var(--transition-base), box-shadow var(--transition-base), background-color var(--transition-base); }
.btn:not(:disabled):hover { transform: translateY(-1px); }
.btn:not(:disabled):active { transform: translateY(0); }
.card { transition: transform var(--transition-smooth), box-shadow var(--transition-smooth); }
.card.card-interactive:hover { transform: translateY(-2px); box-shadow: var(--elevation-3); cursor: pointer; }
.nav-link { transition: background-color var(--transition-base), color var(--transition-base); }
.form-control, .form-select { transition: border-color var(--transition-base), box-shadow var(--transition-base); }
.table-hover tbody tr { transition: background-color var(--transition-fast); }

/* TIER 2 — typography hierarchy */
h1, .h1 { font-weight: 700; letter-spacing: -0.02em; }
h2, .h2 { font-weight: 700; letter-spacing: -0.015em; }
h3, .h3 { font-weight: 600; letter-spacing: -0.01em; }
h4, .h4 { font-weight: 600; }
.page-title { font-size: 1.5rem; font-weight: 700; letter-spacing: -0.015em; }
.page-pretitle { font-size: 0.75rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--tblr-secondary); margin-bottom: 0.25rem; }
.card-title { font-size: 0.9375rem; font-weight: 600; margin-bottom: 0; }
body { line-height: 1.55; }
.text-muted { color: #64748b !important; }
.stat-card-value { font-size: 1.875rem; font-weight: 700; letter-spacing: -0.025em; line-height: 1.1; }

/* TIER 2 — breathing room */
.page-body { padding-top: 2rem; padding-bottom: 2rem; }
@media (min-width: 1200px) { .page-body { padding-top: 2.5rem; padding-bottom: 2.5rem; } }
.page-header { margin-bottom: 1.75rem; }
.card-body { padding: 1.25rem 1.5rem; }
.card-header { padding: 1rem 1.5rem; }
@media (min-width: 768px) {
    .card-body { padding: 1.5rem 1.75rem; }
    .card-header { padding: 1.125rem 1.75rem; }
}

/* TIER 2 — stat cards as visual heroes */
.stat-card { transition: transform var(--transition-smooth), box-shadow var(--transition-smooth); }
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--elevation-3); }
.stat-card .subheader { margin-bottom: 0; }

/* TIER 2 — topbar + wallet chip + notification bell */
.navbar:not(.navbar-vertical) { background: #ffffff; border-bottom: 1px solid rgba(15, 23, 42, 0.06); box-shadow: var(--elevation-1); }
.wallet-chip {
    display: inline-flex; align-items: center; gap: 0.5rem;
    padding: 0.375rem 0.875rem; background: rgba(31, 168, 85, 0.08); color: #1FA855;
    border-radius: 999px; font-size: 0.8125rem; font-weight: 600; text-decoration: none;
    transition: background var(--transition-base);
}
.wallet-chip:hover { background: rgba(31, 168, 85, 0.14); color: #1FA855; }
.wallet-chip svg { width: 16px; height: 16px; }
.btn-notifications {
    width: 36px; height: 36px; display: inline-flex; align-items: center; justify-content: center;
    border-radius: 50%; color: #64748b;
    transition: background var(--transition-base), color var(--transition-base);
}
.btn-notifications:hover { background: #f1f5f9; color: #0f172a; }

/* TIER 2 — form polish */
.form-label { font-weight: 500; font-size: 0.8125rem; color: #334155; margin-bottom: 0.375rem; }
.form-hint { color: #64748b; font-size: 0.75rem; margin-top: 0.375rem; }
.form-control, .form-select { border-color: rgba(15, 23, 42, 0.12); color: #0f172a; font-size: 0.875rem; }
.form-control:hover:not(:focus):not(:disabled),
.form-select:hover:not(:focus):not(:disabled) { border-color: rgba(15, 23, 42, 0.2); }
.form-control:focus, .form-select:focus { border-color: #1FA855; box-shadow: 0 0 0 3px rgba(31, 168, 85, 0.15); }
.form-label .required { color: #d63939; font-weight: 600; margin-left: 0.125rem; }
.form-section { padding-bottom: 1.5rem; margin-bottom: 1.5rem; border-bottom: 1px solid rgba(15, 23, 42, 0.06); }
.form-section:last-child { padding-bottom: 0; margin-bottom: 0; border-bottom: none; }

/* TIER 2 — loading skeletons (charts + search dropdown only) */
.skeleton {
    background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
    background-size: 200% 100%; animation: skeleton-loading 1.4s ease-in-out infinite;
    border-radius: 4px; color: transparent; user-select: none;
}
.skeleton-line { height: 1em; }
.skeleton-line.w-50 { width: 50%; } .skeleton-line.w-75 { width: 75%; }
@keyframes skeleton-loading { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* =========================================================================
   WhatsApp phone preview — the showpiece (template builder + show)
   ========================================================================= */
.phone-preview { position: sticky; top: 1rem; max-width: 320px; margin: 0 auto; }
.phone-frame {
    background: #1a1a1a; border-radius: 42px; padding: 14px; position: relative;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.05) inset,
        0 30px 60px -15px rgba(15, 23, 42, 0.25), 0 12px 20px -8px rgba(15, 23, 42, 0.15);
}
.phone-frame::before {
    content: ''; position: absolute; top: 14px; left: 50%; transform: translateX(-50%);
    width: 90px; height: 22px; background: #1a1a1a; border-radius: 0 0 16px 16px; z-index: 2;
}
.phone-screen {
    background: #e5ddd5; border-radius: 30px; min-height: 540px; overflow: hidden;
    background-image:
        radial-gradient(circle at 20% 10%, rgba(255,255,255,0.4) 0%, transparent 30%),
        radial-gradient(circle at 80% 90%, rgba(255,255,255,0.2) 0%, transparent 30%);
}
.wa-chat-header { background: #075e54; color: #fff; padding: 30px 16px 12px; display: flex; align-items: center; gap: 10px; }
.wa-chat-header .wa-avatar, .wa-avatar {
    width: 36px; height: 36px; border-radius: 50%;
    background: linear-gradient(135deg, #25d366, #1fa855);
    display: inline-flex; align-items: center; justify-content: center;
    color: #fff; font-weight: 600; font-size: 0.875rem; box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.wa-chat-header .wa-name, .wa-name { font-weight: 500; font-size: 0.9rem; }
.wa-chat-header .wa-online, .wa-online { color: rgba(255,255,255,0.7); font-size: 0.7rem; }
.wa-chat-body { padding: 16px 12px; min-height: 440px; }
.wa-bubble {
    background: #fff; border-radius: 8px; padding: 8px 10px 6px; margin-bottom: 4px; max-width: 85%;
    box-shadow: 0 1px 0.5px rgba(0,0,0,0.13); font-size: 0.8125rem; line-height: 1.4; color: #303030;
    position: relative; word-wrap: break-word;
}
.wa-bubble-header { font-weight: 600; margin-bottom: 4px; color: #1fa855; white-space: pre-wrap; word-break: break-word; }
.wa-bubble-body { white-space: pre-wrap; word-break: break-word; }
.wa-bubble-footer { color: #667781; font-size: 0.6875rem; margin-top: 4px; }
.wa-bubble-time { color: #667781; font-size: 0.625rem; text-align: right; margin-top: 2px; }
.wa-bubble-buttons { margin-top: 6px; }
.wa-bubble-button {
    display: block; background: #fff; color: #00a5f4; text-align: center; padding: 8px;
    border-radius: 8px; border: 1px solid #e0e0e0; margin-top: 4px; font-size: 0.8125rem; font-weight: 500; cursor: default;
}
.wa-media-ph {
    background: linear-gradient(135deg, #f0f0f0, #e0e0e0); color: #999; padding: 40px 20px;
    text-align: center; font-size: 0.75rem; border-radius: 6px; font-weight: 600; letter-spacing: 0.05em; margin-bottom: 6px;
}

#save-indicator { position:fixed; right:1rem; bottom:1rem; z-index:1056; }
