/* ─────────────────────────────────────────────────────────────────── */
/* Multibot — Custom Styles                                            */
/* ─────────────────────────────────────────────────────────────────── */

/* ── Root Variables ──────────────────────────────────────────────── */
:root {
    --primary: #4F6CF2;
    --primary-dark: #3A56D4;
    --primary-light: #EEF1FD;
    --success: #22C55E;
    --danger: #EF4444;
    --warning: #F59E0B;
    --info: #06B6D4;
    --gray-50: #F9FAFB;
    --gray-100: #F3F4F6;
    --gray-200: #E5E7EB;
    --gray-400: #9CA3AF;
    --gray-600: #6B7280;
    --gray-800: #1F2937;

    /* legacy aliases used elsewhere */
    --primary-color: var(--primary);
    --primary-hover: var(--primary-dark);
    --success-color: var(--success);
    --danger-color: var(--danger);
    --warning-color: var(--warning);
    --info-color: var(--info);
}

/* ── Base ────────────────────────────────────────────────────────── */
body {
    background-color: var(--gray-100);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: var(--gray-800);
    font-size: 0.925rem;
}

/* ── Navbar ──────────────────────────────────────────────────────── */
.navbar {
    border-bottom: 1px solid var(--gray-200);
    background: #fff !important;
    padding-top: 0.6rem;
    padding-bottom: 0.6rem;
}

.navbar-brand {
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--primary) !important;
    letter-spacing: -0.01em;
}

.navbar-domain-pill {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--gray-100);
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    padding: 0.35rem 0.75rem;
    font-size: 0.8rem;
    color: var(--gray-600);
    min-width: 0;
}

.navbar-domain-pill .domain-name {
    font-weight: 600;
    color: var(--gray-800);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
}

.navbar-plan-pill {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--primary-light);
    border: 1px solid #c7d0f8;
    border-radius: 8px;
    padding: 0.35rem 0.75rem;
    font-size: 0.8rem;
}

.navbar-plan-pill .plan-label {
    color: var(--gray-600);
    font-size: 0.72rem;
    line-height: 1;
}

.navbar-plan-pill .plan-name {
    font-weight: 700;
    color: var(--primary);
    line-height: 1.2;
}

.navbar-plan-pill .plan-expiry {
    color: var(--gray-400);
    font-size: 0.7rem;
    line-height: 1;
}

/* ── Tabs ────────────────────────────────────────────────────────── */
.nav-tabs {
    border-bottom: 2px solid var(--gray-200);
}

.nav-tabs .nav-link {
    color: var(--gray-600);
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    padding: 0.6rem 1.25rem;
    font-weight: 500;
    font-size: 0.875rem;
    transition: color 0.15s, border-color 0.15s;
    border-radius: 0;
}

.nav-tabs .nav-link:hover {
    color: var(--primary);
    border-bottom-color: var(--gray-200);
    background: transparent;
}

.nav-tabs .nav-link.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    background: transparent;
    font-weight: 600;
}

/* ── Buttons ─────────────────────────────────────────────────────── */
.btn-primary {
    background-color: var(--primary);
    border-color: var(--primary);
    font-weight: 500;
}

.btn-primary:hover,
.btn-primary:focus {
    background-color: var(--primary-dark);
    border-color: var(--primary-dark);
}

.btn-outline-primary {
    color: var(--primary);
    border-color: var(--primary);
}

.btn-outline-primary:hover {
    background-color: var(--primary);
    border-color: var(--primary);
}

.btn,
.card,
.modal-content {
    transition: box-shadow 0.15s, transform 0.15s;
}

/* ── Cards ───────────────────────────────────────────────────────── */
.card {
    border-radius: 10px;
}

.bot-card {
    transition: transform 0.15s, box-shadow 0.15s;
    border: 1px solid var(--gray-200) !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.bot-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(79, 108, 242, 0.12);
    border-color: #c7d0f8 !important;
}

.bot-type-card {
    cursor: pointer;
    transition: all 0.15s ease;
    border: 2px solid var(--gray-200) !important;
}

.bot-type-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(79, 108, 242, 0.15);
    border-color: var(--primary) !important;
}

.bot-type-card:active {
    transform: scale(0.98);
}

/* ── Bot Type Badges ─────────────────────────────────────────────── */
.bot-type-badge {
    font-size: 0.72rem;
    font-weight: 600;
    padding: 0.2rem 0.55rem;
    border-radius: 20px;
    letter-spacing: 0.01em;
}

.bot-type-simplebot {
    background-color: #DCFCE7;
    color: #166534;
}

.bot-type-dialogflow {
    background-color: #DBEAFE;
    color: #1E40AF;
}

.bot-type-openai,
.bot-type-ai-agent {
    background-color: #F3E8FF;
    color: #6B21A8;
}

/* ── Bot Filter Chips ────────────────────────────────────────────── */
.bot-filter-chips {
    display: flex;
    gap: 0.4rem;
    align-items: center;
}

.filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.3rem 0.75rem;
    border-radius: 20px;
    border: 1px solid var(--gray-200);
    background: #fff;
    color: var(--gray-600);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}

.filter-chip:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.filter-chip.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

.filter-chip .chip-count {
    background: rgba(255, 255, 255, 0.25);
    border-radius: 10px;
    padding: 0 5px;
    font-size: 0.7rem;
    min-width: 18px;
    text-align: center;
}

.filter-chip:not(.active) .chip-count {
    background: var(--gray-100);
    color: var(--gray-600);
}

/* ── Stats Cards ─────────────────────────────────────────────────── */
.stat-icon-wrap {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-icon-wrap.blue {
    background: #DBEAFE;
    color: #1D4ED8;
}

.stat-icon-wrap.green {
    background: #DCFCE7;
    color: #16A34A;
}

.stat-icon-wrap.purple {
    background: #F3E8FF;
    color: #7C3AED;
}

.stat-icon-wrap.amber {
    background: #FEF3C7;
    color: #D97706;
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1;
    color: var(--gray-800);
}

.stat-label {
    font-size: 0.8rem;
    color: var(--gray-600);
    margin-bottom: 0.25rem;
}

/* ── Modals ──────────────────────────────────────────────────────── */
.modal-header {
    background-color: var(--primary);
    color: white;
    border-radius: 10px 10px 0 0;
    padding: 1rem 1.25rem;
}

.modal-header .btn-help {
    opacity: 0.5;
    color: var(--bs-btn-close-color);
    background: transparent var(--bs-btn-close-bg) center/1em auto no-repeat;
    border: 0;
}

.modal-header .btn-help:hover {
    opacity: 0.75;
}

.modal-header .btn-close {
    filter: invert(1);
}

.modal-body {
    max-height: 72vh;
    overflow-y: auto;
    overflow-x: visible;
    position: relative;
}

/* Simplebot modal uses p-0 + inner scroll per tab */
.modal-body.p-0 {
    max-height: none;
    overflow: visible;
}

.sb-tab-pane {
    max-height: 65vh;
    overflow-y: auto;
    overflow-x: visible;
    padding: 1.5rem;
}

.modal-body::-webkit-scrollbar,
.sb-tab-pane::-webkit-scrollbar {
    width: 5px;
}

.modal-body::-webkit-scrollbar-track,
.sb-tab-pane::-webkit-scrollbar-track {
    background: var(--gray-100);
    border-radius: 3px;
}

.modal-body::-webkit-scrollbar-thumb,
.sb-tab-pane::-webkit-scrollbar-thumb {
    background: var(--gray-200);
    border-radius: 3px;
}

.modal-body::-webkit-scrollbar-thumb:hover,
.sb-tab-pane::-webkit-scrollbar-thumb:hover {
    background: var(--gray-400);
}

/* Modal tab nav strip */
.modal-tabs-strip {
    background: var(--gray-50);
    border-bottom: 1px solid var(--gray-200);
    padding: 0 1.5rem;
}

/* ── Forms ───────────────────────────────────────────────────────── */
.form-section {
    margin-bottom: 1.25rem;
    position: relative;
    overflow: visible;
}

.form-section:first-child {
    padding-top: 0.5rem;
}

.section-title {
    color: var(--primary);
    font-size: 0.875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.75rem;
    padding-bottom: 0.4rem;
    border-bottom: 2px solid var(--primary-light);
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 108, 242, 0.1);
}

/* ── Menu Option Items ───────────────────────────────────────────── */
.menu-option-item {
    background-color: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 0.75rem;
    transition: border-color 0.15s;
}

.menu-option-item:hover {
    border-color: #c7d0f8;
}

.menu-option-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.option-number {
    background-color: var(--primary);
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    flex-shrink: 0;
}

/* ── Empty State ─────────────────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 4rem 1rem;
    color: var(--gray-400);
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.4;
}

/* ── Plan Cards ──────────────────────────────────────────────────── */
.plan-card-wrap {
    border: 1px solid var(--gray-200);
    border-radius: 10px;
    padding: 1.25rem;
    height: 100%;
    transition: border-color 0.15s, box-shadow 0.15s;
    background: #fff;
    display: flex;
    gap: 1.25rem;
    align-items: flex-start;
}

.plan-card-wrap:hover {
    border-color: var(--primary);
    box-shadow: 0 4px 16px rgba(79, 108, 242, 0.1);
}

.plan-card-wrap.plan-featured {
    border-color: var(--primary);
    border-width: 2px;
}

.plan-icon-wrap {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 1.2rem;
}

.plan-icon-wrap.free {
    background: var(--gray-100);
    color: var(--gray-600);
}

.plan-icon-wrap.starter {
    background: #DBEAFE;
    color: #1D4ED8;
}

.plan-icon-wrap.pro {
    background: var(--primary-light);
    color: var(--primary);
}

.plan-icon-wrap.enterprise {
    background: #FEF3C7;
    color: #D97706;
}

.plan-price-big {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--gray-800);
    line-height: 1;
}

.plan-features {
    list-style: none;
    padding: 0;
    margin: 0.5rem 0 0.75rem;
    font-size: 0.8rem;
    color: var(--gray-600);
}

.plan-features li {
    padding: 0.15rem 0;
}

/* ── Help Icons & Tooltips ───────────────────────────────────────── */
.help-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background-color: var(--gray-400);
    color: white;
    font-size: 10px;
    font-weight: bold;
    cursor: help;
    margin-left: 5px;
    transition: background-color 0.15s;
    position: relative;
    vertical-align: middle;
}

.help-icon:hover {
    background-color: var(--primary);
}

.help-icon .fas {
    font-size: 9px;
}

.help-tooltip {
    position: absolute;
    background-color: var(--gray-800);
    color: white;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 0.78rem;
    line-height: 1.5;
    max-width: 280px;
    z-index: 1080;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
    pointer-events: none;
    white-space: normal;
}

.help-tooltip::before {
    content: '';
    position: absolute;
    border: 5px solid transparent;
}

.help-tooltip.top {
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
}

.help-tooltip.top::before {
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border-top-color: var(--gray-800);
}

.help-tooltip.bottom {
    top: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
}

.help-tooltip.bottom::before {
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border-bottom-color: var(--gray-800);
}

.help-tooltip.right {
    left: calc(100% + 8px);
    top: 50%;
    transform: translateY(-50%);
}

.help-tooltip.right::before {
    right: 100%;
    top: 50%;
    transform: translateY(-50%);
    border-right-color: var(--gray-800);
}

.help-tooltip.left {
    right: calc(100% + 8px);
    top: 50%;
    transform: translateY(-50%);
}

.help-tooltip.left::before {
    left: 100%;
    top: 50%;
    transform: translateY(-50%);
    border-left-color: var(--gray-800);
}

.help-icon:hover .help-tooltip {
    opacity: 1;
    visibility: visible;
}

.form-label-with-help {
    display: flex;
    align-items: center;
}

/* ── AI Assistant Panel ──────────────────────────────────────────── */
.assistant-panel {
    background: linear-gradient(135deg, #EEF1FD 0%, #F5F3FF 100%);
    border: 1px solid #c7d0f8;
    border-radius: 10px;
    padding: 1rem;
    margin-bottom: 1.25rem;
}

.assistant-panel-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.assistant-panel-title {
    font-weight: 600;
    color: var(--primary);
    font-size: 0.875rem;
}

/* ── Toast ───────────────────────────────────────────────────────── */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1090;
}

/* ── Loading ─────────────────────────────────────────────────────── */
.btn.loading {
    position: relative;
    color: transparent !important;
}

.btn.loading::after {
    content: "";
    position: absolute;
    width: 14px;
    height: 14px;
    top: 50%;
    left: 50%;
    margin-left: -7px;
    margin-top: -7px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* ── Typing Indicator ────────────────────────────────────────────── */
#testChatContainer {
    scroll-behavior: smooth;
}

.typing-indicator span {
    animation: typing 1.4s infinite;
    opacity: 0;
}

.typing-indicator span:nth-child(1) {
    animation-delay: 0s;
}

.typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {

    0%,
    60%,
    100% {
        opacity: 0;
    }

    30% {
        opacity: 1;
    }
}

/* ── Search ──────────────────────────────────────────────────────── */
.search-container {
    position: relative;
}

.search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray-400);
    pointer-events: none;
}

.search-input {
    padding-left: 38px;
}