:root {
    --primary-color: #4361ee;
    --secondary-color: #3f37c9;
    --accent-color: #4895ef;
    --success-color: #4cc9f0;
    --warning-color: #f72585;
    --bg-color: #1a1a2e;
    --card-bg: #ffffff;
    --text-color: #212529;
    --text-muted: #6c757d;
    --border-color: rgba(0, 0, 0, 0.125);
    --tab-bar-bg: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    --tab-bar-height: 52px;
}

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

html, body {
    height: 100%;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: #0f0f23;
    color: #e1e1e1;
}

/* ==================== Bot Tab Bar ==================== */

.bot-tab-bar {
    display: flex;
    align-items: stretch;
    background: var(--tab-bar-bg);
    height: var(--tab-bar-height);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.4);
    z-index: 1000;
    position: relative;
    padding: 0 6px;
    gap: 2px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.bot-tab-bar-brand {
    display: flex;
    align-items: center;
    padding: 0 14px 0 10px;
    gap: 8px;
    color: rgba(255, 255, 255, 0.85);
    font-weight: 700;
    font-size: 0.9rem;
    white-space: nowrap;
    flex-shrink: 0;
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    margin-right: 4px;
}

.bot-tab-bar-brand img {
    height: 28px;
    width: auto;
}

.bot-tabs {
    display: flex;
    gap: 2px;
    overflow-x: auto;
    flex: 1;
    align-items: flex-end;
    height: 100%;
    padding-top: 6px;
    scrollbar-width: none;
}

.bot-tabs::-webkit-scrollbar {
    display: none;
}

/* ==================== Individual Tab ==================== */

.bot-tab {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 14px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-bottom: none;
    border-radius: 10px 10px 0 0;
    color: rgba(255, 255, 255, 0.55);
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s ease;
    height: 42px;
    min-width: 140px;
    max-width: 280px;
    position: relative;
    user-select: none;
    flex-shrink: 0;
}

.bot-tab:hover {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.85);
}

.bot-tab.active {
    background: #f0f2f5;
    color: #212529;
    border-color: rgba(255, 255, 255, 0.12);
    font-weight: 600;
    height: 44px;
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.08);
}

.bot-tab.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 2px;
    background: #f0f2f5;
}

/* ==================== Tab Info (name + bars) ==================== */

.bot-tab-info {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
    gap: 3px;
}

/* ==================== Tab Inner Elements ==================== */

.bot-tab-status {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
    background-color: #6c757d;
    transition: all 0.3s ease;
}

.bot-tab-status.status-connected {
    background-color: #28a745;
    box-shadow: 0 0 6px rgba(40, 167, 69, 0.7);
}

.bot-tab-status.status-connecting {
    background-color: #fd7e14;
    box-shadow: 0 0 6px rgba(253, 126, 20, 0.7);
    animation: tabPulse 1.2s ease-in-out infinite;
}

.bot-tab-status.status-disconnected {
    background-color: #dc3545;
    box-shadow: 0 0 6px rgba(220, 53, 69, 0.5);
}

@keyframes tabPulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(1.3); }
}

.bot-tab-name {
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.82rem;
    letter-spacing: 0.2px;
    line-height: 1.2;
}

/* ==================== Mini HP/MP Bars in Tabs ==================== */

.bot-tab-bars {
    display: none;
    flex-direction: column;
    gap: 2px;
    width: 100%;
}

.bot-tab-bar-hp,
.bot-tab-bar-mp {
    width: 100%;
    height: 6px;
    border-radius: 1.5px;
    background: rgba(255, 255, 255, 0.12);
    overflow: hidden;
}

.bot-tab.active .bot-tab-bar-hp,
.bot-tab.active .bot-tab-bar-mp {
    background: rgba(0, 0, 0, 0.08);
}

.bot-tab-bar-fill {
    height: 100%;
    border-radius: 2px;
    width: 0%;
    transition: width 0.3s ease, background 0.3s ease;
}

.bot-tab-bar-hp .bot-tab-bar-fill {
    background: linear-gradient(90deg, rgb(82, 255, 91), rgb(126, 255, 137));
}

.bot-tab-bar-mp .bot-tab-bar-fill {
    background: linear-gradient(90deg, #4361ee, #4895ef);
}

.bot-tab-actions {
    display: flex;
    gap: 1px;
    opacity: 0;
    transition: opacity 0.15s ease;
    margin-left: 4px;
}

.bot-tab:hover .bot-tab-actions,
.bot-tab.active .bot-tab-actions {
    opacity: 1;
}

.bot-tab-action-btn {
    background: none;
    border: none;
    color: inherit;
    padding: 3px 5px;
    cursor: pointer;
    border-radius: 4px;
    font-size: 0.7rem;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.bot-tab-action-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.bot-tab.active .bot-tab-action-btn:hover {
    background: rgba(0, 0, 0, 0.08);
}

.bot-tab-action-btn.close-btn:hover {
    color: #dc3545 !important;
    background: rgba(220, 53, 69, 0.12) !important;
}

/* ==================== Tab Flashing (sound alert) ==================== */

.bot-tab.tab-flashing {
    animation: tabFlash 0.8s ease-in-out infinite;
}

@keyframes tabFlash {
    0%, 100% {
        background: rgba(255, 65, 108, 0.15);
        border-color: rgba(255, 65, 108, 0.3);
        color: rgba(255, 255, 255, 0.85);
    }
    50% {
        background: rgba(255, 65, 108, 0.45);
        border-color: rgba(255, 65, 108, 0.7);
        color: white;
        box-shadow: 0 0 12px rgba(255, 65, 108, 0.4);
    }
}

.bot-tab.active.tab-flashing {
    animation: none;
}

/* ==================== Add Bot Button ==================== */

.bot-tab-add {
    width: 34px;
    height: 34px;
    border: 2px dashed rgba(255, 255, 255, 0.2);
    background: transparent;
    color: rgba(255, 255, 255, 0.45);
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
    align-self: center;
    font-size: 0.85rem;
}

.bot-tab-add:hover {
    border-color: rgba(255, 255, 255, 0.5);
    background: rgba(255, 255, 255, 0.1);
    color: white;
    transform: scale(1.08);
}

/* ==================== Bot Frames Container ==================== */

.bot-frames-container {
    height: calc(100vh - var(--tab-bar-height));
    position: relative;
    background-color: #f0f2f5;
}

.bot-frame {
    width: 100%;
    height: 100%;
    border: none;
    position: absolute;
    top: 0;
    left: 0;
}

/* ==================== No Bots State ==================== */

.no-bots-message {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #6c757d;
    text-align: center;
    padding: 2rem;
    gap: 8px;
}

.no-bots-message .icon-wrapper {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(67, 97, 238, 0.1), rgba(72, 149, 239, 0.1));
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 8px;
}

.no-bots-message .icon-wrapper i {
    font-size: 2rem;
    color: var(--primary-color);
    opacity: 0.6;
}

.no-bots-message h4 {
    font-weight: 600;
    color: #495057;
    margin: 0;
}

.no-bots-message p {
    margin: 0;
    font-size: 0.95rem;
}

/* ==================== Modal Styles ==================== */

.modal-content {
    border: none;
    border-radius: 14px;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.25);
    overflow: hidden;
}

.modal-header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    border-bottom: none;
    padding: 1.1rem 1.5rem;
}

.modal-header .modal-title {
    font-weight: 600;
    font-size: 1.05rem;
}

.modal-header .btn-close {
    filter: brightness(0) invert(1);
    opacity: 0.8;
}

.modal-header .btn-close:hover {
    opacity: 1;
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    border-top: 1px solid rgba(0, 0, 0, 0.08);
    padding: 1rem 1.5rem;
    background: #fafbfc;
}

/* ==================== Form ==================== */

.form-label {
    font-size: 0.88rem;
    margin-bottom: 0.35rem;
    color: #495057;
}

.form-label i {
    color: var(--primary-color);
}

.form-control {
    border-radius: 8px;
    padding: 0.6rem 0.85rem;
    border: 2px solid #dee2e6;
    transition: all 0.2s ease;
    font-size: 0.92rem;
}

.form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(67, 97, 238, 0.18);
}

.form-control::placeholder {
    color: #adb5bd;
}

/* ==================== Buttons ==================== */

.btn {
    border-radius: 8px;
    padding: 0.5rem 1.2rem;
    font-weight: 500;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    border: none;
    color: white;
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--secondary-color) 0%, #2d2a99 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(67, 97, 238, 0.3);
}

.btn-secondary {
    background: #e9ecef;
    border: none;
    color: #495057;
}

.btn-secondary:hover {
    background: #dee2e6;
    color: #212529;
}

.btn-danger {
    background: #dc3545;
    border: none;
    color: white;
}

.btn-danger:hover {
    background: #bb2d3b;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(220, 53, 69, 0.3);
}

/* ==================== Responsive ==================== */

@media (max-width: 768px) {
    .bot-tab-bar-brand span {
        display: none;
    }

    .bot-tab {
        min-width: 100px;
        padding: 0 10px;
    }

    .bot-tab-name {
        font-size: 0.78rem;
    }
}

@media (max-width: 480px) {
    .bot-tab {
        min-width: 80px;
        max-width: 160px;
    }

    .bot-tab-bar-brand {
        padding: 0 8px;
    }
}
