/**
 * PowerDecision Wizard Stylesheet — Dark Theme
 * Matches PowerSolver wizard style and feel.
 * Layout structure: header → steps → content → footer.
 */

:root {
    /* Primary palette (from PowerSolver) */
    --wizard-primary: #6366f1;
    --wizard-primary-dark: #4f46e5;
    --wizard-secondary: #8b5cf6;
    --wizard-accent: #06b6d4;
    --wizard-primary-light: rgba(99, 102, 241, 0.15);

    /* Status colors */
    --wizard-success: #10b981;
    --wizard-warning: #f59e0b;
    --wizard-danger: #ef4444;

    /* Dark backgrounds */
    --wizard-bg: #05050a;
    --wizard-bg-subtle: #0d0d16;
    --wizard-surface: rgba(17, 17, 27, 0.92);
    --wizard-surface-hover: rgba(30, 32, 45, 0.95);

    /* Borders */
    --wizard-border: rgba(255, 255, 255, 0.08);
    --wizard-border-hover: rgba(255, 255, 255, 0.25);

    /* Text */
    --wizard-text: #ffffff;
    --wizard-text-secondary: #c7c9d9;
    --wizard-text-muted: #b8bcc8;

    /* Bootstrap overrides for dark mode */
    --bs-body-bg: #05050a;
    --bs-body-color: #ffffff;
    --bs-secondary-color: rgba(255, 255, 255, 0.65);
    --bs-body-secondary-color: rgba(255, 255, 255, 0.65);
    --bs-border-color: rgba(255, 255, 255, 0.08);
    --bs-tertiary-bg: rgba(17, 17, 27, 0.92);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background:
        radial-gradient(circle at top, rgba(99, 102, 241, 0.15), transparent),
        radial-gradient(circle at bottom, rgba(6, 182, 212, 0.12), transparent),
        var(--wizard-bg);
    color: var(--wizard-text);
    min-height: 100vh;
}

/* ============================================================
   Header
   ============================================================ */
.wizard-header {
    background: var(--wizard-surface);
    border-bottom: 1px solid var(--wizard-border);
}

.wizard-header h4,
.wizard-header h5 {
    color: var(--wizard-text);
}

/* ============================================================
   Step Indicator
   ============================================================ */
.wizard-step-indicator {
    background: var(--wizard-surface);
    border-bottom: 1px solid var(--wizard-border);
}

.step-indicator-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    cursor: pointer;
    border-radius: 0.5rem;
    transition: all 0.2s ease;
    user-select: none;
}

.step-indicator-item .step-number {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.1);
    color: var(--wizard-text-muted);
}

.step-indicator-item .step-label {
    font-size: 0.85rem;
    color: var(--wizard-text-muted);
}

.step-indicator-item.active .step-number {
    background: linear-gradient(135deg, var(--wizard-primary), var(--wizard-accent));
    color: #fff;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.step-indicator-item.active .step-label {
    color: #fff;
    font-weight: 600;
}

.step-indicator-item.completed .step-number {
    background: var(--wizard-success);
    color: #fff;
}

.step-indicator-item.completed .step-label {
    color: var(--wizard-success);
}

.step-indicator-item.disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.step-indicator-item:hover:not(.active):not(.disabled) .step-label {
    color: var(--wizard-text);
}

/* ============================================================
   Footer (Nav Buttons)
   ============================================================ */
.wizard-footer {
    background: var(--wizard-surface);
    border-top: 1px solid var(--wizard-border);
    position: sticky;
    bottom: 0;
}

/* ============================================================
   Template Cards (Step 1)
   ============================================================ */
.template-card {
    transition: all 0.2s ease;
    border: 2px solid var(--wizard-border);
    background: var(--wizard-surface);
    color: var(--wizard-text);
    cursor: pointer;
}

.template-card:hover {
    border-color: var(--wizard-primary);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(99, 102, 241, 0.2);
}

.template-card.selected {
    border-color: var(--wizard-primary) !important;
    box-shadow: 0 12px 30px rgba(99, 102, 241, 0.25);
    background: rgba(99, 102, 241, 0.1);
}

.cursor-pointer {
    cursor: pointer;
}

/* ============================================================
   Card Grid (Steps 2-3)
   ============================================================ */
.card-grid-header h6 {
    font-weight: 600;
    color: var(--wizard-text);
}

.card-grid-item {
    transition: border-color 0.2s ease;
    background: var(--wizard-surface);
    border-color: var(--wizard-border);
}

.card-grid-item:hover {
    border-color: var(--wizard-primary);
}

/* ============================================================
   Field Groups
   ============================================================ */
.field-group {
    min-width: 80px;
}

.field-group .form-label {
    margin-bottom: 0.25rem;
    font-weight: 500;
    color: var(--wizard-text-secondary);
}

/* ============================================================
   Form Controls — Dark Mode
   ============================================================ */
.form-control,
.form-select {
    background-color: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--wizard-border);
    color: var(--wizard-text);
}

.form-control:focus,
.form-select:focus {
    background-color: rgba(255, 255, 255, 0.08);
    border-color: var(--wizard-accent);
    color: var(--wizard-text);
    box-shadow: 0 0 0 0.2rem rgba(6, 182, 212, 0.25);
}

.form-control::placeholder {
    color: var(--wizard-text-muted);
}

.form-control:disabled,
.form-select:disabled {
    background-color: rgba(0, 0, 0, 0.15);
    color: var(--wizard-text-muted);
    opacity: 0.7;
}

.form-select option {
    background-color: #1e293b;
    color: #e2e8f0;
}

/* ============================================================
   Buttons
   ============================================================ */
.btn-action {
    padding: 0.2rem 0.4rem;
    font-size: 0.75rem;
}

.btn-primary {
    background: linear-gradient(135deg, var(--wizard-primary), var(--wizard-secondary));
    border: none;
    box-shadow: 0 8px 20px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 28px rgba(99, 102, 241, 0.4);
}

.btn-outline-secondary {
    border-color: var(--wizard-border-hover);
    color: var(--wizard-text-secondary);
}

.btn-outline-secondary:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--wizard-text-muted);
    color: var(--wizard-text);
}

/* ============================================================
   Bootstrap Component Overrides — Dark Mode
   ============================================================ */

/* Cards */
.card {
    background: var(--wizard-surface);
    border-color: var(--wizard-border);
    color: var(--wizard-text);
}

.card-header {
    background: rgba(255, 255, 255, 0.04);
    border-bottom-color: var(--wizard-border);
}

/* Alerts */
.alert-danger {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.3);
    color: #fca5a5;
}

/* Badges */
.badge.bg-danger { background-color: var(--wizard-danger) !important; }
.badge.bg-warning { background-color: var(--wizard-warning) !important; color: #000 !important; }
.badge.bg-success { background-color: var(--wizard-success) !important; }
.badge.bg-secondary {
    background-color: rgba(255, 255, 255, 0.12) !important;
    color: var(--wizard-text-secondary) !important;
}
.badge.bg-info {
    background-color: rgba(6, 182, 212, 0.2) !important;
    color: var(--wizard-accent) !important;
}

/* Text utilities */
.text-muted {
    color: var(--wizard-text-muted) !important;
}

.text-secondary {
    color: var(--wizard-text-secondary) !important;
}

/* ============================================================
   Rules Table (Step 5)
   ============================================================ */
.rules-table {
    background: var(--wizard-surface);
    border-radius: 0.5rem;
    overflow: hidden;
}

.rules-table table {
    margin-bottom: 0;
}

.rules-table th {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.4), rgba(6, 182, 212, 0.3)) !important;
    color: #ffffff !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
    font-weight: 600;
    padding: 0.85rem 0.9rem;
}

.rules-table td {
    padding: 0.85rem 0.9rem;
    border-color: rgba(255, 255, 255, 0.05);
    vertical-align: middle;
}

.rules-table tbody tr {
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.rules-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

.rules-table tbody tr.default-rule {
    background: rgba(6, 182, 212, 0.1);
    border-left: 3px solid var(--wizard-accent);
}

/* ============================================================
   JSON Preview (Step 6)
   ============================================================ */
.json-preview {
    background: rgba(5, 5, 12, 0.85);
    border: 1px solid var(--wizard-border);
    border-radius: 0.5rem;
    padding: 1rem;
    max-height: 500px;
    overflow: auto;
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    font-size: 0.85rem;
    line-height: 1.6;
}

.json-preview pre {
    margin: 0;
    color: var(--wizard-text-secondary);
}

/* ============================================================
   Modal Overrides — Dark Mode
   ============================================================ */
.modal-content {
    background: var(--wizard-surface-hover);
    border: 1px solid var(--wizard-border);
    color: var(--wizard-text);
}

.modal-header {
    border-bottom-color: var(--wizard-border);
}

.modal-footer {
    border-top-color: var(--wizard-border);
}

.modal .form-control,
.modal .form-select {
    background-color: rgba(5, 5, 12, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: var(--wizard-text);
}

.modal .form-control:focus,
.modal .form-select:focus {
    background-color: rgba(10, 10, 20, 0.9);
    border-color: var(--wizard-accent);
    color: var(--wizard-text);
    box-shadow: 0 0 0 0.2rem rgba(6, 182, 212, 0.25);
}

.modal .form-label {
    color: var(--wizard-text-secondary);
}

/* Run Decision modal — result section text */
#pdRunDecisionResult,
#pdRunDecisionResult .alert-success,
#pdRunDecisionResult .alert-danger,
#pdRunDecisionResult pre,
#pdRunDecisionResult code {
    color: #ffffff !important;
}

/* ============================================================
   Animations
   ============================================================ */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.wizard-panel {
    animation: fadeIn 0.3s ease;
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 768px) {
    .step-indicator-item .step-label {
        display: none;
    }
}
