/* Copyright (c) 2025-2026 William Chesher | MIT License */
/* deployments.css - Deployment page styles (aligned with fleet card patterns) */

/* ============================================
   Stats Cards (fleet-aligned)
   ============================================ */

.stats-cards {
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}

@media (max-width: 500px) {
    .stats-cards {
        grid-template-columns: repeat(2, 1fr);
    }
}

.stat-card {
    background: #fff;
    border-radius: 10px;
    padding: 1rem;
    border: 1px solid #eee;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--stat-color, var(--accent)), transparent);
    opacity: 0.7;
    transition: opacity 0.2s;
}

.stat-card:hover {
    border-color: var(--stat-color, var(--accent));
    box-shadow: 0 4px 16px color-mix(in srgb, var(--stat-color, var(--accent)) 15%, transparent);
    transform: translateY(-2px);
}

.stat-card:hover::before {
    opacity: 1;
}

.stat-card .stat-row {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.stat-card .stat-icon {
    width: 40px;
    height: 40px;
    color: var(--stat-color, var(--accent));
    opacity: 0.8;
    flex-shrink: 0;
}

.stat-card .stat-icon svg {
    width: 40px;
    height: 40px;
}

.stat-card .stat-content {
    flex: 1;
}

.stat-card .stat-value {
    font-size: 2rem;
    font-weight: 600;
    color: #333;
    line-height: 1;
}

.stat-card .stat-label {
    font-size: 0.8rem;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 0.25rem;
}

/* Stat card color variants */
.stat-card.total   { --stat-color: var(--accent, #7c6fae); }
.stat-card.active  { --stat-color: #4caf50; }
.stat-card.paused  { --stat-color: #ff9800; }
.stat-card.error   { --stat-color: #e74c3c; }

.stat-card.total .stat-icon   { color: var(--accent, #7c6fae); }
.stat-card.active .stat-icon  { color: #4caf50; }
.stat-card.paused .stat-icon  { color: #ff9800; }
.stat-card.error .stat-icon   { color: #e74c3c; }

/* Dark theme stat cards */
html.dark-theme .stat-card {
    background: #1f2940;
    border-color: #2a3a55;
}

html.dark-theme .stat-card:hover {
    border-color: var(--stat-color, var(--accent));
    box-shadow: 0 4px 16px color-mix(in srgb, var(--stat-color, var(--accent)) 25%, transparent);
}

html.dark-theme .stat-card .stat-value {
    color: #fff;
}

/* filter-bar: now in admin.css */

/* ============================================
   Deployment List
   ============================================ */

.deployment-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 1rem;
}

.deployment-item {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
    border: 1px solid transparent;
    transition: all 0.2s ease;
    overflow: hidden;
}

.deployment-item:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
    transform: translateY(-2px);
}

.deployment-item.error-state {
    border-color: rgba(231, 76, 60, 0.4);
}

.deployment-item.deploying-state {
    border-color: rgba(63, 81, 181, 0.4);
}

.deployment-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    cursor: pointer;
    gap: 0.75rem;
}

.deployment-info {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    flex: 1;
    min-width: 0;
}

.deployment-info > i,
.deployment-info > svg {
    width: 24px;
    height: 24px;
    color: var(--accent, #7c6fae);
    flex-shrink: 0;
    margin-top: 2px;
}

.deployment-details {
    min-width: 0;
    flex: 1;
}

.deployment-name {
    font-weight: 600;
    color: #333;
}

.deployment-description {
    font-size: 0.8rem;
    color: #888;
    margin-top: 0.1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.deployment-trigger {
    font-size: 0.85rem;
    color: #666;
}

.deployment-meta {
    display: flex;
    gap: 1rem;
    font-size: 0.75rem;
    color: #888;
    margin-top: 0.25rem;
    flex-wrap: wrap;
}

.deployment-meta span {
    white-space: nowrap;
}

.deployment-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
}

.deployment-actions {
    display: flex;
    gap: 0.25rem;
    align-items: center;
    padding-left: 0.5rem;
    border-left: 1px solid #eee;
}

/* Error banner */
.deploy-error-banner {
    padding: 0.5rem 1.25rem;
    background: rgba(231, 76, 60, 0.08);
    border-top: 1px solid rgba(231, 76, 60, 0.2);
    font-size: 0.8rem;
    color: #c62828;
}

/* ============================================
   Empty & Loading States
   ============================================ */

.empty-state {
    text-align: center;
    padding: 3rem 2rem;
    color: #888;
}

.empty-state i,
.empty-state svg {
    font-size: 3rem;
    width: 48px;
    height: 48px;
    color: var(--accent);
    opacity: 0.5;
    margin-bottom: 1rem;
}

.empty-state p {
    font-size: 0.9rem;
}

.loading {
    text-align: center;
    padding: 2rem;
    color: #666;
}

/* ============================================
   Execution History Panel
   ============================================ */

.execution-panel {
    display: none;
    border-top: 1px solid #eee;
    background: #f8f9fa;
    padding: 0.75rem 1.25rem;
}

.deployment-item.expanded .execution-panel {
    display: block;
}

.execution-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
}

.execution-table th {
    text-align: left;
    padding: 0.35rem 0.5rem;
    color: #666;
    font-weight: 500;
    border-bottom: 1px solid #ddd;
}

.execution-table td {
    padding: 0.35rem 0.5rem;
    border-bottom: 1px solid #eee;
}

.execution-table .status-success { color: #2e7d32; }
.execution-table .status-partial { color: #e65100; }
.execution-table .status-failed { color: #c62828; }

.execution-empty {
    padding: 1rem;
    text-align: center;
    color: #999;
    font-size: 0.85rem;
}

.execution-loading {
    padding: 0.75rem;
    text-align: center;
    color: #999;
    font-size: 0.85rem;
}

/* ============================================
   Dark Theme
   ============================================ */

html.dark-theme .deployment-item {
    background: rgba(15, 15, 35, 0.85);
    border-color: rgba(124, 255, 220, 0.15);
}

html.dark-theme .deployment-item:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,0.3);
}

html.dark-theme .deployment-item.error-state {
    border-color: rgba(231, 76, 60, 0.5);
}

html.dark-theme .deployment-item.deploying-state {
    border-color: rgba(63, 81, 181, 0.5);
}

html.dark-theme .deployment-name {
    color: #e0e0e0;
}

html.dark-theme .deployment-trigger {
    color: #aaa;
}

html.dark-theme .deployment-meta {
    color: #999;
}

html.dark-theme .deployment-description {
    color: #777;
}

html.dark-theme .deployment-actions {
    border-left-color: rgba(124, 255, 220, 0.1);
}

html.dark-theme .deploy-error-banner {
    background: rgba(231, 76, 60, 0.1);
    border-color: rgba(231, 76, 60, 0.3);
    color: #fca5a5;
}

html.dark-theme .execution-panel {
    background: #16213e;
    border-color: #2a3a55;
}

html.dark-theme .execution-table th {
    color: #aaa;
    border-color: #2a3a55;
}

html.dark-theme .execution-table td {
    border-color: #1f2940;
}

html.dark-theme .execution-table .status-success { color: #9ae6b4; }
html.dark-theme .execution-table .status-partial { color: #fbd38d; }
html.dark-theme .execution-table .status-failed { color: #fca5a5; }

/* Disabled circle-btn for deployments */
.circle-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
}
.circle-btn:disabled:hover {
    transform: none;
}
