:root {
    --bg-dark: #090d16;
    --bg-card: rgba(18, 25, 41, 0.7);
    --bg-card-border: rgba(255, 255, 255, 0.08);
    --bg-card-hover: rgba(26, 36, 59, 0.8);
    --primary: #4FACFE;
    --primary-gradient: linear-gradient(135deg, #00F2FE 0%, #4FACFE 100%);
    --emerald: #10B981;
    --emerald-gradient: linear-gradient(135deg, #34D399 0%, #10B981 100%);
    --purple: #8B5CF6;
    --purple-gradient: linear-gradient(135deg, #A78BFA 0%, #8B5CF6 100%);
    --rose: #F43F5E;
    --amber: #F59E0B;
    --text-main: #F1F5F9;
    --text-muted: #94A3B8;
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --shadow-glow: 0 0 25px rgba(79, 172, 254, 0.15);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

body {
    background-color: var(--bg-dark);
    background-image: 
        radial-gradient(at 0% 0%, rgba(79, 172, 254, 0.08) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(139, 92, 246, 0.08) 0px, transparent 50%);
    background-attachment: fixed;
    color: var(--text-main);
    min-height: 100vh;
    padding-bottom: 50px;
}

/* Glassmorphism utility */
.glass-card {
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--bg-card-border);
    border-radius: var(--radius-md);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

/* Header */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 40px;
    background: rgba(9, 13, 22, 0.85);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--bg-card-border);
    position: sticky;
    top: 0;
    z-index: 100;
}

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

.logo-icon {
    width: 44px;
    height: 44px;
    background: var(--primary-gradient);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: #fff;
    box-shadow: 0 0 15px rgba(79, 172, 254, 0.4);
}

.logo-text h2 {
    font-family: 'Outfit', sans-serif;
    font-size: 20px;
    font-weight: 700;
    letter-spacing: 0.5px;
    background: linear-gradient(135deg, #ffffff 0%, #cbd5e1 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.logo-text span {
    font-size: 12px;
    color: var(--text-muted);
}

.nav-actions {
    display: flex;
    gap: 12px;
}

/* Container */
.container {
    max-width: 1240px;
    margin: 30px auto;
    padding: 0 20px;
}

/* Stats Row */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 25px;
}

.stat-card {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    border: 1px solid var(--bg-card-border);
    border-radius: var(--radius-md);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-glow);
}

.stat-icon {
    width: 50px;
    height: 50px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
}

.icon-blue { background: rgba(79, 172, 254, 0.15); color: #4FACFE; }
.icon-emerald { background: rgba(16, 185, 129, 0.15); color: #10B981; }
.icon-purple { background: rgba(139, 92, 246, 0.15); color: #A78BFA; }
.icon-amber { background: rgba(245, 158, 11, 0.15); color: #F59E0B; }

.stat-info .stat-label {
    font-size: 13px;
    color: var(--text-muted);
}

.stat-info h3 {
    font-size: 26px;
    font-weight: 700;
    margin-top: 2px;
}

.engine-online {
    color: #10B981;
    font-size: 18px !important;
}

.engine-online i {
    font-size: 10px;
    vertical-align: middle;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { opacity: 0.4; }
    50% { opacity: 1; }
    100% { opacity: 0.4; }
}

/* Info Banner */
.info-banner {
    background: rgba(79, 172, 254, 0.06);
    border: 1px solid rgba(79, 172, 254, 0.2);
    border-radius: var(--radius-md);
    padding: 16px 20px;
    display: flex;
    gap: 16px;
    align-items: flex-start;
    margin-bottom: 25px;
}

.info-icon {
    font-size: 22px;
    color: var(--primary);
    margin-top: 2px;
}

.info-text h4 {
    font-size: 15px;
    margin-bottom: 4px;
    color: #ffffff;
}

.info-text p {
    font-size: 13px;
    color: #cbd5e1;
    line-height: 1.5;
}

/* Controls Bar */
.controls-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    margin-bottom: 25px;
    flex-wrap: wrap;
}

.search-box {
    position: relative;
    flex: 1;
    min-width: 280px;
}

.search-box i {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.search-box input {
    width: 100%;
    background: var(--bg-card);
    border: 1px solid var(--bg-card-border);
    padding: 12px 16px 12px 42px;
    border-radius: var(--radius-sm);
    color: var(--text-main);
    font-size: 14px;
    outline: none;
    transition: border 0.2s;
}

.search-box input:focus {
    border-color: var(--primary);
}

.filter-tabs {
    display: flex;
    gap: 8px;
    background: var(--bg-card);
    padding: 4px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--bg-card-border);
}

.tab-btn {
    background: transparent;
    border: none;
    padding: 8px 16px;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 500;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.tab-btn.active {
    background: var(--primary);
    color: #fff;
}

/* Bots Grid */
.bots-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
    gap: 24px;
}

.bot-card {
    background: var(--bg-card);
    border: 1px solid var(--bg-card-border);
    border-radius: var(--radius-md);
    padding: 22px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.bot-card:hover {
    border-color: rgba(79, 172, 254, 0.3);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
}

.bot-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.bot-info-main {
    display: flex;
    gap: 12px;
    align-items: center;
}

.bot-avatar {
    width: 46px;
    height: 46px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--bg-card-border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: var(--primary);
}

.bot-title-box h3 {
    font-size: 16px;
    font-weight: 600;
    color: #fff;
}

.bot-title-box a {
    font-size: 13px;
    color: var(--primary);
    text-decoration: none;
}

.bot-title-box a:hover {
    text-decoration: underline;
}

.status-badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

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

.badge-inactive {
    background: rgba(244, 63, 94, 0.15);
    color: #F87171;
    border: 1px solid rgba(244, 63, 94, 0.3);
}

/* Telegram Preview Bubble inside Card */
.tg-preview-box {
    background: #18222d;
    border-radius: 12px;
    padding: 12px 14px;
    border-left: 3px solid var(--primary);
}

.tg-msg-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 6px;
}

.tg-sender-name {
    font-size: 12px;
    font-weight: 600;
    color: #4FACFE;
}

.tg-msg-body {
    font-size: 13px;
    color: #E2E8F0;
    line-height: 1.4;
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 90px;
    overflow-y: auto;
}

.tg-btn-preview {
    margin-top: 10px;
    background: rgba(79, 172, 254, 0.12);
    border: 1px solid rgba(79, 172, 254, 0.3);
    color: #38BDF8;
    text-align: center;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.bot-card-stats {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: var(--text-muted);
    border-top: 1px solid var(--bg-card-border);
    padding-top: 12px;
}

.bot-card-actions {
    display: flex;
    gap: 8px;
}

/* Buttons */
.btn {
    padding: 10px 18px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.btn-primary {
    background: var(--primary-gradient);
    color: #fff;
    box-shadow: 0 4px 15px rgba(79, 172, 254, 0.3);
}

.btn-emerald {
    background: var(--emerald-gradient);
    color: #fff;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-main);
    border: 1px solid var(--bg-card-border);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.14);
}

.btn-danger {
    background: rgba(244, 63, 94, 0.15);
    color: var(--rose);
    border: 1px solid rgba(244, 63, 94, 0.3);
}

.btn-danger:hover {
    background: rgba(244, 63, 94, 0.3);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.btn-icon {
    padding: 8px 10px;
}

/* Modal Overlay */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(5, 8, 15, 0.75);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    width: 100%;
    max-width: 580px;
    padding: 28px;
    border-radius: var(--radius-lg);
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(0.95);
    transition: transform 0.3s ease;
}

.modal-overlay.active .modal-content {
    transform: scale(1);
}

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

.modal-header h3 {
    font-size: 18px;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 10px;
}

.close-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 24px;
    cursor: pointer;
}

.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.required { color: var(--rose); }

.form-group input, .form-group textarea {
    width: 100%;
    background: rgba(10, 15, 26, 0.7);
    border: 1px solid var(--bg-card-border);
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    color: var(--text-main);
    font-size: 13.5px;
    outline: none;
    transition: border 0.2s;
}

.form-group input:focus, .form-group textarea:focus {
    border-color: var(--primary);
}

.token-input-group {
    display: flex;
    gap: 8px;
}

.token-status-box {
    margin-top: 6px;
    font-size: 12px;
}

.token-status-valid { color: var(--emerald); }
.token-status-invalid { color: var(--rose); }

.placeholders-tags {
    margin-top: 6px;
    font-size: 12px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.placeholders-tags code {
    background: rgba(255, 255, 255, 0.08);
    padding: 2px 6px;
    border-radius: 4px;
    color: #38BDF8;
    cursor: pointer;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.placeholders-tags code:hover {
    background: rgba(56, 189, 248, 0.2);
}

.form-row {
    display: flex;
    gap: 14px;
}

.col-6 { flex: 1; }

.telegram-preview-container {
    background: #0f172a;
    border: 1px dashed rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    padding: 14px;
    margin-bottom: 20px;
}

.preview-title {
    font-size: 12px;
    color: #38BDF8;
    font-weight: 600;
    display: block;
    margin-bottom: 10px;
}

.tg-msg-bubble {
    background: #1e293b;
    border-radius: 10px;
    padding: 12px;
    border-left: 3px solid #38BDF8;
}

.tg-bot-author {
    font-size: 12px;
    font-weight: 600;
    color: #38BDF8;
    margin-bottom: 6px;
}

.tg-preview-photo {
    width: 100%;
    max-height: 190px;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 8px;
    display: block;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

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

.tg-msg-content {
    font-size: 13px;
    color: #f1f5f9;
    line-height: 1.4;
}

.tg-inline-btn {
    margin-top: 10px;
    background: rgba(56, 189, 248, 0.15);
    color: #38BDF8;
    text-align: center;
    padding: 8px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    border: 1px solid rgba(56, 189, 248, 0.3);
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 10px;
}

/* Loading & Empty state */
.loading-state, .empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.loading-state i, .empty-state i {
    font-size: 36px;
    margin-bottom: 14px;
    color: var(--primary);
}

/* Toast notifications */
#toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    background: #1e293b;
    border: 1px solid var(--bg-card-border);
    padding: 14px 20px;
    border-radius: var(--radius-sm);
    color: #fff;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
    animation: slideIn 0.3s ease;
}

.toast-success i { color: var(--emerald); }
.toast-error i { color: var(--rose); }

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

.bot-profile-header {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(255, 255, 255, 0.04);
    padding: 12px;
    border-radius: 10px;
    margin-bottom: 16px;
}

.bot-avatar-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: var(--primary-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: #fff;
}
