/* ==============================================================================
   TELEGRAM CLEANER PRO - MODERN GLASSMORPHISM DESIGN SYSTEM
   ============================================================================== */

:root {
    --bg-base: #080d1a;
    --bg-card: rgba(15, 23, 42, 0.75);
    --bg-card-hover: rgba(30, 41, 59, 0.85);
    --bg-input: rgba(11, 19, 38, 0.8);
    --border-subtle: rgba(255, 255, 255, 0.08);
    --border-glow: rgba(56, 189, 248, 0.3);

    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;

    --color-primary: #3b82f6;
    --color-primary-hover: #2563eb;
    --color-purple: #8b5cf6;
    --color-purple-hover: #7c3aed;
    --color-emerald: #10b981;
    --color-emerald-hover: #059669;
    --color-danger: #ef4444;
    --color-danger-hover: #dc2626;
    --color-amber: #f59e0b;
    --color-amber-hover: #d97706;

    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-full: 9999px;

    --font-main: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;

    --shadow-glass: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-smooth: 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

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

body {
    background-color: var(--bg-base);
    color: var(--text-primary);
    font-family: var(--font-main);
    line-height: 1.5;
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
    -webkit-font-smoothing: antialiased;
}

/* Background Animated Ambient Lights */
.bg-glow {
    position: fixed;
    border-radius: 50%;
    filter: blur(120px);
    pointer-events: none;
    z-index: 0;
    opacity: 0.35;
    animation: pulseAmbient 12s infinite alternate ease-in-out;
}

.glow-top-left {
    top: -100px;
    left: -100px;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, #3b82f6, transparent 70%);
}

.glow-bottom-right {
    bottom: -150px;
    right: -150px;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, #7c3aed, transparent 70%);
}

.glow-center {
    top: 40%;
    left: 45%;
    width: 450px;
    height: 450px;
    background: radial-gradient(circle, #059669, transparent 70%);
    opacity: 0.15;
}

@keyframes pulseAmbient {
    0% { transform: scale(1) translate(0, 0); }
    100% { transform: scale(1.15) translate(30px, 20px); }
}

/* APP WRAPPER */
.app-wrapper {
    position: relative;
    z-index: 1;
    max-width: 1720px;
    margin: 0 auto;
    padding: 16px 24px 30px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    gap: 16px;
}

/* HEADER / NAVBAR */
.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 24px;
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-glass);
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 14px;
}

.brand-logo {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    box-shadow: 0 4px 18px rgba(59, 130, 246, 0.45);
    transition: transform var(--transition-smooth);
}

.brand-logo:hover {
    transform: rotate(8deg) scale(1.05);
}

.brand-title {
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    display: flex;
    align-items: center;
    gap: 6px;
}

.brand-title span {
    background: linear-gradient(135deg, #38bdf8, #818cf8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 900;
}

.brand-subtitle {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.account-pill.connected {
    background: rgba(16, 185, 129, 0.12);
    border: 1px solid rgba(16, 185, 129, 0.25);
    color: #34d399;
}

.account-pill.disconnected {
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.25);
    color: #f87171;
}

.account-pill.disconnected .status-dot {
    background-color: #ef4444;
    box-shadow: 0 0 10px #ef4444;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #10b981;
    box-shadow: 0 0 10px #10b981;
    animation: blinkGlow 2s infinite ease-in-out;
}

@keyframes blinkGlow {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.4; transform: scale(0.85); }
}

/* APP MAIN GRID */
.app-main {
    display: grid;
    grid-template-columns: 380px 1fr;
    gap: 20px;
    flex: 1;
}

/* GLASS CARD STYLES */
.glass-card {
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-glass);
    transition: border-color var(--transition-fast);
}

.glass-card:hover {
    border-color: rgba(255, 255, 255, 0.14);
}

/* SIDEBAR PANE */
.sidebar-pane {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.card {
    padding: 18px 20px;
}

.card-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
}

.card-header.space-between {
    justify-content: space-between;
}

.header-title-box {
    display: flex;
    align-items: center;
    gap: 10px;
}

.guide-badge-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 11px;
    border-radius: var(--radius-full);
    background: rgba(56, 189, 248, 0.12);
    border: 1px solid rgba(56, 189, 248, 0.35);
    color: #38bdf8;
    font-size: 0.76rem;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--transition-fast);
    font-family: inherit;
}

.guide-badge-btn:hover {
    background: rgba(56, 189, 248, 0.25);
    border-color: #38bdf8;
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(56, 189, 248, 0.3);
}

.card-icon {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
}

.card-icon.blue { background: rgba(59, 130, 246, 0.15); }
.card-icon.emerald { background: rgba(16, 185, 129, 0.15); }
.card-icon.amber { background: rgba(245, 158, 11, 0.15); }

.card-title {
    font-size: 0.98rem;
    font-weight: 700;
    color: var(--text-primary);
}

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

.form-group.row-align {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.form-group label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.input-wrapper input {
    width: 100%;
    padding: 9px 12px;
    background: var(--bg-input);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.88rem;
    transition: all var(--transition-fast);
}

.input-wrapper input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.field-hint {
    font-size: 0.74rem;
    color: var(--text-muted);
    margin-top: 3px;
    display: block;
}

.divider-text {
    text-align: center;
    font-size: 0.75rem;
    color: var(--text-muted);
    position: relative;
    margin: 12px 0 10px;
}

.divider-text::before,
.divider-text::after {
    content: '';
    position: absolute;
    top: 50%;
    width: 25%;
    height: 1px;
    background: var(--border-subtle);
}

.divider-text::before { left: 0; }
.divider-text::after { right: 0; }

/* NUMBER STEPPER */
.number-stepper {
    display: flex;
    align-items: center;
    background: var(--bg-input);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    overflow: hidden;
    width: 110px;
}

.stepper-btn {
    width: 32px;
    height: 32px;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 1rem;
    cursor: pointer;
    transition: background var(--transition-fast);
}

.stepper-btn:hover {
    background: rgba(255, 255, 255, 0.08);
}

.number-stepper input {
    width: 46px;
    background: transparent;
    border: none;
    text-align: center;
    color: var(--text-primary);
    font-size: 0.9rem;
    font-weight: 600;
}

.number-stepper input::-webkit-outer-spin-button,
.number-stepper input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* SWITCHES LIST */
.switch-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 8px;
}

.switch-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 4px;
    cursor: pointer;
    user-select: none;
}

.switch-item.highlight .switch-label {
    color: #34d399;
    font-weight: 600;
}

.switch-label {
    font-size: 0.82rem;
    color: var(--text-secondary);
}

.switch-item input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.slider {
    position: relative;
    display: inline-block;
    width: 38px;
    height: 20px;
    background-color: #334155;
    border-radius: var(--radius-full);
    transition: var(--transition-fast);
}

.slider::before {
    position: absolute;
    content: "";
    height: 14px;
    width: 14px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    border-radius: 50%;
    transition: var(--transition-fast);
}

.switch-item input:checked + .slider {
    background-color: var(--color-primary);
}

.switch-item.highlight input:checked + .slider {
    background-color: var(--color-emerald);
}

.switch-item input:checked + .slider::before {
    transform: translateX(18px);
}

/* ACTION MODE PILLS */
.action-mode-selector {
    display: flex;
    background: var(--bg-input);
    padding: 4px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
    margin-bottom: 12px;
}

.radio-pill {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 7px 10px;
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.radio-pill input {
    display: none;
}

.radio-pill.active {
    background: #1e293b;
    color: var(--text-primary);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

/* SPEED SLIDER */
.slider-control {
    margin-bottom: 14px;
}

.slider-header {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.slider-value {
    color: #38bdf8;
    font-weight: 700;
    font-family: var(--font-mono);
}

.slider-control input[type="range"] {
    width: 100%;
    accent-color: var(--color-primary);
    cursor: pointer;
}

/* BUTTONS */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    font-family: inherit;
    font-size: 0.88rem;
    font-weight: 600;
    border-radius: var(--radius-md);
    border: none;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
}

.btn:active {
    transform: scale(0.98);
}

.btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    filter: grayscale(0.5);
}

.btn-block { width: 100%; }

.btn-lg {
    padding: 12px 20px;
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.btn-blue {
    background: linear-gradient(135deg, #2563eb, #3b82f6);
    color: white;
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35);
}
.btn-blue:hover:not(:disabled) {
    background: linear-gradient(135deg, #1d4ed8, #2563eb);
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.45);
}

.btn-purple {
    background: linear-gradient(135deg, #7c3aed, #8b5cf6);
    color: white;
    box-shadow: 0 4px 14px rgba(124, 58, 237, 0.35);
}
.btn-purple:hover:not(:disabled) {
    background: linear-gradient(135deg, #6d28d9, #7c3aed);
    box-shadow: 0 6px 20px rgba(124, 58, 237, 0.45);
}

.btn-emerald {
    background: linear-gradient(135deg, #059669, #10b981);
    color: white;
    box-shadow: 0 4px 14px rgba(5, 150, 105, 0.35);
    margin-bottom: 10px;
}
.btn-emerald:hover:not(:disabled) {
    background: linear-gradient(135deg, #047857, #059669);
    box-shadow: 0 6px 20px rgba(5, 150, 105, 0.45);
}

.btn-danger {
    background: linear-gradient(135deg, #dc2626, #ef4444);
    color: white;
    box-shadow: 0 4px 14px rgba(220, 38, 38, 0.35);
}
.btn-danger:hover:not(:disabled) {
    background: linear-gradient(135deg, #b91c1c, #dc2626);
    box-shadow: 0 6px 20px rgba(220, 38, 38, 0.45);
}

.btn-outline-sm {
    padding: 6px 12px;
    font-size: 0.8rem;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
}
.btn-outline-sm:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    border-color: rgba(255, 255, 255, 0.2);
}

.btn-amber-sm {
    padding: 6px 12px;
    font-size: 0.8rem;
    background: rgba(245, 158, 11, 0.15);
    border: 1px solid rgba(245, 158, 11, 0.35);
    color: #fbbf24;
    border-radius: var(--radius-sm);
}
.btn-amber-sm:hover:not(:disabled) {
    background: rgba(245, 158, 11, 0.28);
}

.btn-emerald-sm {
    padding: 6px 12px;
    font-size: 0.8rem;
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid rgba(16, 185, 129, 0.35);
    color: #34d399;
    border-radius: var(--radius-sm);
}
.btn-emerald-sm:hover:not(:disabled) {
    background: rgba(16, 185, 129, 0.28);
}

.btn-text {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 0.78rem;
    cursor: pointer;
}
.btn-text:hover { color: var(--text-primary); }

/* CONTENT PANE (RIGHT) */
.content-pane {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

/* STATS GRID */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
}

.stat-card {
    padding: 14px 18px;
    border-radius: var(--radius-md);
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    gap: 14px;
    transition: transform var(--transition-fast), border-color var(--transition-fast);
}

.stat-card:hover {
    transform: translateY(-2px);
    border-color: rgba(255, 255, 255, 0.18);
}

.stat-icon {
    font-size: 1.6rem;
    line-height: 1;
}

.stat-label {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-muted);
    letter-spacing: 0.04em;
}

.stat-value {
    font-size: 1.6rem;
    font-weight: 800;
    line-height: 1.1;
    font-family: var(--font-mono);
}

.stat-card.blue .stat-value { color: #60a5fa; }
.stat-card.red .stat-value { color: #f87171; }
.stat-card.amber .stat-value { color: #fbbf24; }
.stat-card.emerald .stat-value { color: #34d399; }

/* TABLE TOOLBAR */
.table-toolbar {
    padding: 10px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.toolbar-left,
.toolbar-right {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.search-box {
    position: relative;
    display: flex;
    align-items: center;
}

.search-box svg {
    position: absolute;
    left: 10px;
    color: var(--text-muted);
    pointer-events: none;
}

.search-box input {
    padding: 6px 28px 6px 32px;
    background: var(--bg-input);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.84rem;
    width: 240px;
    transition: width var(--transition-fast), border-color var(--transition-fast);
}

.search-box input:focus {
    outline: none;
    width: 280px;
    border-color: var(--color-primary);
}

.clear-search-btn {
    position: absolute;
    right: 8px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.1rem;
    cursor: pointer;
    display: none;
}

.filter-pills {
    display: flex;
    gap: 6px;
}

.pill {
    padding: 5px 10px;
    font-size: 0.78rem;
    font-weight: 600;
    border-radius: var(--radius-full);
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.pill.active {
    background: rgba(59, 130, 246, 0.2);
    border-color: #3b82f6;
    color: #60a5fa;
}

.bulk-buttons {
    display: flex;
    gap: 6px;
}

/* DATA TABLE */
.table-container {
    flex: 1;
    overflow-y: auto;
    max-height: 480px;
    border-radius: var(--radius-md);
    position: relative;
}

/* Custom Scrollbars */
.table-container::-webkit-scrollbar,
.log-console::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
.table-container::-webkit-scrollbar-thumb,
.log-console::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 4px;
}

.custom-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.85rem;
}

.custom-table thead {
    position: sticky;
    top: 0;
    background: #0f172a;
    z-index: 10;
}

.custom-table th {
    padding: 10px 12px;
    font-weight: 700;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-subtle);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.custom-table td {
    padding: 10px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    color: var(--text-primary);
    transition: background var(--transition-fast);
}

.custom-table tbody tr {
    cursor: pointer;
    transition: background var(--transition-fast);
}

.custom-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.03);
}

.custom-table tbody tr.row-selected {
    background: rgba(59, 130, 246, 0.08);
}

.col-check { width: 44px; text-align: center; }
.col-stt { width: 44px; text-align: center; color: var(--text-muted); font-family: var(--font-mono); }
.col-name { min-width: 220px; font-weight: 600; }
.col-type { width: 90px; text-align: center; }
.col-days { width: 120px; text-align: center; font-family: var(--font-mono); }
.col-actions { width: 100px; text-align: center; }

.action-btn-group {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.row-preview-btn {
    width: 28px;
    height: 28px;
    border-radius: var(--radius-sm);
    background: rgba(14, 165, 233, 0.12);
    border: 1px solid rgba(14, 165, 233, 0.3);
    color: #38bdf8;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.row-preview-btn:hover {
    background: rgba(14, 165, 233, 0.28);
    border-color: #38bdf8;
    transform: scale(1.08);
    box-shadow: 0 0 10px rgba(56, 189, 248, 0.4);
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: var(--radius-sm);
    font-size: 0.74rem;
    font-weight: 600;
}

.badge-user { background: rgba(59, 130, 246, 0.15); color: #60a5fa; }
.badge-group { background: rgba(168, 85, 247, 0.15); color: #c084fc; }
.badge-channel { background: rgba(245, 158, 11, 0.15); color: #fbbf24; }
.badge-bot { background: rgba(14, 165, 233, 0.15); color: #38bdf8; }

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px;
    border-radius: var(--radius-full);
    font-size: 0.74rem;
    font-weight: 700;
}

.status-badge.delete {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.status-badge.keep {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.shield-badge {
    display: inline-block;
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    font-size: 0.72rem;
    font-weight: 600;
}
.shield-badge.yes { background: rgba(16, 185, 129, 0.18); color: #34d399; }
.shield-badge.no { color: var(--text-muted); }

/* Row Action Icon Button */
.row-toggle-btn {
    width: 28px;
    height: 28px;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-fast);
}
.row-toggle-btn:hover {
    background: rgba(59, 130, 246, 0.25);
    color: #60a5fa;
    border-color: #3b82f6;
}

/* Empty State */
.empty-state {
    padding: 50px 20px;
    text-align: center;
}
.empty-icon { font-size: 2.5rem; margin-bottom: 8px; }
.empty-state h3 { font-size: 1.1rem; color: var(--text-primary); }
.empty-state p { font-size: 0.85rem; color: var(--text-muted); }
.empty-state.hidden { display: none; }

/* PROGRESS SECTION */
.progress-section {
    padding: 12px 18px;
}

.progress-info {
    display: flex;
    justify-content: space-between;
    font-size: 0.82rem;
    margin-bottom: 6px;
}
.progress-status { color: var(--text-secondary); }
.progress-percentage { font-weight: 700; color: #38bdf8; font-family: var(--font-mono); }

.progress-track {
    width: 100%;
    height: 8px;
    background: #1e293b;
    border-radius: var(--radius-full);
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #3b82f6, #06b6d4, #10b981);
    border-radius: var(--radius-full);
    transition: width var(--transition-smooth);
}

/* REALTIME LOGS TERMINAL */
.log-container {
    padding: 12px 16px;
}

.log-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.log-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text-secondary);
}

.terminal-dots {
    display: flex;
    gap: 5px;
}

.dot { width: 9px; height: 9px; border-radius: 50%; }
.dot.red { background: #ef4444; }
.dot.yellow { background: #f59e0b; }
.dot.green { background: #10b981; }

.log-console {
    background: #090e1a;
    border-radius: var(--radius-md);
    padding: 10px 12px;
    height: 110px;
    overflow-y: auto;
    font-family: var(--font-mono);
    font-size: 0.78rem;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.log-line { line-height: 1.4; }
.log-time { color: var(--text-muted); margin-right: 6px; }
.log-line.info { color: #93c5fd; }
.log-line.success { color: #86efac; }
.log-line.warning { color: #fde047; }
.log-line.danger { color: #fca5a5; }

/* MODALS */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 1;
    transition: opacity var(--transition-fast);
}

.modal-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.modal-card {
    background: #0f172a;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
    width: 90%;
    max-width: 440px;
    padding: 28px 24px 22px;
    position: relative;
    transform: translateY(0);
    transition: transform var(--transition-smooth);
}

.modal-overlay.hidden .modal-card {
    transform: translateY(20px) scale(0.96);
}

.modal-close-btn {
    position: absolute;
    top: 14px;
    right: 16px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    line-height: 1;
}
.modal-close-btn:hover { color: var(--text-primary); }

.modal-header {
    text-align: center;
    margin-bottom: 18px;
}

.modal-icon {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    margin: 0 auto 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
}
.modal-icon.purple { background: rgba(139, 92, 246, 0.2); }
.modal-icon.danger { background: rgba(239, 68, 68, 0.2); }

.modal-title { font-size: 1.25rem; font-weight: 800; color: var(--text-primary); }
.modal-subtitle { font-size: 0.82rem; color: var(--text-muted); margin-top: 2px; }

/* QR BOX */
.qr-preview-box {
    background: white;
    border-radius: var(--radius-md);
    padding: 12px;
    width: 220px;
    height: 220px;
    margin: 0 auto 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.qr-preview-box img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.qr-scanner-line {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, transparent, #38bdf8, transparent);
    box-shadow: 0 0 12px #38bdf8;
    animation: scanAnimation 2.2s infinite ease-in-out;
}

@keyframes scanAnimation {
    0% { top: 0%; opacity: 0; }
    10% { opacity: 1; }
    90% { opacity: 1; }
    100% { top: 98%; opacity: 0; }
}

.qr-steps {
    display: flex;
    flex-direction: column;
    gap: 7px;
    background: rgba(255, 255, 255, 0.03);
    padding: 12px 14px;
    border-radius: var(--radius-md);
    margin-bottom: 14px;
    font-size: 0.78rem;
}

.step-item {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
}

.step-num {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #334155;
    color: white;
    font-size: 0.7rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}

.step-item.highlight-step {
    color: #38bdf8;
    font-weight: 600;
}
.step-item.highlight-step .step-num { background: #0284c7; }

.modal-status {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 0.8rem;
    font-weight: 600;
    color: #fbbf24;
    margin-bottom: 14px;
}

.spinner-ring {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(251, 191, 36, 0.3);
    border-top-color: #fbbf24;
    border-radius: 50%;
    animation: spin 0.9s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* CONFIRM MODAL */
.confirm-summary-box {
    text-align: center;
    background: rgba(239, 68, 68, 0.08);
    border: 1px dashed rgba(239, 68, 68, 0.3);
    border-radius: var(--radius-md);
    padding: 16px;
    margin-bottom: 20px;
}

.summary-count {
    font-size: 2.2rem;
    font-weight: 900;
    color: #f87171;
    font-family: var(--font-mono);
}

.summary-text {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.modal-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

/* TOAST NOTIFICATIONS */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 2000;
    pointer-events: none;
}

.toast {
    background: #0f172a;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 12px 18px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    gap: 10px;
    color: white;
    font-size: 0.85rem;
    font-weight: 500;
    min-width: 280px;
    pointer-events: auto;
    animation: toastSlideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes toastSlideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* GUIDE MODAL STYLES */
.modal-large {
    max-width: 640px;
    max-height: 88vh;
    overflow-y: auto;
}

.modal-large::-webkit-scrollbar {
    width: 6px;
}
.modal-large::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

.guide-nav-tabs {
    display: flex;
    gap: 8px;
    background: var(--bg-input);
    padding: 5px;
    border-radius: var(--radius-md);
    margin-bottom: 16px;
}

.guide-tab-btn {
    flex: 1;
    padding: 9px 12px;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 0.84rem;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.guide-tab-btn.active {
    background: #1e293b;
    color: var(--text-primary);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.guide-content {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 16px;
}
.guide-content.hidden { display: none; }

.guide-step-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 12px 14px;
    display: flex;
    gap: 12px;
    transition: border-color var(--transition-fast);
}

.guide-step-card.highlight {
    background: rgba(59, 130, 246, 0.06);
    border-color: rgba(59, 130, 246, 0.3);
}

.step-badge {
    background: #1e293b;
    color: #38bdf8;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    font-size: 0.74rem;
    font-weight: 700;
    height: fit-content;
    white-space: nowrap;
}

.step-body {
    flex: 1;
}

.step-body h4 {
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.step-body p {
    font-size: 0.82rem;
    color: var(--text-secondary);
    line-height: 1.45;
}

.guide-link {
    color: #38bdf8;
    text-decoration: underline;
    font-weight: 600;
}

.btn-link-action {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
    text-decoration: none;
    color: #38bdf8;
    border-color: rgba(56, 189, 248, 0.3);
}
.btn-link-action:hover {
    background: rgba(56, 189, 248, 0.15);
}

.form-cheat-sheet {
    background: #090e1a;
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    margin: 8px 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.cheat-item {
    display: flex;
    gap: 8px;
}

.cheat-label {
    color: var(--text-muted);
    min-width: 90px;
}

.cheat-val {
    color: #86efac;
}

.cheat-val small {
    color: var(--text-muted);
    font-family: var(--font-main);
    font-size: 0.72rem;
}

.tip-text {
    font-size: 0.78rem;
    color: #fde047;
    margin-top: 6px;
    line-height: 1.4;
}

.ordered-steps {
    padding-left: 18px;
    font-size: 0.82rem;
    color: var(--text-secondary);
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 6px;
}
/* CHAT PREVIEW MODAL STYLES */
.modal-chat-preview {
    max-width: 680px;
    width: 95%;
    padding: 0;
    overflow: hidden;
    background: #0b1120;
    border: 1px solid rgba(255, 255, 255, 0.18);
    box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.08);
    display: flex;
    flex-direction: column;
    max-height: 88vh;
    border-radius: var(--radius-lg);
}

.chat-header-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 18px;
    background: #111a2e;
    border-bottom: 1px solid var(--border-subtle);
    position: relative;
    flex-shrink: 0;
}

.chat-user-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.95rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    flex-shrink: 0;
}

.chat-user-info {
    flex: 1;
    min-width: 0;
}

.chat-user-name {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-user-status {
    font-size: 0.74rem;
    color: var(--text-muted);
}

.chat-header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.btn-open-tg-app {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 11px;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    background: rgba(56, 189, 248, 0.12);
    border: 1px solid rgba(56, 189, 248, 0.3);
    color: #38bdf8;
    text-decoration: none;
    transition: all var(--transition-fast);
}

.btn-open-tg-app:hover {
    background: rgba(56, 189, 248, 0.25);
    border-color: #38bdf8;
}

/* Nút X to rõ ràng ở góc phải trên */
.chat-header-close-btn {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.18);
    color: #f1f5f9;
    font-size: 1.1rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    line-height: 1;
}

.chat-header-close-btn:hover {
    background: rgba(239, 68, 68, 0.3);
    border-color: #ef4444;
    color: #fca5a5;
    transform: scale(1.08);
}

.chat-messages-scroll {
    padding: 16px 20px;
    height: 480px;
    max-height: 62vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: radial-gradient(circle at 50% 50%, rgba(15, 23, 42, 0.6) 0%, rgba(11, 15, 25, 0.98) 100%);
    flex: 1;
}

.chat-messages-scroll::-webkit-scrollbar {
    width: 6px;
}
.chat-messages-scroll::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

/* Top bar: Banner tải thêm lịch sử */
.chat-history-top-bar {
    align-self: center;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-load-more-history {
    background: rgba(59, 130, 246, 0.15);
    border: 1px solid rgba(59, 130, 246, 0.35);
    color: #93c5fd;
    padding: 4px 14px;
    border-radius: var(--radius-full);
    font-size: 0.74rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-load-more-history:hover {
    background: rgba(59, 130, 246, 0.3);
    color: #ffffff;
}

.chat-date-pill {
    align-self: center;
    background: rgba(255, 255, 255, 0.08);
    padding: 4px 14px;
    border-radius: var(--radius-full);
    font-size: 0.72rem;
    color: var(--text-muted);
    margin: 4px 0;
}

.chat-msg-bubble {
    max-width: 82%;
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 0.88rem;
    position: relative;
    line-height: 1.45;
    word-break: break-word;
    animation: fadeInBubble 0.2s ease;
}

@keyframes fadeInBubble {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

.chat-msg-bubble.received {
    align-self: flex-start;
    background: #1e293b;
    color: #f1f5f9;
    border-bottom-left-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.chat-msg-bubble.sent {
    align-self: flex-end;
    background: linear-gradient(135deg, #1d4ed8, #2563eb);
    color: white;
    border-bottom-right-radius: 4px;
    box-shadow: 0 2px 10px rgba(37, 99, 235, 0.25);
}

.chat-msg-time {
    font-size: 0.68rem;
    opacity: 0.7;
    margin-left: 10px;
    float: right;
    margin-top: 6px;
    font-family: var(--font-mono);
}

.msg-sender-name {
    font-size: 0.74rem;
    font-weight: 700;
    color: #38bdf8;
    margin-bottom: 4px;
}

/* ==============================================================================
   MEDIA STYLES: ẢNH, FILE, VIDEO, AUDIO
============================================================================== */
.chat-photo-card {
    margin: 4px 0;
    border-radius: 10px;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.chat-photo-preview {
    max-width: 320px;
    max-height: 280px;
    width: auto;
    height: auto;
    display: block;
    cursor: pointer;
    border-radius: 8px 8px 0 0;
    transition: transform 0.2s ease;
}

.chat-photo-preview:hover {
    filter: brightness(1.05);
}

.chat-photo-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 10px;
    background: rgba(15, 23, 42, 0.85);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.btn-photo-action {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.73rem;
    color: #38bdf8;
    background: rgba(56, 189, 248, 0.12);
    border: 1px solid rgba(56, 189, 248, 0.25);
    padding: 3px 8px;
    border-radius: 4px;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-photo-action:hover {
    background: rgba(56, 189, 248, 0.25);
    color: #ffffff;
}

/* Thẻ file / tài liệu (PDF, Word, Zip...) */
.chat-doc-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    margin: 4px 0;
    background: rgba(15, 23, 42, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 10px;
    max-width: 360px;
}

.chat-doc-icon {
    width: 38px;
    height: 38px;
    border-radius: 8px;
    background: linear-gradient(135deg, #ef4444, #f97316);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.chat-doc-details {
    flex: 1;
    min-width: 0;
}

.chat-doc-name {
    font-size: 0.82rem;
    font-weight: 600;
    color: #f1f5f9;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-doc-meta {
    font-size: 0.7rem;
    color: #94a3b8;
    margin-top: 2px;
}

.chat-doc-actions {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex-shrink: 0;
}

.btn-doc-download,
.btn-doc-view {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    text-decoration: none;
    transition: all 0.2s ease;
}

.btn-doc-download {
    background: #2563eb;
    color: white;
    border: none;
}
.btn-doc-download:hover {
    background: #1d4ed8;
}

.btn-doc-view {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #cbd5e1;
}
.btn-doc-view:hover {
    background: rgba(255, 255, 255, 0.16);
    color: white;
}

/* Video & Audio */
.chat-video-player {
    max-width: 320px;
    max-height: 240px;
    border-radius: 8px;
    display: block;
    margin: 4px 0;
}

.chat-audio-player {
    width: 260px;
    margin: 4px 0;
    height: 36px;
}

.chat-date-pill.service-msg {
    color: #fca5a5;
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.25);
    max-width: 90%;
    text-align: center;
}

.preview-loading,
.preview-empty,
.preview-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    min-height: 260px;
    gap: 12px;
    color: var(--text-muted);
    font-size: 0.88rem;
    text-align: center;
    padding: 20px;
}

.preview-error {
    color: #f87171;
}

/* ==============================================================================
   LIGHTBOX MODAL (XEM ẢNH FULL SIZE)
============================================================================== */
.lightbox-card {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    background: rgba(11, 15, 25, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-lg);
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.9);
    padding: 16px;
    overflow: hidden;
}

.lightbox-close-btn {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.25);
    color: white;
    font-size: 1.2rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    transition: all 0.2s ease;
}

.lightbox-close-btn:hover {
    background: #ef4444;
    color: white;
    transform: scale(1.1);
}

.lightbox-img-wrapper {
    max-width: 82vw;
    max-height: 72vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.lightbox-img-wrapper img {
    max-width: 100%;
    max-height: 72vh;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.lightbox-toolbar {
    margin-top: 14px;
    display: flex;
    gap: 12px;
    align-items: center;
}

.chat-footer-actions {
    padding: 12px 18px;
    background: #111a2e;
    border-top: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.decision-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 600;
}

.chat-decision-buttons {
    display: flex;
    gap: 8px;
}

.btn-danger-sm {
    padding: 6px 12px;
    font-size: 0.8rem;
    background: rgba(239, 68, 68, 0.18);
    border: 1px solid rgba(239, 68, 68, 0.35);
    color: #f87171;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
}
.btn-danger-sm:hover {
    background: rgba(239, 68, 68, 0.3);
}

/* RESPONSIVE DESIGN */
@media (max-width: 1200px) {
    .app-main {
        grid-template-columns: 340px 1fr;
    }
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 900px) {
    .app-main {
        grid-template-columns: 1fr;
    }
    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }
}

/* Password Toggle Eye Button */
.btn-toggle-pwd {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    font-size: 1.15rem;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.2s, transform 0.2s;
    user-select: none;
    padding: 4px;
}
.btn-toggle-pwd:hover {
    opacity: 1;
    transform: translateY(-50%) scale(1.1);
}
.btn-toggle-pwd.hidden {
    display: none !important;
}
