:root {
    /* Midnight Blue Palette */
    --bg-color: #0C1A2E;
    --bg-darker: #081221;
    --bg-glass: rgba(12, 26, 46, 0.7);
    --border-color: rgba(116, 185, 255, 0.15);

    --primary: #0984E3;
    --primary-hover: #076CB5;

    --secondary: #74B9FF;
    --secondary-hover: #5A9FD4;

    --accent: #FD79A8;
    --accent-hover: #D65A84;

    --text-main: #F1F5F9;
    --text-muted: #94A3B8;

    --radius: 12px;
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: 'Inter', -apple-system, sans-serif;
    background-color: var(--bg-color);
    background-image: radial-gradient(circle at top right, rgba(9, 132, 227, 0.1), transparent 40%),
        radial-gradient(circle at bottom left, rgba(253, 121, 168, 0.05), transparent 40%);
    background-attachment: fixed;
    color: var(--text-main);
    min-height: 100vh;
    overflow: hidden;
    /* Prevent body scroll, handled internally */
}

/* Typography */
h1,
h2,
h3,
h4 {
    color: #FFFFFF;
    font-weight: 600;
}

a {
    color: var(--secondary);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--primary);
}

/* Utilities */
.glass {
    background: var(--bg-glass);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
}

.glass-heavy {
    background: rgba(8, 18, 33, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.hidden {
    display: none !important;
}

.flex-spacer {
    flex-grow: 1;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    border: none;
    outline: none;
}

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

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

.btn-primary:not(:disabled):hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(9, 132, 227, 0.3);
}

.btn-secondary {
    background: rgba(116, 185, 255, 0.1);
    color: var(--secondary);
    border: 1px solid rgba(116, 185, 255, 0.2);
}

.btn-secondary:not(:disabled):hover {
    background: rgba(116, 185, 255, 0.2);
}

.btn-outline {
    background: transparent;
    color: var(--text-main);
    border: 1px solid var(--border-color);
}

.btn-outline:not(:disabled):hover {
    border-color: var(--text-muted);
    background: rgba(255, 255, 255, 0.05);
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
}

.icon-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    transition: var(--transition);
}

.icon-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-main);
}

/* Layout */
.app-container {
    display: flex;
    height: 100vh;
    width: 100vw;
}

/* Sidebar */
.sidebar {
    width: 280px;
    height: 100%;
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    z-index: 10;
}

.logo {
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.25rem;
    font-weight: 600;
    border-bottom: 1px solid var(--border-color);
}

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

.steps-nav {
    flex-grow: 1;
    overflow-y: auto;
    padding: 1.5rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.step-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition);
    border: 1px solid transparent;
}

.step-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.step-item.active {
    background: rgba(9, 132, 227, 0.1);
    color: var(--secondary);
    border-color: rgba(9, 132, 227, 0.2);
}

.step-item.completed .step-icon {
    color: var(--secondary);
}

.step-item.active .step-icon {
    color: var(--primary);
}

.step-icon {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid currentColor;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
}

.sidebar-footer {
    padding: 1.5rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.progress-container {
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: var(--primary);
    width: 0%;
    transition: width 0.5s ease;
}

.progress-text {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-align: center;
}

/* Main Content */
.main-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
    position: relative;
}

.top-header {
    height: 72px;
    padding: 0 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-color);
    z-index: 5;
}

.form-scroll-area {
    flex-grow: 1;
    overflow-y: auto;
    padding: 2rem;
    display: flex;
    flex-direction: column;
}

.wizard-form {
    max-width: 800px;
    margin: 0 auto;
    width: 100%;
    flex-grow: 1;
}

.form-actions {
    max-width: 800px;
    margin: 2rem auto 0;
    width: 100%;
    display: flex;
    gap: 1rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

/* Form Elements */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-main);
}

.form-group label.subtitle {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 400;
    margin-top: -0.25rem;
    margin-bottom: 0.5rem;
}

.form-control {
    width: 100%;
    padding: 0.875rem 1rem;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    color: var(--text-main);
    font-family: inherit;
    font-size: 1rem;
    transition: var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(9, 132, 227, 0.2);
}

/* Toggle Switch */
.toggle-wrapper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    margin-bottom: 1rem;
    cursor: pointer;
    transition: var(--transition);
}

.toggle-wrapper:hover {
    background: rgba(255, 255, 255, 0.05);
}

.toggle-info {
    flex-grow: 1;
}

.toggle-title {
    font-weight: 500;
    font-size: 1rem;
    margin-bottom: 0.25rem;
}

.toggle-desc {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.toggle-switch {
    width: 48px;
    height: 24px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    position: relative;
    transition: var(--transition);
}

.toggle-switch::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50%;
    transition: var(--transition);
}

.toggle-wrapper.active {
    border-color: rgba(9, 132, 227, 0.4);
    background: rgba(9, 132, 227, 0.05);
}

.toggle-wrapper.active .toggle-switch {
    background: var(--primary);
}

.toggle-wrapper.active .toggle-switch::after {
    transform: translateX(24px);
}

/* Multiple choice cards */
.choice-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.choice-card {
    padding: 1.25rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.choice-card:hover {
    border-color: var(--secondary);
}

.choice-card.active {
    background: rgba(9, 132, 227, 0.1);
    border-color: var(--primary);
}

.choice-card i {
    color: var(--secondary);
    margin-bottom: 0.5rem;
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: 2rem;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.modal-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.modal {
    width: 100%;
    max-width: 900px;
    max-height: 90vh;
    border-radius: var(--radius);
    display: flex;
    flex-direction: column;
    transform: translateY(0);
    transition: transform 0.3s ease;
}

.modal-overlay.hidden .modal {
    transform: translateY(20px);
}

.modal-header {
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-body {
    padding: 2rem;
    overflow-y: auto;
    flex-grow: 1;
    background: var(--bg-darker);
}

/* Markdown specific styles */
.modal-body.markdown-preview h1 {
    font-size: 2rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5rem;
}

.modal-body.markdown-preview h2 {
    font-size: 1.5rem;
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    color: var(--secondary);
}

.modal-body.markdown-preview p {
    margin-bottom: 1rem;
    line-height: 1.6;
    color: var(--text-main);
}

.modal-body.markdown-preview ul {
    margin-bottom: 1rem;
    padding-left: 1.5rem;
}

.modal-body.markdown-preview li {
    margin-bottom: 0.5rem;
}

.modal-footer {
    padding: 1.5rem 2rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
}

/* Template Grid */
.template-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

.template-card {
    padding: 1.5rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
    text-align: center;
}

.template-card:hover {
    background: rgba(9, 132, 227, 0.05);
    border-color: var(--primary);
    transform: translateY(-2px);
}

.template-icon {
    width: 48px;
    height: 48px;
    background: rgba(9, 132, 227, 0.1);
    color: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
}

.template-card h3 {
    margin-bottom: 0.5rem;
}

.template-card p {
    font-size: 0.85rem;
    color: var(--text-muted);
}


@media (max-width: 768px) {
    .app-container {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        height: auto;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }

    .steps-nav {
        flex-direction: row;
        overflow-x: auto;
        padding: 1rem;
        gap: 1rem;
    }

    .step-item {
        padding: 0.5rem;
        border-radius: 50%;
    }

    .step-item span {
        display: none;
    }

    .sidebar-footer {
        display: none;
    }

    .form-scroll-area {
        padding: 1rem;
    }
}