/* ==========================================================================
   Test Environment Status — shared component styles
   Used by task-detail.js and project-management-page.js
   ========================================================================== */

/* Section layout */
.test-env-status-section {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: var(--space-1);
}

/* Badge base */
.test-env-status {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-1\.5) var(--space-3);
    border-radius: 16px;
    font-size: var(--text-xs);
    font-weight: 600;
    color: white;
    transition: all 0.2s ease;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.test-env-status i {
    font-size: var(--text-xs);
}

.test-env-status-label {
    white-space: nowrap;
}

.test-env-port {
    font-size: var(--text-xs);
    padding: var(--space-0\.5) var(--space-1\.5);
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    margin-left: var(--space-1);
}

/* ---- State colours ---- */

.test-env-status-starting {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    animation: test-env-pulse-blue 2s infinite;
}

.test-env-status-starting i {
    animation: test-env-spin 1s linear infinite;
}

.test-env-status-up {
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
}

.test-env-status-stopping {
    background: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
    animation: test-env-pulse-orange 2s infinite;
}

.test-env-status-stopping i {
    animation: test-env-spin 1s linear infinite;
}

.test-env-status-down {
    background: linear-gradient(135deg, #6b7280 0%, #4b5563 100%);
}

.test-env-status-error {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
}

.test-env-status-soft-resetting {
    background: linear-gradient(135deg, #a855f7 0%, #9333ea 100%);
    animation: test-env-pulse-purple 2s infinite;
}

.test-env-status-soft-resetting i {
    animation: test-env-spin 1s linear infinite;
}

/* ---- Keyframes (prefixed to avoid collisions) ---- */

@keyframes test-env-pulse-blue {
    0%, 100% { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.4); }
    50%      { box-shadow: 0 0 0 8px rgba(59, 130, 246, 0); }
}

@keyframes test-env-pulse-orange {
    0%, 100% { box-shadow: 0 0 0 0 rgba(249, 115, 22, 0.4); }
    50%      { box-shadow: 0 0 0 8px rgba(249, 115, 22, 0); }
}

@keyframes test-env-pulse-purple {
    0%, 100% { box-shadow: 0 0 0 0 rgba(168, 85, 247, 0.4); }
    50%      { box-shadow: 0 0 0 8px rgba(168, 85, 247, 0); }
}

@keyframes test-env-spin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

/* ---- Clickable link (when test env is up) ---- */

a.test-env-status-clickable {
    text-decoration: none;
    cursor: pointer;
}

a.test-env-status-clickable:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.test-env-link-icon {
    font-size: var(--text-2xs);
    margin-left: var(--space-1);
    opacity: 0.8;
}

/* ---- Control buttons ---- */

.test-env-controls {
    display: flex;
    gap: var(--space-1\.5);
    margin-left: var(--space-2);
}

.test-env-control-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: var(--height-input-sm);
    height: var(--height-input-sm);
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: var(--text-xs);
}

.test-env-start-btn {
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    color: white;
}

.test-env-start-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(34, 197, 94, 0.4);
}

.test-env-restart-btn {
    background: linear-gradient(135deg, #a855f7 0%, #9333ea 100%);
    color: white;
}

.test-env-restart-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(168, 85, 247, 0.4);
}

.test-env-stop-btn {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
}

.test-env-stop-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
}

.test-env-control-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* ---- Table-variant badge (compact, no shadow) ---- */

.test-env-status.test-env-table-badge {
    padding: var(--space-1) var(--space-2);
    font-size: var(--text-2xs);
    gap: var(--space-1);
    box-shadow: none;
}

/* ---- Mobile breakpoint ---- */

@media (max-width: 768px) {
    .test-env-status {
        padding: var(--space-1) var(--space-2);
        font-size: var(--text-2xs);
        gap: var(--space-1);
    }

    .test-env-status-section {
        flex-wrap: wrap;
        gap: var(--space-1);
    }

    .test-env-control-btn {
        width: 24px;
        height: 24px;
        font-size: var(--text-2xs);
    }
}
