/* ============================================
   S21 Server Configurator — Styles
   ============================================ */

:root {
    --bg-body: #f0f2f5;
    --bg-card: #ffffff;
    --bg-card-hover: #f8f9fb;
    --bg-selected: #eef1ff;
    --bg-surface: #f5f6f8;
    --border: #dfe3e8;
    --border-selected: #6366f1;
    --border-hover: #c1c7d0;
    --text-primary: #1a1d23;
    --text-secondary: #5a6170;
    --text-muted: #8c95a4;
    --accent: #6366f1;
    --accent-glow: rgba(99, 102, 241, 0.1);
    --accent-green: #16a34a;
    --accent-amber: #d97706;
    --accent-red: #dc2626;
    --price-color: #6366f1;
    --total-color: #7c3aed;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
    --grid-color: rgba(0, 0, 0, 0.04);
}

*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--bg-body);
    background-image:
        linear-gradient(var(--grid-color) 1px, transparent 1px),
        linear-gradient(90deg, var(--grid-color) 1px, transparent 1px);
    background-size: 24px 24px;
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* Header */
.header {
    background: linear-gradient(135deg, #1e293b 0%, #312e81 100%);
    border-bottom: 1px solid var(--border);
    padding: 28px 32px;
}
.header-inner {
    max-width: 1400px;
    margin: 0 auto;
}
.header-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
}
.header-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
    margin-top: 8px;
}
.header-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 10px;
}
.model-switcher {
    display: flex;
    gap: 4px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
    padding: 3px;
}
.model-tab {
    padding: 6px 18px;
    font-size: 13px;
    font-weight: 700;
    font-family: inherit;
    color: rgba(255, 255, 255, 0.55);
    background: transparent;
    border: none;
    border-radius: 7px;
    cursor: pointer;
    transition: all 0.18s;
    letter-spacing: 0.5px;
}
.model-tab:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
}
.model-tab.active {
    color: #fff;
    background: rgba(255, 255, 255, 0.18);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
}
.header-btn {
    display: inline-block;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    color: #e0e7ff;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
    text-decoration: none;
}
.header-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.35);
}
.header-btn-reset {
    color: #fca5a5;
    border-color: rgba(252, 165, 165, 0.3);
}
.header-btn-reset:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.4);
}

/* Modal */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    z-index: 1000;
    justify-content: center;
    align-items: flex-start;
    padding: 40px 20px;
    overflow-y: auto;
}
.modal-overlay.active {
    display: flex;
}
.modal-box {
    background: #fff;
    border-radius: 16px;
    width: 100%;
    max-width: 640px;
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.15);
    animation: modal-in 0.2s ease;
}
.modal-box.modal-wide {
    max-width: 860px;
}
@keyframes modal-in {
    from {
        opacity: 0;
        transform: translateY(16px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
}
.modal-header h2 {
    font-size: 18px;
    font-weight: 700;
}
.modal-close {
    width: 32px;
    height: 32px;
    font-size: 16px;
    border: none;
    background: var(--bg-surface);
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    transition: background 0.15s;
}
.modal-close:hover {
    background: var(--border);
}
.modal-body {
    padding: 20px 24px;
    font-size: 14px;
    line-height: 1.7;
    color: var(--text-primary);
    max-height: 70vh;
    overflow-y: auto;
}
.modal-body h3 {
    font-size: 14px;
    font-weight: 700;
    margin-top: 20px;
    margin-bottom: 8px;
    color: var(--accent);
}
.modal-body h3:first-child {
    margin-top: 0;
}
.modal-body ul {
    margin-left: 18px;
    margin-bottom: 8px;
}
.modal-body li {
    margin-bottom: 4px;
    font-size: 13px;
}
.modal-body pre {
    background: var(--bg-surface);
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 12px;
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-all;
    margin-bottom: 8px;
}
.modal-body table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
    margin-bottom: 12px;
}
.modal-body th, .modal-body td {
    padding: 6px 10px;
    border: 1px solid var(--border);
    text-align: left;
}
.modal-body th {
    background: var(--bg-surface);
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.modal-body td {
    font-variant-numeric: tabular-nums;
}
.logo {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}
.logo-icon {
    font-size: 24px;
    color: var(--accent);
}
.logo-text {
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: #c7d2fe;
}
.header-title {
    font-size: 28px;
    font-weight: 800;
    color: #ffffff;
}
.header-sub {
    font-size: 14px;
    color: #a5b4fc;
    margin-top: 4px;
}

/* Main Layout */
.main-layout {
    max-width: 1400px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr 360px;
    gap: 0;
    min-height: calc(100vh - 130px);
}

/* Configurator */
.configurator {
    padding: 24px 32px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Config Section */
.config-section {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px 24px;
    transition: border-color 0.2s, box-shadow 0.2s;
    box-shadow: var(--shadow);
}
.config-section:hover {
    border-color: var(--border-hover);
}

.section-header {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 16px;
}
.section-number {
    font-size: 11px;
    font-weight: 700;
    color: var(--accent);
    background: var(--accent-glow);
    padding: 4px 8px;
    border-radius: 6px;
    letter-spacing: 1px;
    min-width: 30px;
    text-align: center;
    flex-shrink: 0;
    margin-top: 2px;
}
.section-title {
    font-size: 16px;
    font-weight: 700;
}
.section-desc {
    font-size: 12px;
    margin-top: 4px;
}
.constraint-tag {
    display: inline-block;
    font-size: 11px;
    font-weight: 500;
    color: #92710a;
    background: rgba(253, 224, 71, 0.18);
    border: 1px solid rgba(234, 179, 8, 0.25);
    padding: 2px 10px;
    border-radius: 20px;
    letter-spacing: 0.3px;
}
.reset-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: -8px;
}
.reset-row .model-switcher {
    background: rgba(0, 0, 0, 0.06);
    border-radius: 10px;
    padding: 3px;
}
.reset-row .model-tab {
    color: var(--text-secondary);
    font-size: 12px;
    padding: 5px 14px;
}
.reset-row .model-tab:hover {
    color: var(--text-primary);
    background: rgba(0, 0, 0, 0.06);
}
.reset-row .model-tab.active {
    color: var(--text-primary);
    background: #fff;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
}

.reset-btn {
    padding: 5px 14px;
    font-size: 12px;
    font-weight: 600;
    font-family: inherit;
    color: var(--accent-red);
    background: rgba(239, 68, 68, 0.06);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s;
}
.reset-btn:hover {
    background: rgba(239, 68, 68, 0.12);
    border-color: rgba(239, 68, 68, 0.35);
}
.section-price {
    margin-left: auto;
    font-size: 18px;
    font-weight: 700;
    color: var(--price-color);
    white-space: nowrap;
    flex-shrink: 0;
    font-variant-numeric: tabular-nums;
}

/* Option Cards (Radio) */
.options-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}
.option-card {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: var(--bg-surface);
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.15s ease;
}
.option-card:hover {
    border-color: var(--border-hover);
    background: var(--bg-card-hover);
}
.option-card.selected {
    border-color: var(--border-selected);
    background: var(--bg-selected);
    box-shadow: 0 0 0 1px var(--border-selected);
}
.option-card input[type="radio"] {
    display: none;
}
.option-content h3 {
    font-size: 14px;
    font-weight: 600;
}
.option-spec {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}
.option-price {
    font-size: 13px;
    color: var(--price-color);
    font-weight: 600;
    margin-top: 4px;
}
.option-badge {
    font-size: 10px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 4px;
    background: rgba(99, 102, 241, 0.15);
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: inline-block;
    margin-bottom: 4px;
}
.option-badge.badge-pro {
    background: rgba(245, 158, 11, 0.15);
    color: var(--accent-amber);
}
.check-indicator {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid var(--border);
    flex-shrink: 0;
    margin-left: auto;
    position: relative;
    transition: all 0.15s;
}
.option-card.selected .check-indicator {
    border-color: var(--accent);
    background: var(--accent);
}
.cpu-option.selected .check-indicator::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: white;
}

/* CPU List */
.cpu-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.cpu-option {
    display: flex;
    align-items: center;
    padding: 10px 14px;
    background: var(--bg-surface);
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.15s;
    gap: 12px;
}
.cpu-option:hover {
    border-color: var(--border-hover);
    background: var(--bg-card-hover);
}
.cpu-option.selected {
    border-color: var(--border-selected);
    background: var(--bg-selected);
    box-shadow: 0 0 0 1px var(--border-selected);
}
.cpu-name {
    font-size: 13px;
    font-weight: 600;
    flex: 1;
}
.cpu-specs {
    font-size: 11px;
    color: var(--text-muted);
    min-width: 120px;
}
.cpu-price {
    font-size: 14px;
    font-weight: 700;
    color: #4b5563;
    min-width: 100px;
    text-align: right;
    font-variant-numeric: tabular-nums;
}
.cpu-check {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid var(--border);
    flex-shrink: 0;
    position: relative;
    transition: all 0.15s;
}
.cpu-option.selected .cpu-check {
    border-color: var(--accent);
    background: var(--accent);
}
.cpu-option.selected .cpu-check::after {
    content: "";
    position: absolute;
    top: 2px;
    left: 2px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: white;
}

/* Auto Section */
.auto-section {
    opacity: 0.8;
}
.auto-info {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: var(--bg-surface);
    border-radius: var(--radius-sm);
    font-size: 13px;
    color: var(--text-secondary);
}

/* Quantity Row */
.qty-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}
.qty-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
}
.qty-select {
    appearance: none;
    background: var(--bg-surface);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 6px 32px 6px 12px;
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%2394a3b8'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    transition: border-color 0.15s;
}
.qty-select:hover {
    border-color: var(--border-hover);
}
.qty-select:focus {
    outline: none;
    border-color: var(--accent);
}
.qty-hint {
    font-size: 11px;
    color: var(--text-muted);
}

/* Storage / NIC rows */
.storage-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.storage-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}
.storage-info h3 {
    font-size: 13px;
    font-weight: 600;
}
.storage-info .option-spec {
    margin-top: 1px;
}
.storage-total-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    background: rgba(99, 102, 241, 0.06);
    font-size: 12px;
    color: var(--text-secondary);
}
.storage-total-bar strong {
    color: var(--text-primary);
}
.storage-kit-note {
    font-size: 11px;
    color: var(--accent-amber);
}
.nic-min-note {
    font-size: 11px;
    color: var(--accent-green);
}
.nic-min-note.error {
    color: var(--accent-red);
}

/* Summary Panel */
.summary-panel {
    border-left: 1px solid rgba(99, 102, 241, 0.15);
    background: linear-gradient(180deg, #f5f3ff 0%, #eef2ff 100%);
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}
.summary-inner {
    padding: 24px 20px;
}
.summary-title {
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 16px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
}
.summary-items {
    display: flex;
    flex-direction: column;
    gap: 0;
}
.summary-item {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 8px;
    padding: 10px 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}
.summary-item:last-child {
    border-bottom: none;
}
.summary-item-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.5;
}
.summary-item-detail {
    font-size: 11px;
    color: var(--text-muted);
}
.summary-item-price {
    font-size: 13px;
    font-weight: 600;
    color: var(--price-color);
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}
.summary-divider {
    height: 1px;
    background: var(--border);
    margin: 16px 0;
}
.summary-total-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
}
.summary-total-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
}
.summary-total-price {
    font-size: 28px;
    font-weight: 800;
    color: var(--total-color);
    font-variant-numeric: tabular-nums;
    transition: transform 0.15s;
}
.summary-total-price.bump {
    transform: scale(1.06);
}
.summary-tax-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 6px;
}
.summary-tax-label {
    font-size: 12px;
    color: var(--text-muted);
}
.summary-tax-price {
    font-size: 14px;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}
.summary-grand-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}
.summary-grand-label {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
}
.summary-grand-price {
    font-size: 28px;
    font-weight: 800;
    color: var(--total-color);
    font-variant-numeric: tabular-nums;
    transition: transform 0.15s;
}
.summary-grand-price.bump {
    transform: scale(1.06);
}
.summary-note {
    font-size: 10px;
    color: var(--text-muted);
    margin-top: 8px;
    text-align: right;
}

/* Validation error pulse */
.config-section.has-error {
    border-color: var(--accent-red);
    animation: pulse-error 0.4s ease;
}
@keyframes pulse-error {
    0%, 100% {
        box-shadow: none;
    }
    50% {
        box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.15);
    }
}

/* Responsive */
@media (max-width: 900px) {
    .main-layout {
        grid-template-columns: 1fr;
    }
    .summary-panel {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        height: auto;
        border-left: none;
        border-top: 1px solid var(--border);
        z-index: 100;
        box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.1);
    }
    .summary-inner {
        padding: 16px 20px;
    }
    .summary-items {
        display: none;
    }
    .summary-divider {
        display: none;
    }
    .summary-title {
        display: none;
    }
    .summary-total-row {
        align-items: center;
    }
    .configurator {
        padding: 16px;
        padding-bottom: 100px;
    }
    .header {
        padding: 20px 16px;
    }
    .header-title {
        font-size: 22px;
    }
    .options-grid {
        grid-template-columns: 1fr;
    }
}

/* Mobile Notice Overlay */
.mobile-notice {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: linear-gradient(135deg, #1e293b 0%, #312e81 100%);
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 32px;
}
.mobile-notice-inner {
    max-width: 320px;
}
.mobile-notice-icon {
    font-size: 48px;
    display: block;
    margin-bottom: 20px;
}
.mobile-notice h2 {
    color: #fff;
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 12px;
}
.mobile-notice p {
    color: #a5b4fc;
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 24px;
}
.mobile-notice-link {
    display: inline-block;
    padding: 12px 24px;
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 10px;
    text-decoration: none;
    transition: background 0.15s;
}
.mobile-notice-link:hover {
    background: rgba(255, 255, 255, 0.25);
}
@media (max-width: 768px) {
    .mobile-notice {
        display: flex;
    }
    .app {
        display: none;
    }
}
