/**
 * Tenant Context Bar (IT-103)
 * Sticky bar showing current tenant context or Global View badge.
 */

/* ─── Context Bar ─── */
.tc-bar {
    position: sticky;
    top: 0;
    z-index: 1200;
    background: #fff;
    border-bottom: 1px solid var(--border-primary, #e9ecef);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

.tc-bar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 24px;
    min-height: 42px;
}

.tc-bar-inner.tc-global {
    justify-content: flex-start;
}

/* ─── Badge ─── */
.tc-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
}

.tc-badge-global {
    background: #f1f3f5;
    color: #495057;
    border: 1px solid #dee2e6;
}

.tc-status-active {
    background: #d4edda;
    color: #155724;
}

.tc-status-draft {
    background: #e9ecef;
    color: #495057;
}

.tc-status-suspended {
    background: #fff3cd;
    color: #856404;
}

.tc-status-archived {
    background: #f8d7da;
    color: #721c24;
}

/* ─── Info + Actions ─── */
.tc-info {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.tc-detail {
    font-size: 13px;
    color: #6c757d;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tc-detail strong {
    color: #2c3e50;
}

.tc-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

/* ─── Switcher Dropdown ─── */
.tc-switcher {
    position: relative;
}

.tc-switch-btn {
    padding: 5px 12px;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    background: #fff;
    font-size: 13px;
    cursor: pointer;
    white-space: nowrap;
    transition: border-color 0.15s;
}

.tc-switch-btn:hover {
    border-color: var(--accent-primary, #cf6a57);
}

.tc-dropdown {
    display: none;
    position: absolute;
    right: 0;
    top: calc(100% + 4px);
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    min-width: 240px;
    max-height: 320px;
    overflow-y: auto;
    z-index: 1300;
    padding: 4px 0;
}

.tc-dropdown.open {
    display: block;
}

.tc-dropdown-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 8px 14px;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 13px;
    text-align: left;
    transition: background 0.1s;
}

.tc-dropdown-item:hover {
    background: #f8f9fa;
}

.tc-dropdown-item.current {
    background: #e8f0fe;
    font-weight: 600;
}

.tc-dropdown-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tc-dropdown-status {
    flex-shrink: 0;
    font-size: 11px;
    margin-left: 8px;
}

.tc-dropdown-loading,
.tc-dropdown-empty,
.tc-dropdown-error {
    padding: 16px;
    text-align: center;
    font-size: 13px;
    color: #6c757d;
}

.tc-dropdown-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.tc-retry-btn {
    padding: 4px 12px;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    background: #fff;
    cursor: pointer;
    font-size: 12px;
}

.tc-retry-btn:hover {
    background: #f1f3f5;
}

/* ─── Exit Button ─── */
.tc-exit-btn {
    padding: 5px 14px;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    background: #fff;
    color: #dc3545;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
}

.tc-exit-btn:hover {
    background: #dc3545;
    color: #fff;
    border-color: #dc3545;
}

/* ─── Archived Banner ─── */
.tc-archived-banner {
    padding: 6px 24px;
    background: #fff3cd;
    color: #856404;
    font-size: 13px;
    font-weight: 500;
    text-align: center;
    border-top: 1px solid #ffc107;
}

/* ─── Responsive ─── */
@media (max-width: 768px) {
    .tc-bar-inner {
        padding: 6px 12px;
        flex-wrap: wrap;
        gap: 6px;
    }

    .tc-detail {
        display: none;
    }

    .tc-dropdown {
        left: 0;
        right: 0;
        min-width: auto;
    }
}
