/* ============================================
   ProGen CSS - Xalok Design System
   ============================================ */

:root {
    --color-bg-from: #2c3e50;
    --color-bg-to: #009fe3;
    --color-primary: #009fe0;
    --color-primary-hover: #0088c0;
    --color-success: #6CBD6F;
    --color-neutral: #D1D5DB;
    --color-neutral-hover: #b0b7bf;
    --color-error: #e53e3e;
    --color-text: #1a202c;
    --color-text-muted: #718096;
    --color-white: #ffffff;
    --color-accent-yellow: #c8d400;

    --space-xs: 0.5rem;
    --space-sm: 0.75rem;
    --space-md: 1rem;
    --space-lg: 1.25rem;
    --space-xl: 1.5rem;
    --space-2xl: 2.5rem;

    --radius-sm: 0.5rem;
    --radius-md: 0.75rem;
    --radius-lg: 1rem;
    --radius-xl: 1.5rem;
}

/* ============================================
   Base
   ============================================ */

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

html {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 16px;
    line-height: 1.5;
    color: var(--color-text);
}

body {
    background: linear-gradient(135deg, var(--color-bg-from), var(--color-bg-to));
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-md);
    position: relative;
    overflow-x: hidden;
}

/* ============================================
   Background Decoration
   ============================================ */

#bg-decoration {
    position: fixed;
    top: -100px;
    right: -50px;
    width: 400px;
    height: 400px;
    z-index: 0;
    pointer-events: none;
}

#bg-decoration::before {
    content: '';
    position: absolute;
    width: 250px;
    height: 250px;
    background: rgba(255, 255, 255, 0.1);
    transform: rotate(-15deg);
    top: 50px;
    right: 50px;
}

#bg-decoration::after {
    content: '';
    position: absolute;
    width: 120px;
    height: 120px;
    background: var(--color-accent-yellow);
    opacity: 0.15;
    top: 80px;
    right: 100px;
}

@media (max-width: 768px) {
    #bg-decoration {
        display: none;
    }
}

/* ============================================
   Main Layout
   ============================================ */

.main-wrapper {
    position: relative;
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-xl);
}

.logo {
    margin-left: 46px;
}

.dev-badge {
    position: fixed;
    top: var(--space-md);
    right: var(--space-md);
    background: var(--color-error);
    color: var(--color-white);
    padding: var(--space-xs) var(--space-sm);
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    z-index: 100;
}

/* ============================================
   Card
   ============================================ */

.card {
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(8px);
    border-radius: var(--radius-xl);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 460px;
    width: 100%;
    padding: var(--space-2xl);
}

/* ============================================
   Typography
   ============================================ */

h1 {
    font-size: 1.875rem;
    font-weight: 700;
    margin-bottom: var(--space-md);
    text-align: center;
}

h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: var(--space-md);
}

.subtitle {
    font-size: 1rem;
    color: var(--color-text-muted);
    text-align: center;
    margin-bottom: var(--space-xl);
}

/* ============================================
   Forms
   ============================================ */

.form-group {
    margin-bottom: var(--space-lg);
}

.form-label {
    display: block;
    font-weight: 500;
    margin-bottom: var(--space-sm);
    color: var(--color-text);
}

.form-input,
.form-select {
    width: 100%;
    padding: var(--space-sm) var(--space-md);
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 1rem;
    transition: all 0.2s ease;
}

.form-input:focus,
.form-select:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(0, 159, 224, 0.1);
}

.form-select {
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23718096' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right var(--space-md) center;
    padding-right: 2.5rem;
    appearance: none;
}

.form-hint {
    font-size: 0.875rem;
    color: var(--color-text-muted);
    margin-top: var(--space-xs);
}

.form-checkbox {
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
    cursor: pointer;
    user-select: none;
}

.form-checkbox__input {
    width: 18px;
    height: 18px;
    accent-color: var(--color-primary);
}

.form-checkbox__label {
    font-weight: 600;
    color: var(--color-text);
}

/* ============================================
   Buttons
   ============================================ */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-lg);
    border: none;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    white-space: nowrap;
}

.btn:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

.btn--primary {
    background: var(--color-primary);
    color: var(--color-white);
}

.btn--primary:hover:not(:disabled) {
    filter: brightness(0.9);
}

.btn--success {
    background: var(--color-success);
    color: var(--color-white);
}

.btn--success:hover:not(:disabled) {
    filter: brightness(0.9);
}

.btn--back {
    background: var(--color-neutral);
    color: var(--color-text);
}

.btn--back:hover:not(:disabled) {
    background: var(--color-neutral-hover);
}

.btn--full {
    width: 100%;
}

.button-group {
    display: flex;
    gap: var(--space-md);
    margin-top: var(--space-xl);
}

.button-group .btn {
    flex: 1;
}

/* ============================================
   Selection Grid (Templates and Modules)
   ============================================ */

.modules-grid,
.selector-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--space-md);
    margin: var(--space-lg) 0;
}

.module-card,
.selector-card {
    position: relative;
    border: 2px solid #e2e8f0;
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
}

.module-card:hover,
.selector-card:hover {
    border-color: var(--color-primary);
    box-shadow: 0 4px 12px rgba(0, 159, 224, 0.15);
}

.module-card--selected,
.selector-card--selected {
    border-color: var(--color-primary);
    background: rgba(0, 159, 224, 0.05);
}

.module-card__checkbox,
.selector-card__checkbox {
    display: none;
}

.module-card__check,
.selector-card__check {
    position: absolute;
    top: var(--space-sm);
    right: var(--space-sm);
    width: 24px;
    height: 24px;
    background: var(--color-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-white);
    font-weight: bold;
    font-size: 0.875rem;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.module-card--selected .module-card__check,
.selector-card--selected .selector-card__check {
    opacity: 1;
}

.module-card__label,
.selector-card__label {
    font-weight: 500;
    color: var(--color-text);
    margin-bottom: var(--space-sm);
}

.module-card__description,
.selector-card__description {
    font-size: 0.875rem;
    color: var(--color-text-muted);
}

/* ============================================
   Review Summary
   ============================================ */

.review-summary {
    background: rgba(249, 250, 251, 0.5);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    margin: var(--space-lg) 0;
}

.review-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: var(--space-md);
    padding: var(--space-md) 0;
    border-bottom: 1px solid #e2e8f0;
}

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

.review-row__label {
    font-weight: 600;
    color: var(--color-text);
    flex-shrink: 0;
}

.review-row__value {
    text-align: right;
    flex: 1;
}

.review-value--tag {
    display: inline-flex;
    flex-wrap: wrap;
    gap: var(--space-xs);
    justify-content: flex-end;
}

.tag {
    display: inline-block;
    background: rgba(0, 159, 224, 0.15);
    color: var(--color-primary);
    padding: var(--space-xs) var(--space-sm);
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 500;
}

/* ============================================
   Wizard Steps
   ============================================ */

.wizard-steps {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-2xl);
    width: 100%;
}

.wizard-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-sm);
    flex: 1;
    position: relative;
}

.wizard-step:not(:last-child)::after {
    content: '';
    position: absolute;
    top: 24px;
    left: 50%;
    right: -50%;
    height: 2px;
    background: #e2e8f0;
}

.wizard-step--active::after {
    background: var(--color-primary);
}

.wizard-step__number {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.25rem;
    background: #e2e8f0;
    color: var(--color-text-muted);
    transition: all 0.2s ease;
    z-index: 1;
}

.wizard-step--active .wizard-step__number {
    background: var(--color-primary);
    color: var(--color-white);
}

.wizard-step--completed .wizard-step__number {
    background: var(--color-success);
    color: var(--color-white);
}

.wizard-step__label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--color-text-muted);
    text-align: center;
}

.wizard-step--active .wizard-step__label {
    color: var(--color-primary);
    font-weight: 600;
}

.wizard-step--completed .wizard-step__label {
    color: var(--color-success);
}

/* ============================================
   Alerts
   ============================================ */

.alert {
    padding: var(--space-lg);
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-lg);
}

.alert--error {
    background: rgba(229, 62, 62, 0.1);
    border: 1px solid rgba(229, 62, 62, 0.3);
    color: #c53030;
}

.alert--success {
    background: rgba(108, 189, 111, 0.1);
    border: 1px solid rgba(108, 189, 111, 0.3);
    color: #22543d;
}

.alert strong {
    display: block;
    margin-bottom: var(--space-sm);
}

/* ============================================
   Success Screen
   ============================================ */

.success-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto var(--space-xl);
    background: var(--color-success);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    color: var(--color-white);
}

.success-details {
    background: rgba(249, 250, 251, 0.5);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    margin: var(--space-lg) 0;
}

.success-details__item {
    display: flex;
    justify-content: space-between;
    padding: var(--space-md) 0;
    border-bottom: 1px solid #e2e8f0;
}

.success-details__item:last-child {
    border-bottom: none;
}

.success-details__label {
    font-weight: 500;
}

.success-details__value {
    font-family: 'Courier New', monospace;
    color: var(--color-text-muted);
    word-break: break-all;
    text-align: right;
    flex: 1;
    margin-left: var(--space-md);
}

.success-link {
    display: inline-block;
    margin-top: var(--space-md);
    color: var(--color-primary);
    text-decoration: none;
    font-weight: 600;
    transition: all 0.2s ease;
}

.success-link:hover {
    color: var(--color-primary-hover);
    text-decoration: underline;
}

/* ============================================
   Utilities
   ============================================ */

.text-center {
    text-align: center;
}

.text-muted {
    color: var(--color-text-muted);
}

.mt-md {
    margin-top: var(--space-md);
}

.mt-lg {
    margin-top: var(--space-lg);
}

.mb-md {
    margin-bottom: var(--space-md);
}

.mb-lg {
    margin-bottom: var(--space-lg);
}

/* ============================================
   Build Status Screen
   ============================================ */

.build-status-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-lg);
}

.build-status-indicator {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    color: var(--color-white);
    margin: var(--space-lg) 0;
}

.build-status--pending {
    background: var(--color-neutral);
}

.build-status--running {
    background: var(--color-primary);
}

.build-status--success {
    background: var(--color-success);
}

.build-status--failed {
    background: var(--color-error);
}

.build-status-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top-color: var(--color-white);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.build-status-check,
.build-status-error {
    font-weight: bold;
}

.build-status-message {
    font-size: 1.125rem;
    font-weight: 500;
    text-align: center;
    color: var(--color-text);
}

.build-progress {
    width: 100%;
    background: rgba(255, 255, 255, 0.65);
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-md);
    padding: var(--space-sm);
}

.build-progress__top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-xs);
    color: var(--color-text-muted);
    font-size: 0.875rem;
}

.build-progress__track {
    width: 100%;
    height: 10px;
    border-radius: 999px;
    background: #dbe2ea;
    overflow: hidden;
}

.build-progress__fill {
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, var(--color-primary), var(--color-success));
    transition: width 0.3s ease;
}

/* Build Log */

.build-log {
    width: 100%;
    background: rgba(26, 32, 44, 0.95);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    max-height: 400px;
    overflow-y: auto;
    font-family: 'Courier New', monospace;
    font-size: 0.875rem;
    color: #e2e8f0;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.log-entry {
    display: flex;
    gap: var(--space-md);
    align-items: flex-start;
    margin-bottom: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-sm);
    border-left: 3px solid transparent;
}

.log-entry--info {
    color: #cbd5e0;
    border-left-color: var(--color-primary);
}

.log-entry--success {
    color: var(--color-success);
    border-left-color: var(--color-success);
}

.log-entry--error {
    color: var(--color-error);
    border-left-color: var(--color-error);
}

.log-entry--warning {
    color: #f6ad55;
    border-left-color: #f6ad55;
}

.log-entry__type {
    display: inline-block;
    min-width: 60px;
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
}

.log-entry__message {
    flex: 1;
    word-break: break-word;
}

/* Build Success */

.build-success,
.build-error {
    width: 100%;
}

.build-error .alert {
    margin-bottom: var(--space-lg);
}

.build-error .alert p {
    margin-top: var(--space-sm);
    font-size: 0.875rem;
}

/* Scrollbar styling */

.build-log::-webkit-scrollbar {
    width: 6px;
}

.build-log::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

.build-log::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

.build-log::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

@media (max-width: 640px) {
    .card {
        padding: var(--space-lg);
    }

    h1 {
        font-size: 1.5rem;
    }

    .modules-grid {
        grid-template-columns: 1fr;
    }

    .selector-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .button-group {
        flex-direction: column;
    }

    .wizard-steps {
        gap: var(--space-md);
    }

    .wizard-step__label {
        display: none;
    }
}

@media (max-width: 400px) {
    .selector-grid {
        grid-template-columns: 1fr;
    }
}

