/**
 * Cloud Server Config Page — Command Center UI
 * Design: Dark Tech · Sharp Geometry · Animated States
 * Follows DHD Cloud design system tokens
 */

/* =====================================================
   1. HERO SECTION
   ===================================================== */
.vps-hero {
    position: relative;
    background: var(--color-bg-dark);
    padding: 72px 0 56px;
    overflow: hidden;
}

/* Subtle dot-grid background */
.vps-hero__bg-grid {
    position: absolute;
    inset: 0;
    background-image:
        radial-gradient(circle, rgba(37, 99, 235, 0.18) 1px, transparent 1px);
    background-size: 32px 32px;
    pointer-events: none;
    mask-image: radial-gradient(ellipse 80% 80% at 50% 50%, black 40%, transparent 100%);
    -webkit-mask-image: radial-gradient(ellipse 80% 80% at 50% 50%, black 40%, transparent 100%);
}

.vps-hero__content {
    position: relative;
    z-index: 1;
}

/* Badge pill */
.vps-hero__badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border: 1px solid rgba(37, 99, 235, 0.5);
    border-radius: 999px;
    font-size: var(--text-xs);
    font-weight: var(--fw-semibold);
    color: var(--color-secondary);
    background: rgba(37, 99, 235, 0.08);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    margin-bottom: 20px;
}

.vps-hero__title {
    font-size: clamp(2rem, 4vw, 2.75rem);
    font-weight: var(--fw-bold);
    color: #fff;
    margin-bottom: 12px;
    line-height: 1.2;
}

.vps-hero__title-accent {
    color: var(--color-primary);
}

.vps-hero__subtitle {
    font-size: var(--text-base);
    color: rgba(255, 255, 255, 0.55);
    max-width: 540px;
    margin: 0 auto 36px;
    line-height: 1.7;
}

/* Step progress indicator */
.vps-steps {
    display: inline-flex;
    align-items: center;
    gap: 0;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 10px 20px;
}

.vps-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 0 12px;
    transition: all var(--transition-base);
}

.vps-step__dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    border: 1.5px solid rgba(255, 255, 255, 0.25);
    transition: all var(--transition-base);
}

.vps-step.vps-step--done .vps-step__dot {
    background: var(--color-primary);
    border-color: var(--color-primary);
    box-shadow: 0 0 8px rgba(37, 99, 235, 0.5);
}

.vps-step__label {
    font-size: 10px;
    font-weight: var(--fw-semibold);
    color: rgba(255, 255, 255, 0.35);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    transition: color var(--transition-base);
}

.vps-step.vps-step--done .vps-step__label {
    color: var(--color-secondary);
}

.vps-step__line {
    width: 24px;
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
    align-self: flex-start;
    margin-top: 4px;
}

/* =====================================================
   2. BUILDER LAYOUT
   ===================================================== */
.vps-builder {
    padding: 48px 0 80px;
    background: var(--color-bg-alt);
}

.vps-builder__grid {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 28px;
    align-items: start;
}

.vps-builder__right {
    position: sticky;
    top: calc(var(--navbar-height) + 20px);
}

/* =====================================================
   3. CONFIG PANELS
   ===================================================== */
.vps-panel {
    background: var(--color-bg-white);
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius-xl);
    overflow: hidden;
    margin-bottom: 20px;

    /* Reveal animation */
    opacity: 0;
    transform: translateY(16px);
    transition: opacity 0.45s ease, transform 0.45s ease;
}

.vps-panel--visible {
    opacity: 1;
    transform: translateY(0);
}

/* Stagger each panel */
.vps-panel:nth-child(1) { transition-delay: 0ms; }
.vps-panel:nth-child(2) { transition-delay: 60ms; }
.vps-panel:nth-child(3) { transition-delay: 120ms; }
.vps-panel:nth-child(4) { transition-delay: 180ms; }
.vps-panel:nth-child(5) { transition-delay: 240ms; }

.vps-panel__header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 20px;
    border-bottom: 1px solid var(--color-border);
    background: var(--color-bg);
}

.vps-panel__icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-primary-light);
    border-radius: 8px;
    color: var(--color-primary);
    flex-shrink: 0;
}

.vps-panel__title {
    font-size: var(--text-sm);
    font-weight: var(--fw-semibold);
    color: var(--color-text);
    margin: 0;
    flex: 1;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.vps-panel__status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: var(--text-xs);
    color: var(--color-text-light);
    transition: color var(--transition-base);
}

.vps-panel__status--done .vps-panel__status-text {
    color: var(--color-primary);
    font-weight: var(--fw-medium);
}

.vps-panel__status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--color-border-hover);
    transition: background var(--transition-base);
}

/* =====================================================
   4. COMPONENT CARDS (CLICK-TO-SELECT)
   ===================================================== */
.vps-component-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 10px;
    padding: 16px;
}

.vps-card {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 12px 14px;
    border: 1.5px solid var(--color-border);
    border-radius: var(--border-radius-lg);
    background: var(--color-bg-white);
    cursor: pointer;
    text-align: left;
    transition: border-color 0.18s ease, background 0.18s ease, transform 0.15s ease, box-shadow 0.18s ease;
    overflow: hidden;
}

.vps-card:hover {
    border-color: var(--color-primary);
    background: var(--color-primary-light);
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(37, 99, 235, 0.12);
}

.vps-card:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

/* Selected state */
.vps-card--active {
    border-color: var(--color-primary);
    background: var(--color-primary-light);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12), inset 0 0 0 1px var(--color-primary);
}

.vps-card--active .vps-card__name {
    color: var(--color-primary);
}

/* Check icon (hidden by default, shown on active) */
.vps-card__check {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--color-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    opacity: 0;
    transform: scale(0.5);
    transition: opacity 0.2s ease, transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.vps-card--active .vps-card__check {
    opacity: 1;
    transform: scale(1);
}

.vps-card__name {
    font-size: var(--text-sm);
    font-weight: var(--fw-semibold);
    color: var(--color-text);
    transition: color var(--transition-fast);
    padding-right: 20px; /* space for check icon */
}

.vps-card__desc {
    font-size: 11px;
    color: var(--color-text-light);
    line-height: 1.4;
}

.vps-card__price {
    font-size: var(--text-xs);
    font-weight: var(--fw-bold);
    color: var(--color-text-muted);
    margin-top: 6px;
}

.vps-card__price-free {
    color: var(--color-success);
}

.vps-card__price-unit {
    font-weight: var(--fw-regular);
    color: var(--color-text-light);
}

/* =====================================================
   5. COMMAND PANEL (STICKY RIGHT)
   ===================================================== */
.vps-command {
    background: var(--color-bg-dark);
    border-radius: var(--border-radius-xl);
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.07);
}

/* Header: total price */
.vps-command__header {
    padding: 24px 24px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    text-align: center;
}

.vps-command__label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: var(--text-xs);
    font-weight: var(--fw-semibold);
    color: rgba(255, 255, 255, 0.40);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 8px;
}

.vps-command__price {
    font-size: 2.5rem;
    font-weight: var(--fw-bold);
    color: #fff;
    letter-spacing: -1px;
    line-height: 1;
    font-variant-numeric: tabular-nums;
    transition: color var(--transition-base);
}

.vps-command__cycle-label {
    font-size: var(--text-xs);
    color: rgba(255, 255, 255, 0.30);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-top: 4px;
}

/* Billing tabs */
.vps-command__billing {
    padding: 16px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.vps-command__billing-label {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.35);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    display: block;
    margin-bottom: 8px;
}

.vps-billing-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
}

.vps-billing-tab {
    padding: 7px 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.04);
    color: rgba(255, 255, 255, 0.45);
    font-size: 11px;
    font-weight: var(--fw-medium);
    cursor: pointer;
    transition: all 0.15s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    line-height: 1.3;
}

.vps-billing-tab:hover {
    border-color: rgba(255, 255, 255, 0.25);
    color: rgba(255, 255, 255, 0.75);
    background: rgba(255, 255, 255, 0.07);
}

.vps-billing-tab--active {
    border-color: var(--color-primary);
    background: rgba(37, 99, 235, 0.15);
    color: #fff;
}

.vps-billing-tab__discount {
    font-size: 10px;
    color: #22c55e;
    font-weight: var(--fw-bold);
}

.vps-billing-tab--active .vps-billing-tab__discount {
    color: #4ade80;
}

/* Spec breakdown */
.vps-command__specs {
    padding: 16px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.vps-command__specs-title {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.35);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 10px;
}

.vps-spec-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.vps-spec-empty {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: var(--text-xs);
    color: rgba(255, 255, 255, 0.25);
    padding: 8px 0;
}

.vps-spec-item {
    display: flex;
    align-items: center;
    gap: 8px;
    animation: specSlideIn 0.2s ease;
}

@keyframes specSlideIn {
    from { opacity: 0; transform: translateX(-6px); }
    to   { opacity: 1; transform: translateX(0); }
}

.vps-spec-item__badge {
    font-size: 10px;
    font-weight: var(--fw-bold);
    padding: 2px 6px;
    border-radius: 4px;
    background: rgba(37, 99, 235, 0.2);
    color: var(--color-secondary);
    flex-shrink: 0;
    letter-spacing: 0.04em;
    min-width: 30px;
    text-align: center;
}

.vps-spec-item__name {
    font-size: var(--text-xs);
    color: rgba(255, 255, 255, 0.65);
    flex: 1;
}

.vps-spec-item__price {
    font-size: var(--text-xs);
    font-weight: var(--fw-semibold);
    color: #fff;
    font-variant-numeric: tabular-nums;
}

/* Progress */
.vps-command__progress {
    padding: 14px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.vps-command__progress-header {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.35);
    margin-bottom: 8px;
}

.vps-progress-bar {
    height: 4px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 2px;
    overflow: hidden;
}

.vps-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--color-primary), var(--color-secondary));
    border-radius: 2px;
    width: 0%;
    transition: width 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

/* System info */
.vps-command__info {
    padding: 12px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.vps-command__info-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.30);
    padding: 3px 0;
}

/* CTA Button */
.vps-command__cta {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 16px;
    border: none;
    border-radius: 0;
    background: rgba(37, 99, 235, 0.25);
    color: rgba(255, 255, 255, 0.40);
    font-size: var(--text-sm);
    font-weight: var(--fw-semibold);
    font-family: var(--font-body);
    cursor: not-allowed;
    transition: all 0.2s ease;
    letter-spacing: 0.02em;
}

.vps-command__cta--ready {
    background: var(--color-primary);
    color: #fff;
    cursor: pointer;
}

.vps-command__cta--ready:hover {
    background: var(--color-primary-hover);
    transform: none;
}

.vps-command__cta:focus-visible {
    outline: 2px solid var(--color-secondary);
    outline-offset: -2px;
}

/* =====================================================
   6. RESPONSIVE
   ===================================================== */
@media (max-width: 991.98px) {
    .vps-builder__grid {
        grid-template-columns: 1fr;
    }

    .vps-builder__right {
        position: static;
        order: -1; /* Price panel on top on mobile */
    }

    .vps-command {
        display: grid;
        grid-template-columns: 1fr 1fr;
    }

    .vps-command__header {
        grid-column: span 2;
    }

    .vps-command__cta {
        grid-column: span 2;
    }
}

@media (max-width: 767.98px) {
    .vps-hero {
        padding: 56px 0 40px;
    }

    .vps-steps {
        padding: 8px 12px;
        flex-wrap: wrap;
        gap: 6px;
    }

    .vps-step__line {
        display: none;
    }

    .vps-component-grid {
        grid-template-columns: repeat(2, 1fr);
        padding: 12px;
        gap: 8px;
    }

    .vps-command {
        display: block;
    }

    .vps-billing-tabs {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 480px) {
    .vps-component-grid {
        grid-template-columns: 1fr 1fr;
    }

    .vps-billing-tabs {
        grid-template-columns: 1fr 1fr;
    }
}

/* =====================================================
   7. REDUCED MOTION
   ===================================================== */
@media (prefers-reduced-motion: reduce) {
    .vps-panel {
        opacity: 1 !important;
        transform: none !important;
        transition: none !important;
    }

    .vps-card {
        transition: border-color 0.01s, background 0.01s !important;
    }

    .vps-card__check {
        transition: opacity 0.01s !important;
    }

    .vps-progress-fill {
        transition: width 0.01s !important;
    }
}
