:root {
    --bg-primary: #060b16;
    --bg-sidebar: #03060d;
    --bg-card: rgba(12, 21, 41, 0.5);
    --bg-card-hover: rgba(16, 28, 54, 0.7);
    --border-color: rgba(255, 255, 255, 0.05);
    --border-hover: rgba(0, 255, 204, 0.25);
    --text-main: #f3f4f6;
    --text-muted: #9ca3af;
    
    --primary: #00ffcc;
    --primary-glow: rgba(0, 255, 204, 0.4);
    --secondary: #3b82f6;
    --gold: #f59e0b;
    --gold-glow: rgba(245, 158, 11, 0.4);
    --danger: #ef4444;
    --success: #10b981;
    
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --shadow-main: 0 4px 30px rgba(0, 0, 0, 0.4);
    --shadow-glow: 0 0 25px rgba(0, 255, 204, 0.15);
    --shadow-glow-gold: 0 0 25px rgba(245, 158, 11, 0.15);
    --backdrop-blur: blur(12px);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Plus Jakarta Sans', -apple-system, sans-serif;
    -webkit-font-smoothing: antialiased;
}

body {
    background-color: var(--bg-primary);
    color: var(--text-main);
    overflow: hidden;
    height: 100vh;
}

/* Background Gradients */
body::before {
    content: '';
    position: absolute;
    top: -20%;
    left: -10%;
    width: 600px;
    height: 600px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(0, 255, 204, 0.07) 0%, rgba(0, 0, 0, 0) 70%);
    z-index: -1;
    pointer-events: none;
}

body::after {
    content: '';
    position: absolute;
    bottom: -10%;
    right: -10%;
    width: 700px;
    height: 700px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(59, 130, 246, 0.06) 0%, rgba(0, 0, 0, 0) 70%);
    z-index: -1;
    pointer-events: none;
}

/* Main Container Layout */
.portal-container {
    display: flex;
    width: 100vw;
    height: 100vh;
}

/* Sidebar Styling */
.sidebar {
    width: 280px;
    background-color: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    z-index: 10;
}

.sidebar-header {
    padding: 24px;
    border-bottom: 1px solid var(--border-color);
}

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

.logo-icon {
    font-size: 24px;
    background: linear-gradient(135deg, #00ffcc, #3b82f6);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 0 8px rgba(0, 255, 204, 0.3));
}

.logo-meta {
    display: flex;
    flex-direction: column;
}

.logo-text {
    font-size: 16px;
    font-weight: 800;
    letter-spacing: 1.5px;
    color: var(--text-main);
}

.logo-subtext {
    font-size: 10px;
    font-weight: 500;
    color: var(--text-muted);
    letter-spacing: 0.5px;
}

.nav-section {
    padding: 16px;
}

.nav-title {
    font-size: 11px;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 2px;
    margin-bottom: 12px;
    padding-left: 8px;
    font-weight: 700;
}

/* Navigation Items */
.nav-item, .bot-nav-item {
    width: 100%;
    background: none;
    border: 1px solid transparent;
    border-radius: 8px;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    transition: var(--transition-smooth);
    text-align: left;
}

.nav-item {
    gap: 12px;
    padding: 12px;
    font-size: 14px;
    font-weight: 600;
}

.nav-item:hover, .nav-item.active {
    background-color: var(--bg-card);
    color: var(--primary);
    border-color: rgba(0, 255, 204, 0.1);
}

.bot-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: calc(100vh - 280px);
    overflow-y: auto;
}

/* Custom Scrollbar for Bot List */
.bot-list::-webkit-scrollbar {
    width: 4px;
}
.bot-list::-webkit-scrollbar-thumb {
    background-color: var(--border-color);
    border-radius: 4px;
}

.bot-nav-item {
    padding: 10px 12px;
    gap: 10px;
    background-color: rgba(255, 255, 255, 0.01);
    border: 1px solid var(--border-color);
}

.bot-nav-item:hover, .bot-nav-item.active {
    background-color: var(--bg-card-hover);
    border-color: var(--border-hover);
    transform: translateX(4px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.bot-nav-item.active {
    border-color: var(--primary);
    box-shadow: var(--shadow-glow);
}

.bot-nav-item.active.premium-active {
    border-color: var(--gold);
    box-shadow: var(--shadow-glow-gold);
}

.status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.status-indicator.online {
    background-color: var(--success);
    box-shadow: 0 0 10px var(--success);
}

.status-indicator.offline {
    background-color: var(--danger);
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.4);
}

.bot-meta {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.bot-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.bot-quick-stats {
    font-size: 10px;
    color: var(--text-muted);
    font-family: 'JetBrains Mono', monospace;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-footer {
    margin-top: auto;
    padding: 20px;
    border-top: 1px solid var(--border-color);
    background-color: rgba(0, 0, 0, 0.15);
}

.footer-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
}

.meta-label {
    color: var(--text-muted);
}

.meta-value {
    font-weight: 700;
    color: var(--primary);
}

/* Main Content Workspace */
.main-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow-y: auto;
    background-color: transparent;
    position: relative;
}

.header {
    padding: 24px 32px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    background-color: rgba(6, 11, 22, 0.4);
    backdrop-filter: var(--backdrop-blur);
    position: sticky;
    top: 0;
    z-index: 5;
}

.header-title h1 {
    font-size: 22px;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.header-title p {
    font-size: 13px;
    margin-top: 2px;
}

.text-muted {
    color: var(--text-muted);
}

.refresh-badge {
    background-color: rgba(0, 255, 204, 0.05);
    border: 1px solid rgba(0, 255, 204, 0.15);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 11px;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
}

.pulse-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: var(--primary);
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% { transform: scale(0.9); opacity: 0.5; }
    50% { transform: scale(1.2); opacity: 1; box-shadow: 0 0 10px var(--primary); }
    100% { transform: scale(0.9); opacity: 0.5; }
}

/* View Panels */
.view-panel {
    padding: 32px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 32px;
    animation: fadeIn 0.4s ease;
}

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

.hidden {
    display: none !important;
}

/* Master Platform Summary Cards */
.platform-summary-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
}

.summary-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 24px;
    backdrop-filter: var(--backdrop-blur);
    display: flex;
    flex-direction: column;
    gap: 6px;
    box-shadow: var(--shadow-main);
    transition: var(--transition-smooth);
}

.summary-card:hover {
    transform: translateY(-2px);
    border-color: rgba(255, 255, 255, 0.1);
    background-color: rgba(16, 28, 54, 0.4);
}

.summary-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.summary-value {
    font-size: 28px;
    font-weight: 800;
    font-family: 'JetBrains Mono', monospace;
    letter-spacing: -1px;
    background: linear-gradient(135deg, #ffffff 0%, #cbd5e1 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.summary-sub {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 500;
}

.summary-sub.pnl-positive {
    color: var(--success) !important;
    font-weight: 600;
}

.summary-sub.pnl-negative {
    color: var(--danger) !important;
    font-weight: 600;
}

.section-title {
    font-size: 16px;
    font-weight: 800;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--text-main);
    position: relative;
    padding-left: 12px;
}

.section-title::before {
    content: '';
    position: absolute;
    left: 0;
    top: 3px;
    bottom: 3px;
    width: 3px;
    background-color: var(--primary);
    border-radius: 2px;
    box-shadow: 0 0 8px var(--primary);
}

/* Bot Card Grid */
.bot-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
}

.bot-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 24px;
    backdrop-filter: var(--backdrop-blur);
    display: flex;
    flex-direction: column;
    gap: 16px;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-main);
    transition: var(--transition-smooth);
}

.bot-card:hover {
    transform: translateY(-4px) scale(1.01);
    background-color: var(--bg-card-hover);
    border-color: var(--border-hover);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), rgba(0, 255, 204, 0.03) 0 0 20px;
}

.bot-card.card-premium {
    border-color: rgba(245, 158, 11, 0.15);
}

.bot-card.card-premium:hover {
    border-color: var(--gold);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), rgba(245, 158, 11, 0.05) 0 0 25px;
}

/* Glow effects on hover */
.bot-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at 100% 0%, rgba(0, 255, 204, 0.04) 0%, rgba(0, 0, 0, 0) 60%);
    z-index: 1;
    pointer-events: none;
    opacity: 0;
    transition: var(--transition-smooth);
}

.bot-card.card-premium::after {
    background: radial-gradient(circle at 100% 0%, rgba(245, 158, 11, 0.05) 0%, rgba(0, 0, 0, 0) 60%);
}

.bot-card:hover::after {
    opacity: 1;
}

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

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

.bot-avatar {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background-color: rgba(0, 255, 204, 0.1);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 16px;
    border: 1px solid rgba(0, 255, 204, 0.2);
}

.bot-avatar.bg-gold {
    background-color: rgba(245, 158, 11, 0.1);
    color: var(--gold);
    border-color: rgba(245, 158, 11, 0.2);
}

.bot-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.bot-info h3 {
    font-size: 15px;
    font-weight: 700;
}

.badge {
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-strategy {
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--text-muted);
    border: 1px solid var(--border-color);
}

.badge-premium {
    background-color: rgba(245, 158, 11, 0.1);
    color: var(--gold);
    border: 1px solid rgba(245, 158, 11, 0.2);
}

.status-badge {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 10px;
    font-weight: 700;
}

.status-badge.online {
    background-color: rgba(16, 185, 129, 0.1);
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.status-badge.offline {
    background-color: rgba(239, 68, 68, 0.1);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.bot-description {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.5;
}

.card-stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    padding: 8px 0;
}

.card-stat {
    background-color: rgba(0, 0, 0, 0.15);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.stat-lbl {
    font-size: 10px;
    color: var(--text-muted);
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.stat-val {
    font-size: 13px;
    font-weight: 700;
    font-family: 'JetBrains Mono', monospace;
}

.stat-val.positive {
    color: var(--success);
}

.stat-val.negative {
    color: var(--danger);
}

.btn {
    border: none;
    border-radius: 8px;
    padding: 12px 16px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition-smooth);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-primary {
    background: linear-gradient(135deg, rgba(0, 255, 204, 0.1) 0%, rgba(59, 130, 246, 0.1) 100%);
    color: var(--primary);
    border: 1px solid rgba(0, 255, 204, 0.25);
    box-shadow: 0 4px 12px rgba(0, 255, 204, 0.05);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: #03060d;
    box-shadow: var(--shadow-glow);
    border-color: var(--primary);
}

.btn-gold {
    background: rgba(245, 158, 11, 0.1);
    color: var(--gold);
    border: 1px solid rgba(245, 158, 11, 0.25);
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.05);
}

.btn-gold:hover {
    background: linear-gradient(135deg, var(--gold) 0%, #d97706 100%);
    color: #03060d;
    box-shadow: var(--shadow-glow-gold);
    border-color: var(--gold);
}

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

.btn-secondary:hover {
    background-color: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.15);
}

.card-action-btn {
    width: 100%;
    margin-top: auto;
    z-index: 2;
}

/* Console Iframe View Panel */
#panel-console {
    padding: 0;
    gap: 0;
    height: 100vh;
}

.console-actions {
    padding: 16px 32px;
    background-color: var(--bg-sidebar);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.console-bot-details {
    display: flex;
    align-items: center;
    gap: 12px;
}

.console-bot-indicator {
    width: 8px;
    height: 8px;
}

.console-bot-details h2 {
    font-size: 16px;
    font-weight: 700;
}

.console-controls {
    display: flex;
    gap: 10px;
}

.console-controls .btn {
    padding: 8px 16px;
    font-size: 12px;
    border-radius: 6px;
}

.iframe-container {
    flex-grow: 1;
    width: 100%;
    height: calc(100vh - 65px);
    background-color: #03060d;
    position: relative;
}

.iframe-container iframe {
    width: 100%;
    height: 100%;
    border: none;
    background-color: transparent;
}

#lnk-new-tab {
    text-decoration: none;
}

/* ===== RESPONSIVE STYLING FOR PORTAL ===== */
@media (max-width: 1024px) {
    .bot-grid {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    }
}

@media (max-width: 768px) {
    .portal-container {
        flex-direction: column;
        overflow-y: auto;
        height: auto;
    }
    
    .sidebar {
        width: 100%;
        height: auto;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }
    
    .sidebar-header {
        padding: 16px 20px;
    }
    
    .nav-section {
        padding: 10px 20px;
    }
    
    .bot-list {
        flex-direction: row;
        overflow-x: auto;
        white-space: nowrap;
        padding-bottom: 8px;
        max-height: none;
        gap: 8px;
        -webkit-overflow-scrolling: touch;
    }
    
    .bot-nav-item {
        width: auto;
        flex-shrink: 0;
        padding: 8px 12px;
    }
    
    .bot-nav-item:hover, .bot-nav-item.active {
        transform: none; /* Disable horizontal slide on mobile hover */
    }
    
    .sidebar-footer {
        display: none; /* Hide sidebar footer metadata to save vertical space */
    }
    
    .main-content {
        height: auto;
        overflow-y: visible;
    }
    
    .header {
        padding: 16px 20px;
        position: relative; /* Release sticky on mobile for better scrolling */
    }
    
    .view-panel {
        padding: 20px;
        gap: 20px;
    }
    
    .platform-summary-cards {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .bot-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .iframe-container {
        height: 70vh; /* Fixed height for iframe container on mobile to allow scrolling the page */
    }
    
    #panel-console {
        height: auto;
    }
    
    .console-actions {
        padding: 12px 20px;
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    .console-controls {
        width: 100%;
        justify-content: space-between;
    }
}
