/* ============================================================================
   Chatbot Wizard Modal - Modern Dark Design
   Based on reference design with purple accent colors
   ============================================================================ */

/* CSS Variables for Wizard */
:root {
    --wizard-bg-dark: #0d0d0d;
    --wizard-bg-surface: #1a1a1a;
    --wizard-bg-input: #141414;
    --wizard-border-color: #2a2a2a;
    --wizard-text-primary: #ffffff;
    --wizard-text-secondary: #888888;
    --wizard-text-muted: #666666;
    --wizard-accent-purple: #8b5cf6;
    --wizard-accent-purple-light: #a78bfa;
    --wizard-accent-purple-glow: rgba(139, 92, 246, 0.3);
    --wizard-success: #10b981;
    --wizard-card-bg: #1a1a1a;
    --wizard-card-border: #2a2a2a;
    --wizard-card-hover: #252525;
}

/* Modal Animation */
@keyframes wizardSlideIn {
    from {
        opacity: 0;
        transform: scale(0.96) translateY(-10px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

@keyframes wizardPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

@keyframes wizardSpin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Modal Base Styles */
#wizardModal .modal-dialog {
    /* Uses Bootstrap's modal-xl size */
}

#wizardModal .wizard-modern-modal {
    background: var(--wizard-bg-dark);
    color: var(--wizard-text-primary);
    border: 1px solid var(--wizard-border-color);
    border-radius: 1.5rem;
    box-shadow: 
        0 25px 50px -12px rgba(0, 0, 0, 0.5),
        0 0 0 1px rgba(255, 255, 255, 0.05);
    animation: wizardSlideIn 0.3s ease-out;
    overflow: hidden;
}

/* Modal Header */
#wizardModal .wizard-modern-header {
    background: transparent;
    border: none;
    padding: 1rem 1.25rem 0 1.25rem;
    display: flex;
    justify-content: flex-end;
    position: relative;
    z-index: 10;
}

#wizardModal .wizard-close-btn {
    filter: invert(1) grayscale(100%) brightness(200%);
    opacity: 0.6;
    transition: opacity 0.2s ease;
    position: relative;
    z-index: 11;
    pointer-events: auto;
    cursor: pointer;
    padding: 0.5rem;
    margin: -0.5rem;
}

#wizardModal .wizard-close-btn:hover {
    opacity: 1;
}

/* Modal Body */
#wizardModal .wizard-modern-body {
    background: var(--wizard-bg-dark);
    color: var(--wizard-text-primary);
    padding: 0 2rem 1.5rem 2rem;
}

/* ============================================================================
   Step Indicators - Modern Horizontal Design
   ============================================================================ */

#wizardModal .wizard-steps-modern {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    gap: 0.1rem;
    margin-bottom: 2rem;
    padding: 0 0.5rem;
}

#wizardModal .wizard-step-modern {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.1rem;
    flex: 1;
    max-width: 80px;
    position: relative;
}

/* Connector Lines between Steps */
#wizardModal .wizard-step-modern:not(:last-child)::after {
    content: '';
    position: absolute;
    top: 16px;
    left: calc(50% + 18px);
    width: calc(100% - 16px);
    height: 2px;
    background: var(--wizard-border-color);
    z-index: 0;
}

#wizardModal .wizard-step-modern.completed:not(:last-child)::after {
    background: var(--wizard-accent-purple);
}

#wizardModal .wizard-step-circle-modern {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    font-weight: 600;
    background: var(--wizard-bg-surface);
    color: var(--wizard-text-muted);
    border: 2px solid var(--wizard-border-color);
    transition: all 0.3s ease;
    position: relative;
    z-index: 1;
}

#wizardModal .wizard-step-modern.active .wizard-step-circle-modern {
    background: var(--wizard-accent-purple);
    color: white;
    border-color: var(--wizard-accent-purple);
    box-shadow: 0 0 20px var(--wizard-accent-purple-glow);
}

#wizardModal .wizard-step-modern.completed .wizard-step-circle-modern {
    background: var(--wizard-accent-purple);
    color: white;
    border-color: var(--wizard-accent-purple);
}

#wizardModal .wizard-step-label-modern {
    font-size: 0.75rem;
    color: var(--wizard-text-muted);
    text-align: center;
    transition: color 0.2s ease;
    white-space: nowrap;
}

#wizardModal .wizard-step-modern.active .wizard-step-label-modern {
    color: var(--wizard-text-primary);
    font-weight: 500;
}

#wizardModal .wizard-step-modern.completed .wizard-step-label-modern {
    color: var(--wizard-text-secondary);
}

/* Mobile Step Badge */
#wizardModal .wizard-mobile-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.5rem 1rem;
    background: var(--wizard-bg-surface);
    border: 1px solid var(--wizard-border-color);
    border-radius: 999px;
    font-size: 0.875rem;
    color: var(--wizard-text-secondary);
}

/* ============================================================================
   Wizard Content Area
   ============================================================================ */

#wizardModal .wizard-container {
    min-height: 400px;
}

#wizardModal .wizard-content {
    animation: wizardSlideIn 0.3s ease-out;
}

#wizardModal .wizard-step-heading {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--wizard-text-primary);
    margin-bottom: 0.5rem;
}

#wizardModal .wizard-step-subtitle {
    font-size: 0.9375rem;
    color: var(--wizard-text-secondary);
    margin-bottom: 1.75rem;
}

/* ============================================================================
   Form Elements
   ============================================================================ */

#wizardModal .wizard-form-group {
    margin-bottom: 1.25rem;
}

#wizardModal .wizard-form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--wizard-text-primary);
    margin-bottom: 0.5rem;
}

#wizardModal .wizard-form-input,
#wizardModal .wizard-form-textarea,
#wizardModal .wizard-form-select {
    width: 100%;
    padding: 0.875rem 1rem;
    background: var(--wizard-bg-input);
    border: 1px solid var(--wizard-border-color);
    border-radius: 0.75rem;
    color: var(--wizard-text-primary);
    font-size: 0.9375rem;
    transition: all 0.2s ease;
}

#wizardModal .wizard-form-input::placeholder,
#wizardModal .wizard-form-textarea::placeholder {
    color: var(--wizard-text-muted);
}

#wizardModal .wizard-form-input:focus,
#wizardModal .wizard-form-textarea:focus,
#wizardModal .wizard-form-select:focus {
    outline: none;
    border-color: var(--wizard-accent-purple);
    box-shadow: 0 0 0 3px var(--wizard-accent-purple-glow);
}

#wizardModal .wizard-form-textarea {
    min-height: 100px;
    resize: vertical;
}

#wizardModal .wizard-form-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23888888' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    padding-right: 2.5rem;
    cursor: pointer;
}

#wizardModal .wizard-form-select option {
    background: var(--wizard-bg-dark);
    color: var(--wizard-text-primary);
}

#wizardModal .wizard-form-hint {
    font-size: 0.8125rem;
    color: var(--wizard-text-muted);
    margin-top: 0.375rem;
}

/* Range Slider */
#wizardModal .wizard-form-range {
    width: 100%;
    height: 6px;
    background: var(--wizard-border-color);
    border-radius: 3px;
    outline: none;
    -webkit-appearance: none;
    margin: 0.75rem 0;
}

#wizardModal .wizard-form-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    background: var(--wizard-accent-purple);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 0 10px var(--wizard-accent-purple-glow);
    transition: transform 0.2s ease;
}

#wizardModal .wizard-form-range::-webkit-slider-thumb:hover {
    transform: scale(1.1);
}

#wizardModal .wizard-form-range::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: var(--wizard-accent-purple);
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

#wizardModal .wizard-slider-value {
    color: var(--wizard-accent-purple-light);
    font-weight: 600;
}

#wizardModal .wizard-range-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--wizard-text-muted);
}

/* ============================================================================
   Category Grid
   ============================================================================ */

#wizardModal .wizard-category-grid,
#wizardModal #category-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
}

#wizardModal .category-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.1rem;
    padding: 1.25rem 1rem;
    background: var(--wizard-card-bg);
    border: 1px solid var(--wizard-card-border);
    border-radius: 0.875rem;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

#wizardModal .category-card:hover {
    background: var(--wizard-card-hover);
    border-color: var(--wizard-accent-purple);
    transform: translateY(-2px);
}

#wizardModal .category-card.selected {
    background: rgba(139, 92, 246, 0.15);
    border-color: var(--wizard-accent-purple);
    box-shadow: 0 0 20px var(--wizard-accent-purple-glow);
}

#wizardModal .category-icon {
    font-size: 1.75rem;
    color: var(--wizard-accent-purple-light);
    transition: transform 0.2s ease;
}

#wizardModal .category-card:hover .category-icon {
    transform: scale(1.1);
}

#wizardModal .category-name {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--wizard-text-primary);
    text-align: center;
}

/* ============================================================================
   Checkbox Styling
   ============================================================================ */

#wizardModal .wizard-checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
}

#wizardModal .wizard-checkbox {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: var(--wizard-bg-input);
    border: 1px solid var(--wizard-border-color);
    border-radius: 0.625rem;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.875rem;
    color: var(--wizard-text-primary);
}

#wizardModal .wizard-checkbox:hover {
    border-color: var(--wizard-accent-purple);
    background: var(--wizard-card-hover);
}

#wizardModal .wizard-checkbox input[type="checkbox"] {
    display: none;
}

#wizardModal .wizard-checkbox-mark {
    width: 20px;
    height: 20px;
    border: 2px solid var(--wizard-border-color);
    border-radius: 0.375rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

#wizardModal .wizard-checkbox-mark::after {
    content: '\2713';
    color: white;
    font-size: 0.75rem;
    font-weight: bold;
    opacity: 0;
    transform: scale(0);
    transition: all 0.2s ease;
}

#wizardModal .wizard-checkbox input[type="checkbox"]:checked + .wizard-checkbox-mark {
    background: var(--wizard-accent-purple);
    border-color: var(--wizard-accent-purple);
}

#wizardModal .wizard-checkbox input[type="checkbox"]:checked + .wizard-checkbox-mark::after {
    opacity: 1;
    transform: scale(1);
}

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

#wizardModal .wizard-btn-generate {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.875rem 1.5rem;
    background: linear-gradient(135deg, var(--wizard-accent-purple) 0%, #7c3aed 100%);
    color: white;
    border: none;
    border-radius: 0.75rem;
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 15px var(--wizard-accent-purple-glow);
}

#wizardModal .wizard-btn-generate:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px var(--wizard-accent-purple-glow);
}

#wizardModal .wizard-btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1rem;
    background: transparent;
    color: var(--wizard-text-secondary);
    border: 1px solid var(--wizard-border-color);
    border-radius: 0.5rem;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

#wizardModal .wizard-btn-secondary:hover {
    border-color: var(--wizard-accent-purple);
    color: var(--wizard-accent-purple-light);
}

/* Loading State */
#wizardModal .wizard-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    gap: 1rem;
}

#wizardModal .wizard-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--wizard-border-color);
    border-top-color: var(--wizard-accent-purple);
    border-radius: 50%;
    animation: wizardSpin 0.8s linear infinite;
}

#wizardModal .wizard-loading p {
    color: var(--wizard-text-secondary);
    font-size: 0.9375rem;
}

/* Prompt Editor */
#wizardModal .wizard-prompt-editor {
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.8125rem;
    line-height: 1.5;
    min-height: 250px;
}

/* ============================================================================
   Modal Footer
   ============================================================================ */

#wizardModal .wizard-modern-footer {
    background: var(--wizard-bg-dark);
    border-top: 1px solid var(--wizard-border-color);
    padding: 1.25rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#wizardModal .wizard-btn-back {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: transparent;
    color: var(--wizard-text-secondary);
    border: none;
    font-size: 0.9375rem;
    cursor: pointer;
    transition: color 0.2s ease;
}

#wizardModal .wizard-btn-back:hover {
    color: var(--wizard-text-primary);
}

#wizardModal .wizard-btn-back i {
    transition: transform 0.2s ease;
}

#wizardModal .wizard-btn-back:hover i {
    transform: translateX(-3px);
}

#wizardModal .wizard-btn-next {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: var(--wizard-text-primary);
    color: var(--wizard-bg-dark);
    border: none;
    border-radius: 999px;
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-left: auto;
}

#wizardModal .wizard-btn-next:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 255, 255, 0.2);
}

#wizardModal .wizard-btn-next i {
    transition: transform 0.2s ease;
}

#wizardModal .wizard-btn-next:hover i {
    transform: translateX(3px);
}

#wizardModal .wizard-btn-finish {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: linear-gradient(135deg, var(--wizard-success) 0%, #059669 100%);
    color: white;
    border: none;
    border-radius: 999px;
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
    margin-left: auto;
}

#wizardModal .wizard-btn-finish:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
}

/* ============================================================================
   Responsive Styles
   ============================================================================ */

@media (max-width: 768px) {
    #wizardModal .wizard-modern-body {
        padding: 0 1.25rem 1.25rem 1.25rem;
    }

    #wizardModal .wizard-steps-modern {
        display: none;
    }

    #wizardModal .wizard-category-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.625rem;
    }

    #wizardModal .category-card {
        padding: 1rem 0.75rem;
    }

    #wizardModal .wizard-modern-footer {
        padding: 1rem 1.25rem;
    }
}

@media (max-width: 480px) {
    #wizardModal .wizard-step-heading {
        font-size: 1.25rem;
    }

    #wizardModal .wizard-form-input,
    #wizardModal .wizard-form-textarea,
    #wizardModal .wizard-form-select {
        padding: 0.75rem;
        font-size: 0.875rem;
    }
}

/* ============================================================================
   Light Mode Overrides (if needed)
   ============================================================================ */

body:not(.dark-mode) #wizardModal .wizard-modern-modal {
    background: #ffffff;
    border-color: #e5e7eb;
}

body:not(.dark-mode) #wizardModal .wizard-modern-body {
    background: #ffffff;
}

body:not(.dark-mode) #wizardModal .wizard-step-heading,
body:not(.dark-mode) #wizardModal .wizard-form-label,
body:not(.dark-mode) #wizardModal .category-name {
    color: #1f2937;
}

body:not(.dark-mode) #wizardModal .wizard-step-subtitle,
body:not(.dark-mode) #wizardModal .wizard-form-hint {
    color: #6b7280;
}

body:not(.dark-mode) #wizardModal .wizard-form-input,
body:not(.dark-mode) #wizardModal .wizard-form-textarea,
body:not(.dark-mode) #wizardModal .wizard-form-select {
    background: #f9fafb;
    border-color: #e5e7eb;
    color: #1f2937;
}

body:not(.dark-mode) #wizardModal .wizard-form-input::placeholder,
body:not(.dark-mode) #wizardModal .wizard-form-textarea::placeholder {
    color: #9ca3af;
}

body:not(.dark-mode) #wizardModal .wizard-step-circle-modern {
    background: #f3f4f6;
    border-color: #e5e7eb;
    color: #9ca3af;
}

body:not(.dark-mode) #wizardModal .wizard-step-label-modern {
    color: #9ca3af;
}

body:not(.dark-mode) #wizardModal .wizard-step-modern.active .wizard-step-label-modern {
    color: #1f2937;
}

body:not(.dark-mode) #wizardModal .category-card {
    background: #f9fafb;
    border-color: #e5e7eb;
}

body:not(.dark-mode) #wizardModal .category-card:hover {
    background: #f3f4f6;
}

body:not(.dark-mode) #wizardModal .wizard-checkbox {
    background: #f9fafb;
    border-color: #e5e7eb;
    color: #1f2937;
}

body:not(.dark-mode) #wizardModal .wizard-checkbox:hover {
    background: #f3f4f6;
}

body:not(.dark-mode) #wizardModal .wizard-modern-footer {
    background: #ffffff;
    border-top-color: #e5e7eb;
}

body:not(.dark-mode) #wizardModal .wizard-btn-next {
    background: #1f2937;
    color: #ffffff;
}

body:not(.dark-mode) #wizardModal .wizard-btn-back {
    color: #6b7280;
}

body:not(.dark-mode) #wizardModal .wizard-btn-back:hover {
    color: #1f2937;
}

body:not(.dark-mode) #wizardModal .wizard-close-btn {
    filter: none;
    opacity: 0.5;
}

body:not(.dark-mode) #wizardModal .wizard-close-btn:hover {
    opacity: 1;
}

/* ============================================================================
   Accessibility
   ============================================================================ */

#wizardModal .wizard-btn-next:focus-visible,
#wizardModal .wizard-btn-back:focus-visible,
#wizardModal .wizard-btn-finish:focus-visible,
#wizardModal .wizard-btn-generate:focus-visible,
#wizardModal .category-card:focus-visible {
    outline: 2px solid var(--wizard-accent-purple);
    outline-offset: 2px;
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    #wizardModal *,
    #wizardModal *::before,
    #wizardModal *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ============================================================================
   Legacy Class Support (for JS compatibility)
   ============================================================================ */

/* Support old wizard-step classes for JS */
#wizardModal .wizard-step-modern {
    /* Maps to .wizard-step for JS */
}

#wizardModal .wizard-step-modern.active {
    /* Maps to .wizard-step.active for JS */
}

#wizardModal .wizard-step-modern.completed {
    /* Maps to .wizard-step.completed for JS */
}

/* ============================================================================
   Vorlagen-Auswahl (PromptTemplatePicker, Schritt 1) und "Als Vorlage speichern"
   ============================================================================ */

#wizardModal .wizard-template-selected {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    padding: 0.625rem 0.875rem;
    background: rgba(16, 185, 129, 0.12);
    border: 1px solid rgba(16, 185, 129, 0.4);
    border-radius: 0.75rem;
    font-size: 0.875rem;
    color: var(--wizard-text-primary);
}

#wizardModal .wizard-template-selected i {
    color: var(--wizard-success);
}

#wizardModal #wizard-template-picker {
    margin-top: 0.5rem;
    padding: 1rem;
    background: var(--wizard-bg-surface);
    border: 1px solid var(--wizard-border-color);
    border-radius: 1rem;
}

#wizardModal .ptpl-picker,
#wizardModal .ptpl-overlay {
    --ptpl-bg: var(--wizard-card-bg);
    --ptpl-surface: var(--wizard-bg-input);
    --ptpl-border: var(--wizard-card-border);
    --ptpl-text: var(--wizard-text-primary);
    --ptpl-muted: var(--wizard-text-secondary);
}

body:not(.dark-mode) #wizardModal .wizard-template-selected {
    color: #1f2937;
}

body:not(.dark-mode) #wizardModal #wizard-template-picker {
    background: #f3f4f6;
    border-color: #e5e7eb;
}

body:not(.dark-mode) #wizardModal .ptpl-picker,
body:not(.dark-mode) #wizardModal .ptpl-overlay {
    --ptpl-bg: #ffffff;
    --ptpl-surface: #f9fafb;
    --ptpl-border: #e5e7eb;
    --ptpl-text: #1f2937;
    --ptpl-muted: #6b7280;
}

#wizardModal .wizard-btn-secondary:focus-visible {
    outline: 2px solid var(--wizard-accent-purple);
    outline-offset: 2px;
}

body:not(.dark-mode) #wizardModal .wizard-btn-secondary {
    border-color: #d1d5db;
    color: #4b5563;
}

body:not(.dark-mode) #wizardModal .wizard-btn-secondary:hover {
    border-color: var(--wizard-accent-purple);
    color: var(--wizard-accent-purple);
}
