/**
 * GKS Containers Page Styles
 * Glassmorphism design with container cards
 */

/* ===== Page Layout ===== */
.containers-page {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: var(--spacing-xl);
}

/* ===== Hero Section ===== */
.containers-hero {
    background: linear-gradient(135deg, #0ea5e9 0%, #6366f1 50%, #8b5cf6 100%);
    border-radius: var(--radius-xl);
    padding: var(--spacing-2xl);
    margin-bottom: var(--spacing-xl);
    text-align: center;
    position: relative;
    overflow: hidden;
}

.containers-hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at 30% 20%, rgba(255, 255, 255, 0.2) 0%, transparent 50%),
        radial-gradient(circle at 70% 80%, rgba(255, 255, 255, 0.1) 0%, transparent 40%);
    pointer-events: none;
}

.containers-hero .hero-content {
    position: relative;
    z-index: 1;
}

.containers-hero .hero-icon {
    margin-bottom: var(--spacing-md);
    color: rgba(255, 255, 255, 0.95);
}

.containers-hero .hero-title {
    font-size: 2.5rem;
    font-weight: 700;
    color: #fff;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    margin-bottom: var(--spacing-sm);
}

.containers-hero .hero-subtitle {
    font-size: 1.1rem;
    color: rgba(255, 255, 255, 0.9);
}

/* ===== Stats Section ===== */
.containers-stats {
    margin-bottom: var(--spacing-xl);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--spacing-lg);
}

.stat-card {
    background: linear-gradient(135deg,
            rgba(30, 30, 40, 0.8) 0%,
            rgba(20, 20, 30, 0.9) 100%);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    position: relative;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.stat-card.running::before {
    background: linear-gradient(90deg, #10b981, #34d399);
}

.stat-card.stopped::before {
    background: linear-gradient(90deg, #ef4444, #f87171);
}

.stat-card.total::before {
    background: linear-gradient(90deg, #0ea5e9, #38bdf8);
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

.stat-icon {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-card.running .stat-icon {
    background: rgba(16, 185, 129, 0.2);
    color: #10b981;
}

.stat-card.stopped .stat-icon {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

.stat-card.total .stat-icon {
    background: rgba(14, 165, 233, 0.2);
    color: #0ea5e9;
}

.stat-info {
    display: flex;
    flex-direction: column;
}

.stat-number {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
}

.stat-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* Light theme stats */
[data-theme="light"] .stat-card {
    background: linear-gradient(135deg,
            rgba(255, 255, 255, 0.95) 0%,
            rgba(250, 250, 250, 0.95) 100%);
    border-color: rgba(0, 0, 0, 0.1);
}

/* ===== Containers Grid ===== */
.containers-grid-container {
    width: 100%;
}

.containers-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: var(--spacing-lg);
}

/* ===== Container Card ===== */
.container-card {
    background: linear-gradient(135deg,
            rgba(30, 30, 40, 0.85) 0%,
            rgba(20, 20, 30, 0.95) 100%);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    position: relative;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
    animation: cardFadeIn 0.5s ease-out both;
    animation-delay: var(--anim-delay, 0s);
}

@keyframes cardFadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Glass reflection */
.container-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 50%;
    background: linear-gradient(180deg,
            rgba(255, 255, 255, 0.05) 0%,
            transparent 100%);
    pointer-events: none;
}

/* Status border glow */
.container-card.running {
    border-color: rgba(16, 185, 129, 0.3);
}

.container-card.running:hover {
    border-color: rgba(16, 185, 129, 0.5);
    box-shadow: 0 20px 40px rgba(16, 185, 129, 0.15),
        0 0 30px rgba(16, 185, 129, 0.1);
}

.container-card.stopped {
    border-color: rgba(239, 68, 68, 0.3);
}

.container-card.stopped:hover {
    border-color: rgba(239, 68, 68, 0.5);
    box-shadow: 0 20px 40px rgba(239, 68, 68, 0.15),
        0 0 30px rgba(239, 68, 68, 0.1);
}

.container-card.paused {
    border-color: rgba(251, 191, 36, 0.3);
}

.container-card.paused:hover {
    border-color: rgba(251, 191, 36, 0.5);
    box-shadow: 0 20px 40px rgba(251, 191, 36, 0.15),
        0 0 30px rgba(251, 191, 36, 0.1);
}

.container-card:hover {
    transform: translateY(-6px);
}

/* Card Header */
.card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: var(--spacing-md);
}

.container-info {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

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

.status-dot.running {
    background: #10b981;
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.6);
    animation: pulseGreen 2s ease-in-out infinite;
}

@keyframes pulseGreen {

    0%,
    100% {
        box-shadow: 0 0 10px rgba(16, 185, 129, 0.6);
    }

    50% {
        box-shadow: 0 0 20px rgba(16, 185, 129, 0.9);
    }
}

.status-dot.stopped {
    background: #ef4444;
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.6);
}

.status-dot.paused {
    background: #fbbf24;
    box-shadow: 0 0 10px rgba(251, 191, 36, 0.6);
    animation: pulseYellow 2s ease-in-out infinite;
}

@keyframes pulseYellow {

    0%,
    100% {
        box-shadow: 0 0 10px rgba(251, 191, 36, 0.6);
    }

    50% {
        box-shadow: 0 0 20px rgba(251, 191, 36, 0.9);
    }
}

.container-name {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
    word-break: break-word;
}

/* Expandable name wrapper */
.name-wrapper {
    display: flex;
    align-items: center;
    gap: 6px;
    max-width: 200px;
}

.name-wrapper.truncated .container-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 160px;
}

.name-wrapper.expanded .container-name {
    white-space: normal;
    overflow: visible;
    max-width: none;
}

.expand-name-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 50%;
    cursor: pointer;
    flex-shrink: 0;
    color: var(--text-secondary);
    transition: all 0.2s ease;
}

.expand-name-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: var(--text-primary);
}

.name-wrapper.expanded .expand-name-btn svg {
    transform: rotate(180deg);
}

[data-theme="light"] .expand-name-btn {
    background: rgba(0, 0, 0, 0.05);
    border-color: rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .expand-name-btn:hover {
    background: rgba(0, 0, 0, 0.1);
}

.status-badge {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-badge.running {
    background: rgba(16, 185, 129, 0.2);
    color: #10b981;
}

.status-badge.stopped {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

.status-badge.paused {
    background: rgba(251, 191, 36, 0.2);
    color: #fbbf24;
}

/* Card Body */
.card-body {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.info-row:last-child {
    border-bottom: none;
}

.info-label {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.info-value {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-family: 'SF Mono', 'Monaco', 'Consolas', monospace;
    text-align: right;
    word-break: break-all;
}

.info-value.tag {
    background: rgba(139, 92, 246, 0.2);
    color: #a78bfa;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
}

.info-value.ports {
    color: #0ea5e9;
    font-size: 0.85rem;
}

.info-value.status {
    font-family: inherit;
    font-size: 0.85rem;
}

/* Light Theme Card */
[data-theme="light"] .container-card {
    background: linear-gradient(135deg,
            rgba(255, 255, 255, 0.95) 0%,
            rgba(250, 250, 250, 0.98) 100%);
    border-color: rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .container-card::before {
    background: linear-gradient(180deg,
            rgba(255, 255, 255, 0.8) 0%,
            transparent 100%);
}

[data-theme="light"] .info-row {
    border-bottom-color: rgba(0, 0, 0, 0.05);
}

/* ===== Error & Empty States ===== */
.containers-error-state,
.containers-empty-state {
    text-align: center;
    padding: var(--spacing-2xl);
    color: var(--text-muted);
}

.containers-error-state svg,
.containers-empty-state svg {
    margin-bottom: var(--spacing-md);
    opacity: 0.5;
}

.containers-error-state h3,
.containers-empty-state h3 {
    color: var(--text-secondary);
    margin-bottom: var(--spacing-sm);
}

.retry-btn {
    margin-top: var(--spacing-md);
    padding: var(--spacing-sm) var(--spacing-lg);
    background: var(--accent-primary);
    color: var(--bg-primary);
    border: none;
    border-radius: var(--radius-md);
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.retry-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow);
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: var(--spacing-sm);
    }

    .stat-card {
        flex-direction: column;
        text-align: center;
        padding: var(--spacing-md);
    }

    .stat-icon {
        width: 44px;
        height: 44px;
    }

    .stat-number {
        font-size: 1.5rem;
    }

    .containers-hero .hero-title {
        font-size: 1.8rem;
    }

    .containers-cards-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .containers-page {
        padding: var(--spacing-md);
    }

    .containers-hero {
        padding: var(--spacing-xl);
    }

    .containers-hero .hero-icon svg {
        width: 48px;
        height: 48px;
    }
}

/* ===== Containers Button Style ===== */
.containers-btn {
    color: #0ea5e9;
    border-color: rgba(14, 165, 233, 0.3);
}

.containers-btn:hover {
    background: rgba(14, 165, 233, 0.1);
    border-color: #0ea5e9;
    box-shadow: 0 0 15px rgba(14, 165, 233, 0.3);
}

/* Home button style */
.home-btn {
    color: var(--text-secondary);
    border-color: var(--border-color);
}

.home-btn:hover {
    color: var(--text-primary);
    background: var(--bg-tertiary);
}