/* ========================================
   BOTFORGE HOSTING PAGE
   ======================================== */

/* ========================================
   HOSTING CONTAINER
   ======================================== */

.hosting-container {
    padding: 2rem 0;
    min-height: calc(100vh - 60px);
}

.hosting-header {
    text-align: center;
    margin-bottom: 3rem;
}

.hosting-header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

/* ========================================
   STATS GRID
   ======================================== */

.hosting-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-bottom: 3rem;
}

/* ========================================
   HOSTED BOTS LIST
   ======================================== */

.hosted-bots-section {
    margin-top: 3rem;
}

.hosted-bots-section .section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.hosted-bots-section .section-header h2 {
    font-size: 1.75rem;
    font-weight: 700;
}

.hosted-bots-list {
    display: flex;
    flex-direction: column;
    gap: 0.875rem;
}

/* ========================================
   BOT CARD — poziomy prostokąt
   ======================================== */

.hosted-bot-card {
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: 10px;
    padding: 1rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

/* Status przez kolor ramki */
.hosted-bot-card.status-online {
    border-color: #22c55e;
    box-shadow: 0 0 0 1px rgba(34, 197, 94, 0.15);
}

.hosted-bot-card.status-offline {
    border-color: #ef4444;
    box-shadow: 0 0 0 1px rgba(239, 68, 68, 0.1);
}

.hosted-bot-card:hover {
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
    filter: brightness(1.05);
}

/* Lewa strona: ikona + info */
.bot-card-left {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex: 1;
    min-width: 0;
}

.bot-card-icon {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    flex-shrink: 0;
    object-fit: cover;
}

.bot-card-info {
    min-width: 0;
}

.bot-card-info h3 {
    font-size: 1rem;
    font-weight: 600;
    margin: 0 0 0.3rem 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text);
}

/* Statystyki inline */
.bot-card-stats {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.bot-stat {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.bot-stat-sep {
    opacity: 0.4;
}

/* Przyciski po prawej */
.bot-card-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

.btn-manage {
    padding: 0.5rem 1.1rem;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.1s ease;
    white-space: nowrap;
}

.btn-manage:hover {
    background: var(--primary-dark, #6d28d9);
    transform: translateY(-1px);
}

.btn-delete {
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease;
    line-height: 1;
}

.btn-delete:hover {
    background: rgba(239, 68, 68, 0.12);
    border-color: #ef4444;
}

/* ========================================
   MODAL - FULL SCREEN PANEL
   ======================================== */

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: #0f0f1e;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    border: none;
    border-radius: 0;
    margin: 0;
    padding: 0;
}

/* ========================================
   STICKY HEADER
   ======================================== */

.modal-header {
    background: #1a1a2e;
    border-bottom: 2px solid var(--border);
    padding: 1.5rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 70px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.modal-header-left {
    flex: 1;
}

.modal-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
}

.modal-close {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 2px solid var(--border);
    border-radius: 0;
    color: var(--text-muted);
    font-size: 2rem;
    cursor: pointer;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.modal-close:hover {
    background: var(--error);
    border-color: var(--error);
    color: white;
}

/* ========================================
   STICKY TABS NAVIGATION
   ======================================== */

.modal-tabs {
    display: flex;
    gap: 0;
    background: #1a1a2e;
    border-bottom: 2px solid var(--border);
    position: sticky;
    top: 70px;
    z-index: 99;
    overflow-x: auto;
}

.modal-tab {
    padding: 1rem 2rem;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    color: var(--text-muted);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
    border-radius: 0;
}

.modal-tab:hover {
    background: rgba(124, 58, 237, 0.1);
    color: var(--text);
}

.modal-tab.active {
    background: transparent;
    color: var(--primary);
    border-bottom-color: var(--primary);
}

/* ========================================
   SCROLLABLE BODY
   ======================================== */

.modal-body {
    padding: 2rem;
    overflow-y: auto;
    flex: 1;
    background: #0f0f1e;
    height: calc(100vh - 140px);
}

.modal-tab-content {
    position: relative;
}

.modal-tab-pane {
    display: none;
}

.modal-tab-pane.active {
    display: block;
}

/* ========================================
   OVERVIEW TAB
   ======================================== */

.bot-overview {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.overview-section h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.status-display {
    padding: 1.5rem;
    background: var(--surface-light);
    border-radius: var(--radius-md);
    text-align: center;
}

.status-indicator {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-full);
    font-size: 1.125rem;
    font-weight: 600;
}

.status-indicator.online {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

.status-indicator.offline {
    background: rgba(239, 68, 68, 0.1);
    color: var(--error);
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
}

.info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background: var(--surface-light);
    border-radius: var(--radius-sm);
}

.info-row span:first-child {
    color: var(--text-muted);
    font-size: 0.875rem;
}

.info-row span:last-child,
.info-row code {
    font-weight: 600;
    font-family: 'Courier New', monospace;
    font-size: 0.875rem;
}

.action-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 0.75rem;
}

/* ========================================
   ENVIRONMENT VARIABLES TAB
   ======================================== */

.env-vars-section {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.env-vars-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.env-vars-header h3 {
    font-size: 1.25rem;
    font-weight: 600;
}

.env-vars-info {
    padding: 1rem;
    background: rgba(59, 130, 246, 0.1);
    border-left: 4px solid #3b82f6;
    border-radius: var(--radius-sm);
}

.env-vars-info p {
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #3b82f6;
}

.env-vars-info ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.env-vars-info li {
    padding: 0.25rem 0;
    padding-left: 1.5rem;
    position: relative;
    font-size: 0.875rem;
    color: var(--text-muted);
}

.env-vars-info li::before {
    content: '•';
    position: absolute;
    left: 0;
    color: #3b82f6;
}

.env-vars-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.env-var-item {
    display: grid;
    grid-template-columns: 1fr 2fr auto;
    gap: 0.75rem;
    align-items: center;
}

.env-var-item .env-key,
.env-var-item .env-value {
    font-family: 'Courier New', monospace;
    font-size: 0.875rem;
}

.env-var-item .btn-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: transparent;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1rem;
}

.env-var-item .btn-icon:hover {
    background: rgba(239, 68, 68, 0.1);
    border-color: var(--error);
}

.env-vars-actions {
    display: flex;
    justify-content: flex-end;
}

/* ========================================
   LOGS TAB - CONSOLE STYLE
   ======================================== */

.logs-section {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.logs-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logs-header h3 {
    font-size: 1.25rem;
    font-weight: 600;
}

.logs-controls {
    display: flex;
    gap: 0.5rem;
}

.logs-viewer {
    background: #0a0a12;
    border: 2px solid var(--border);
    border-radius: 0;
    padding: 1.5rem;
    height: calc(100vh - 280px);
    overflow-y: auto;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.6;
    color: #e0e0e0;
}

.logs-viewer::-webkit-scrollbar { width: 10px; }
.logs-viewer::-webkit-scrollbar-track { background: #0f0f1e; }
.logs-viewer::-webkit-scrollbar-thumb { background: var(--primary); border-radius: 0; }
.logs-viewer::-webkit-scrollbar-thumb:hover { background: var(--primary-dark); }

.log-line {
    padding: 0.25rem 0;
    border-left: 3px solid transparent;
    padding-left: 0.75rem;
    margin-bottom: 2px;
}

.log-line.error {
    border-left-color: var(--error);
    color: #ff6b6b;
    background: rgba(255, 85, 85, 0.05);
}

.log-line.warning {
    border-left-color: var(--warning);
    color: #ffd93d;
    background: rgba(255, 217, 61, 0.05);
}

.log-line.info {
    border-left-color: #3b82f6;
    color: #60a5fa;
}

.log-line.success {
    border-left-color: var(--success);
    color: #4ade80;
    background: rgba(80, 250, 123, 0.05);
}

/* ========================================
   SETTINGS TAB
   ======================================== */

.settings-section {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.settings-section h3 {
    font-size: 1.25rem;
    font-weight: 600;
}

.toggle-switch-label {
    position: relative;
    display: inline-block;
    width: 52px;
    height: 28px;
}

.toggle-switch-label input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-switch-slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background: #2a2a40;
    transition: 0.3s;
    border-radius: 28px;
}

.toggle-switch-slider:before {
    position: absolute;
    content: "";
    height: 22px;
    width: 22px;
    left: 3px;
    bottom: 3px;
    background: white;
    transition: 0.3s;
    border-radius: 50%;
}

.toggle-switch-label input:checked + .toggle-switch-slider {
    background: var(--primary);
}

.toggle-switch-label input:checked + .toggle-switch-slider:before {
    transform: translateX(24px);
}

.plan-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.plan-info .badge {
    padding: 0.5rem 1rem;
    border-radius: var(--radius-full);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.plan-info .badge.free {
    background: rgba(124, 58, 237, 0.1);
    color: var(--primary);
}

.plan-info .badge.pro {
    background: linear-gradient(135deg, #7c3aed, #ec4899);
    color: white;
}

.settings-danger-zone {
    margin-top: 2rem;
    padding: 1.5rem;
    background: rgba(239, 68, 68, 0.05);
    border: 2px dashed var(--error);
    border-radius: var(--radius-md);
}

.settings-danger-zone h4 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--error);
}

.settings-actions {
    display: flex;
    justify-content: flex-end;
}

/* ========================================
   BUTTONS
   ======================================== */

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

.btn-danger {
    background: var(--error);
    color: white;
    border: none;
}

.btn-danger:hover {
    background: #dc2626;
}

/* ========================================
   RESPONSIVE
   ======================================== */

@media (max-width: 640px) {
    .hosting-stats-grid {
        grid-template-columns: 1fr;
    }

    .hosted-bot-card {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .bot-card-actions {
        width: 100%;
        justify-content: flex-end;
    }

    .modal-tabs {
        overflow-x: auto;
    }

    .env-var-item {
        grid-template-columns: 1fr;
    }

    .info-grid {
        grid-template-columns: 1fr;
    }

    .action-buttons {
        grid-template-columns: 1fr;
    }
}

/* ========================================
   NOTIFICATIONS
   ======================================== */

.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 1rem 1.5rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    z-index: 3000;
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.3s ease;
}

.notification.show {
    opacity: 1;
    transform: translateX(0);
}

.notification-success { border-color: var(--success); color: var(--success); }
.notification-error   { border-color: var(--error);   color: var(--error);   }
.notification-info    { border-color: #3b82f6;         color: #3b82f6;        }