/* --------------------------------------------
   AutoKul – Premium Dark Theme
   -------------------------------------------- */

:root {
    /* Background layers */
    --bg: #05070f;
    --surface-1: #0a0e1a;
    --surface-2: #0e1525;
    --surface-3: #141d33;
    --glass: rgba(255, 255, 255, 0.03);
    --glass-hover: rgba(255, 255, 255, 0.055);

    /* Borders */
    --border: rgba(255, 255, 255, 0.07);
    --border-bright: rgba(99, 179, 237, 0.25);
    --border-glow: rgba(56, 189, 248, 0.35);

    /* Text */
    --text-primary: #e8f0fe;
    --text-secondary: #7a8ba4;
    --text-muted: #3d4f68;

    /* Accent palette */
    --cyan: #22d3ee;
    --cyan-dim: #0891b2;
    --cyan-glow: rgba(34, 211, 238, 0.18);
    --indigo: #818cf8;
    --indigo-dim: #4f46e5;
    --indigo-glow: rgba(129, 140, 248, 0.2);
    --accent: #38bdf8;
    --accent-glow: rgba(56, 189, 248, 0.22);
    --accent-hover: #0ea5e9;

    /* State colors */
    --green: #34d399;
    --green-glow: rgba(52, 211, 153, 0.15);
    --red: #f87171;
    --red-glow: rgba(248, 113, 113, 0.15);
    --yellow: #fbbf24;

    /* Chat */
    --incoming-bg: rgba(30, 52, 80, 0.8);
    --outgoing-bg: linear-gradient(135deg, #1d4ed8 0%, #6d28d9 100%);

    /* Misc */
    --shadow-card: 0 8px 40px rgba(0, 0, 0, 0.55);
    --radius: 14px;
    --radius-lg: 18px;
}

/* -- Reset -- */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html,
body {
    height: 100%;
}

body {
    font-family: 'Outfit', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text-primary);
    height: 100vh;
    overflow: hidden;
    /* subtle noise texture */
    background-image:
        radial-gradient(ellipse 80% 60% at 50% -10%, rgba(56, 189, 248, 0.07) 0%, transparent 60%),
        radial-gradient(ellipse 50% 40% at 90% 100%, rgba(129, 140, 248, 0.06) 0%, transparent 55%);
}

/* -- Scrollbars -- */
::-webkit-scrollbar {
    width: 4px;
    height: 4px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(56, 189, 248, 0.2);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(56, 189, 248, 0.38);
}

/* --------------------------------------------
   TOP NAV
   -------------------------------------------- */
.top-nav {
    height: 58px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 24px;
    background: rgba(10, 14, 26, 0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);
    position: relative;
    z-index: 20;
    /* top accent line */
    box-shadow: 0 1px 0 rgba(56, 189, 248, 0.08), 0 4px 24px rgba(0, 0, 0, 0.4);
}

.top-nav::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent 0%, var(--cyan) 40%, var(--indigo) 70%, transparent 100%);
    opacity: 0.5;
}

.logo {
    display: flex;
    align-items: center;
    gap: 11px;
}

.logo-name {
    font-size: 1.15rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    background: linear-gradient(90deg, #fff 30%, var(--cyan) 80%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Status badge */
.status-badge {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 5px 14px 5px 10px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border);
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-secondary);
    transition: all 0.4s;
    letter-spacing: 0.02em;
}

.status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--text-muted);
    transition: all 0.4s;
    flex-shrink: 0;
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 14px;
}

.nav-user {
    font-size: 0.82rem;
    color: var(--text-secondary);
    font-weight: 500;
    background: rgba(255, 255, 255, 0.04);
    padding: 5px 12px;
    border-radius: 20px;
    border: 1px solid var(--border);
}

.btn-logout {
    padding: 6px 15px;
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.82rem;
    font-weight: 500;
    font-family: 'Outfit', sans-serif;
    transition: all 0.2s;
}

.btn-logout:hover {
    background: rgba(248, 113, 113, 0.08);
    color: var(--red);
    border-color: rgba(248, 113, 113, 0.3);
}

/* --------------------------------------------
   LAYOUT
   -------------------------------------------- */
.app-layout {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

.main-cols {
    display: grid;
    grid-template-columns: 1fr 310px;
    flex: 1;
    overflow: hidden;
}

/* Left scrollable control column */
.control-col {
    overflow-y: auto;
    padding: 16px 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: transparent;
    border-right: 1px solid var(--border);
}

/* --------------------------------------------
   CARDS – Glassmorphism
   -------------------------------------------- */
.card {
    background: var(--glass);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 16px 18px;
    transition: border-color 0.3s, box-shadow 0.3s, background 0.3s;
    position: relative;
    overflow: hidden;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    opacity: 0;
    transition: opacity 0.3s;
}

.card:hover {
    border-color: rgba(56, 189, 248, 0.18);
    background: var(--glass-hover);
    box-shadow: 0 0 30px rgba(56, 189, 248, 0.05);
}

.card:hover::before {
    opacity: 1;
}

/* Admin card with accent left border */
.admin-card {
    border-left: 2px solid var(--cyan-dim);
    background: rgba(34, 211, 238, 0.03);
}

.admin-card:hover {
    border-color: rgba(34, 211, 238, 0.35);
}

/* Card title */
.card-title {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-icon {
    width: 14px;
    height: 14px;
    color: var(--accent);
    flex-shrink: 0;
}

/* --------------------------------------------
   QR / WHATSAPP CARD
   -------------------------------------------- */
.qr-wrapper {
    background: #fff;
    border-radius: 10px;
    min-height: 175px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
    overflow: hidden;
    padding: 8px;
    box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.15), 0 8px 32px rgba(0, 0, 0, 0.4);
}

.qr-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    color: #aaa;
    font-size: 0.82rem;
    font-weight: 500;
    font-family: 'Outfit', sans-serif;
}

.qr-wrapper img {
    max-width: 100%;
    border-radius: 4px;
}

.controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

/* --------------------------------------------
   BUTTONS
   -------------------------------------------- */
.btn {
    padding: 10px 16px;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    color: white;
    font-weight: 700;
    font-size: 0.83rem;
    font-family: 'Outfit', sans-serif;
    transition: all 0.22s cubic-bezier(.4, 0, .2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    letter-spacing: 0.01em;
}

/* Start Bot – cyan gradient */
.btn-primary {
    background: linear-gradient(135deg, #0891b2 0%, #38bdf8 100%);
    box-shadow: 0 4px 18px rgba(14, 165, 233, 0.35);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #0e7490 0%, #22d3ee 100%);
    box-shadow: 0 6px 28px rgba(14, 165, 233, 0.55);
    transform: translateY(-2px);
}

/* Stop Bot – subtle red */
.btn-danger {
    background: rgba(248, 113, 113, 0.08);
    color: var(--red);
    border: 1px solid rgba(248, 113, 113, 0.22);
}

.btn-danger:hover {
    background: rgba(248, 113, 113, 0.18);
    box-shadow: 0 4px 16px rgba(248, 113, 113, 0.15);
    transform: translateY(-1px);
}

/* Save – green */
.btn-save {
    width: 100%;
    background: rgba(52, 211, 153, 0.1);
    color: var(--green);
    border: 1px solid rgba(52, 211, 153, 0.22);
    border-radius: 10px;
    cursor: pointer;
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    font-size: 0.83rem;
    padding: 10px 16px;
    transition: all 0.2s;
}

.btn-save:hover {
    background: rgba(52, 211, 153, 0.2);
    box-shadow: 0 4px 16px rgba(52, 211, 153, 0.15);
    transform: translateY(-1px);
}

.btn-full {
    width: 100%;
}

/* Small delete/reset buttons */
.btn-delete-sm {
    padding: 3px 9px;
    background: rgba(248, 113, 113, 0.08);
    border: 1px solid rgba(248, 113, 113, 0.18);
    color: var(--red);
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.73rem;
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    transition: all 0.2s;
}

.btn-delete-sm:hover {
    background: rgba(248, 113, 113, 0.2);
    box-shadow: 0 2px 10px rgba(248, 113, 113, 0.15);
}

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

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    letter-spacing: 0.02em;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.09);
    border-radius: 9px;
    padding: 9px 12px;
    color: var(--text-primary);
    font-size: 0.85rem;
    font-family: 'Outfit', sans-serif;
    transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
    appearance: none;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
    background: rgba(56, 189, 248, 0.04);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: var(--text-muted);
}

.form-group textarea {
    resize: vertical;
    min-height: 160px;
    line-height: 1.6;
}

.divider {
    border: none;
    border-top: 1px solid var(--border);
    margin: 14px 0;
}

/* --------------------------------------------
   ADMIN TABLE
   -------------------------------------------- */
.client-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.78rem;
}

.client-table th {
    text-align: left;
    color: var(--text-muted);
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 0 7px 8px;
}

.client-table td {
    padding: 7px;
    border-top: 1px solid var(--border);
    vertical-align: middle;
    color: var(--text-primary);
}

.client-table tr:hover td {
    background: rgba(255, 255, 255, 0.02);
}

.client-table input[type="date"] {
    padding: 3px 8px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.09);
    color: var(--text-primary);
    border-radius: 6px;
    font-family: 'Outfit', sans-serif;
    font-size: 0.75rem;
    width: 115px;
    color-scheme: dark;
}

.client-list-scroll {
    max-height: 240px;
    overflow-y: auto;
}

/* --------------------------------------------
   LIVE MONITOR PANEL (right column)
   -------------------------------------------- */
.monitor-col {
    display: flex;
    flex-direction: column;
    background: rgba(10, 14, 26, 0.7);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    overflow: hidden;
    border-left: 1px solid var(--border);
}

.monitor-header {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.02);
}

.monitor-title {
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    background: linear-gradient(90deg, var(--cyan), var(--indigo));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.monitor-window {
    flex: 1;
    overflow-y: auto;
    padding: 10px 10px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

/* --------------------------------------------
   LIVE DOT
   -------------------------------------------- */
.live-dot {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.68rem;
    color: var(--green);
    font-weight: 700;
    letter-spacing: 0.06em;
    background: rgba(52, 211, 153, 0.08);
    padding: 3px 8px;
    border-radius: 20px;
    border: 1px solid rgba(52, 211, 153, 0.2);
}

.live-dot::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--green);
    animation: pulse-green 2s infinite;
    flex-shrink: 0;
}

@keyframes pulse-green {

    0%,
    100% {
        opacity: 1;
        box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.5);
    }

    50% {
        box-shadow: 0 0 0 5px rgba(52, 211, 153, 0);
    }
}

/* --------------------------------------------
   CHAT MESSAGES
   -------------------------------------------- */
.msg-row {
    display: flex;
    flex-direction: column;
    gap: 2px;
    max-width: 90%;
    animation: fadeUp 0.18s ease;
}

@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.msg-row.incoming {
    align-self: flex-start;
}

.msg-row.outgoing {
    align-self: flex-end;
    align-items: flex-end;
}

.msg-meta {
    font-size: 0.65rem;
    color: var(--text-muted);
    font-weight: 500;
    padding: 0 4px;
}

.msg-bubble {
    padding: 7px 11px;
    border-radius: 12px;
    font-size: 0.78rem;
    line-height: 1.5;
    word-break: break-word;
}

/* Incoming – glass style */
.msg-row.incoming .msg-bubble {
    background: rgba(30, 52, 80, 0.7);
    border: 1px solid rgba(56, 189, 248, 0.1);
    border-bottom-left-radius: 4px;
    color: var(--text-primary);
    backdrop-filter: blur(8px);
}

/* Outgoing – gradient */
.msg-row.outgoing .msg-bubble {
    background: linear-gradient(135deg, #1d4ed8 0%, #6d28d9 100%);
    border-bottom-right-radius: 4px;
    color: #fff;
    box-shadow: 0 2px 14px rgba(109, 40, 217, 0.35);
}

/* System */
.msg-row.system {
    align-self: center;
    max-width: 95%;
    text-align: center;
}

.msg-row.system .msg-bubble {
    background: rgba(255, 255, 255, 0.025);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 4px 12px;
    font-size: 0.72rem;
    color: var(--text-muted);
    font-style: italic;
}

/* -- Empty state -- */
.chat-empty {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: var(--text-muted);
    pointer-events: none;
    padding: 20px;
    text-align: center;
}

.chat-empty-icon {
    font-size: 1.8rem;
    opacity: 0.35;
    margin-bottom: 4px;
}

.chat-empty span {
    font-size: 0.75rem;
    line-height: 1.5;
}

/* --------------------------------------------
   MODAL
   -------------------------------------------- */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal-box {
    background: var(--surface-2);
    border: 1px solid rgba(248, 113, 113, 0.2);
    border-radius: 20px;
    padding: 32px 28px;
    max-width: 360px;
    width: 90%;
    text-align: center;
    box-shadow: 0 32px 80px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(255, 255, 255, 0.05);
    animation: modalIn 0.22s cubic-bezier(.34, 1.56, .64, 1);
}

@keyframes modalIn {
    from {
        opacity: 0;
        transform: scale(0.94) translateY(10px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.modal-icon {
    font-size: 2.2rem;
    margin-bottom: 12px;
    opacity: 0.85;
}

.modal-title {
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--red);
    margin-bottom: 8px;
}

.modal-body {
    font-size: 0.84rem;
    color: var(--text-secondary);
    margin-bottom: 22px;
    line-height: 1.65;
}

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.btn-cancel {
    padding: 9px 20px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    color: var(--text-primary);
    border-radius: 10px;
    cursor: pointer;
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    font-size: 0.85rem;
    transition: all 0.2s;
}

.btn-cancel:hover {
    background: rgba(255, 255, 255, 0.09);
}

/* --------------------------------------------
   LOGIN PAGE
   -------------------------------------------- */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background:
        radial-gradient(ellipse 70% 55% at 50% 0%, rgba(56, 189, 248, 0.1) 0%, transparent 65%),
        radial-gradient(ellipse 50% 40% at 80% 110%, rgba(129, 140, 248, 0.08) 0%, transparent 60%),
        var(--bg);
    overflow: hidden;
}

.login-card {
    background: rgba(14, 21, 37, 0.8);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(56, 189, 248, 0.15);
    border-radius: 22px;
    padding: 42px 38px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 40px 80px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.04);
    position: relative;
}

.login-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--cyan), var(--indigo), transparent);
    opacity: 0.6;
    border-radius: 22px 22px 0 0;
}

.login-logo-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 30px;
}

.login-logo-name {
    font-size: 1.6rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    background: linear-gradient(90deg, #fff 30%, var(--cyan));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.login-subtitle {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.83rem;
    margin-bottom: 28px;
    letter-spacing: 0.01em;
}

.btn-login-submit {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, #0891b2 0%, #6d28d9 100%);
    color: white;
    border: none;
    border-radius: 11px;
    font-size: 0.92rem;
    font-weight: 700;
    font-family: 'Outfit', sans-serif;
    cursor: pointer;
    margin-top: 8px;
    transition: all 0.25s;
    box-shadow: 0 6px 24px rgba(56, 189, 248, 0.25);
    letter-spacing: 0.02em;
}

.btn-login-submit:hover {
    background: linear-gradient(135deg, #0e7490 0%, #7c3aed 100%);
    transform: translateY(-2px);
    box-shadow: 0 10px 32px rgba(56, 189, 248, 0.38);
}

.error-msg {
    color: var(--red);
    font-size: 0.83rem;
    text-align: center;
    margin-top: 14px;
    display: none;
    background: var(--red-glow);
    padding: 10px 14px;
    border-radius: 9px;
    border: 1px solid rgba(248, 113, 113, 0.22);
}