:root {
    /* Color Palette */
    --primary-color: #c60649;
    --primary-hover: #a60629;
    --secondary-color: #ec4899;
    --background-dark: #0f172a;
    --surface-dark: #1e293b;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --border-color: #334155;

    /* Spacing & Layout */
    --container-width: 1200px;
    --header-height: 80px;
    --radius-lg: 16px;
    --radius-md: 8px;

    /* Typography */
    --font-main: 'Outfit', sans-serif;
}

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

body {
    font-family: var(--font-main);
    background-color: var(--background-dark);
    color: var(--text-main);
    line-height: 1.6;
    min-height: 100vh;
}

.bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    background-image: url("/img/deal2.png");
    background-size: cover;
    background-position: center;
    opacity: 0.3;
}

.app-container {
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
.main-header {
    height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 40px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo .icon {
    font-size: 24px;
    color: var(--primary-color);
}

.logo h1 {
    font-size: 24px;
    font-weight: 700;
    background: linear-gradient(to right, var(--primary-color), var(--secondary-color));
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Buttons */
button {
    cursor: pointer;
    border: none;
    font-family: var(--font-main);
    font-weight: 500;
    transition: all 0.3s ease;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
    padding: 14px 32px;
    font-size: 18px;
    border-radius: var(--radius-md);
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.btn-secondary {
    background-color: transparent;
    color: var(--text-muted);
    padding: 10px 20px;
}

.btn-secondary:hover {
    color: var(--text-main);
}

.btn-large {
    background-color: var(--primary-color);
    color: white;
    padding: 16px 46px;
    border-radius: var(--radius-lg);
    font-size: 24px;
    font-weight: 600;
}

.btn-large:hover {
    background-color: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(99, 102, 241, 0.4);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 14px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
}

.btn-sm:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

/* Hero Section */
.hero {
    text-align: center;
    padding: 80px 0;
    position: relative;
    /* Ensure relative positioning for absolute children */
    /* Remove radial gradient as galaxy will be there, or keep as fallback/overlay */
    /* background: radial-gradient(circle at center, rgba(99, 102, 241, 0.1) 0%, transparent 70%); */
    overflow: hidden;
    /* Contain the galaxy canvas */
}

#galaxy-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    /* Behind content */
    pointer-events: none;
    /* Let clicks pass through */
}

.hero h2 {
    font-size: 48px;
    font-weight: 700;
    margin-bottom: 16px;
    line-height: 1.2;
}

.hero p {
    font-size: 20px;
    color: var(--text-muted);
    margin-bottom: 40px;
}

/* Footer */
footer {
    text-align: center;
    padding: 40px 0;
    color: var(--text-muted);
    font-size: 14px;
    border-top: 1px solid var(--border-color);
    margin-top: auto;
    margin-bottom: 90px;
}

/* Utility Classes */
.hidden {
    display: none !important;
}

/* Wizard Section */
.wizard-section {
    padding: 40px 0;
    animation: fadeIn 0.5s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Progress Bar */
.wizard-progress {
    margin-bottom: 40px;
}

.progress-bar {
    float: none !important;
    width: 100% !important;
    }

.progress-bar {
    height: 6px;
    background-color: var(--surface-dark);
    border-radius: 3px;
    margin-bottom: 16px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(to right, var(--primary-color), var(--secondary-color));
    width: 33%;
    transition: width 0.4s ease;
}

.steps-indicator {
    display: flex;
    justify-content: space-between;
    font-size: 14px;
    color: var(--text-muted);
}

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

/* Wizard Content */
.step-content {
    display: none;
    animation: fadeIn 0.3s ease-out;
}

.step-content.active {
    display: block;
}

.step-content h3 {
    font-size: 28px;
    margin-bottom: 8px;
}

.step-desc {
    color: var(--text-muted);
    margin-bottom: 46px;
}

/* Forms */
.form-group {
    margin-bottom: 24px;
}

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

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 16px;
    background-color: var(--surface-dark);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-main);
    font-family: var(--font-main);
    font-size: 16px;
    transition: border-color 0.3s ease;
    resize: vertical;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

/* Brief Container Layout */
.brief-container {
    display: grid;
    grid-template-columns: 1fr 350px;
    gap: 40px;
    align-items: start;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

/* Complexity Selector */
.complexity-selector {
    display: flex;
    gap: 8px;
}

.complexity-btn {
    flex: 1;
    padding: 10px 16px;
    background-color: var(--surface-dark);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-muted);
    font-family: var(--font-main);
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
}

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

.complexity-btn:hover:not(.active) {
    border-color: var(--primary-color);
    color: var(--text-main);
}

/* Quick Prompts / Chips */
.quick-prompts {
    margin-top: 32px;
    margin-bottom: 32px;
}

.quick-prompts label {
    display: block;
    margin-bottom: 12px;
    font-weight: 500;
    color: var(--text-main);
}

.chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.chip {
    padding: 8px 16px;
    background-color: var(--surface-dark);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    color: var(--text-main);
    font-family: var(--font-main);
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.chip:hover {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(99, 102, 241, 0.3);
}

/* AI Tips Panel */
.ai-tips-panel {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1), rgba(236, 72, 153, 0.1));
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    position: sticky;
    top: 20px;
}

.tips-icon {
    font-size: 32px;
    margin-bottom: 12px;
}

.ai-tips-panel h4 {
    font-size: 18px;
    margin-bottom: 16px;
    color: var(--text-main);
}

.ai-tips-panel ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.ai-tips-panel li {
    padding-left: 24px;
    margin-bottom: 12px;
    color: var(--text-muted);
    font-size: 14px;
    line-height: 1.6;
    position: relative;
}

.ai-tips-panel li:before {
    content: "✓";
    position: absolute;
    left: 0;
    color: var(--primary-color);
    font-weight: bold;
}


/* Structure Builder */
.structure-builder {
    display: grid;
    grid-template-columns: 1fr 350px;
    gap: 32px;
}

.section-list {
    background-color: var(--surface-dark);
    border-radius: var(--radius-md);
    padding: 16px;
    min-height: 450px;
    border: 1px solid var(--border-color);
}

.structure-item {
    cursor: move;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 12px;
    margin-bottom: 8px;
    transition: all 0.2s ease;
}

.structure-item:hover {
    border-color: var(--primary-color);
    transform: translateX(2px);
    background-color: rgba(255, 255, 255, 0.05);
}

.item-content {
    flex: 1;
    padding-right: 12px;
}

.structure-item .item-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.item-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    border-radius: 4px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    font-size: 14px;
}

.add-btn {
    color: var(--primary-color);
    background-color: rgba(99, 102, 241, 0.1);
}

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

.remove-btn {
    color: var(--secondary-color);
    background-color: rgba(236, 72, 153, 0.1);
}

.remove-btn:hover {
    background-color: var(--secondary-color);
    color: white;
}

.required-badge {
    font-size: 16px;
    cursor: help;
    opacity: 0.7;
}

/* Editable Text */
.editable-wrapper {
    position: relative;
    display: block;
    /* Changed from flex to block/flow for text */
    width: 100%;
}

.editable-title,
.editable-desc {
    transition: all 0.2s ease;
    border-radius: 4px;
    padding: 2px 4px;
    margin: -2px -4px;
    /* compensate for padding */
    display: block;
    /* Ensure block display */
    flex: 1;
    /* Take available space */
}

.editable-desc {
    white-space: pre-wrap;
    /* Preserve newlines */
    /* Ensure it behaves like a block for multi-line */
}

i.fas.fa-pencil-alt.edit-icon {
    line-height: 0;
}

.edit-icon {
    position: absolute;
    right: 0;
    /* Position on the right */
    left: auto;
    /* Reset left */
    top: 50%;
    transform: translateY(-50%);
    opacity: 0;
    transition: opacity 0.2s;
    color: var(--text-muted);
    font-size: 12px;
    cursor: pointer;
    padding: 4px;
    /* Increase hit area */
}

/* Adjust top position for description since it might be multi-line */
.editable-wrapper:has(.editable-desc) .edit-icon {
    top: 10px;
    /* Align with first line roughly */
    transform: none;
}

.editable-wrapper:hover .edit-icon {
    opacity: 1;
}

.edit-icon:hover {
    color: var(--primary-color);
}

.editable-title:hover,
.editable-desc:hover {
    background-color: rgba(255, 255, 255, 0.1);
    cursor: text;
}

.editable-title:focus,
.editable-desc:focus {
    background-color: rgba(255, 255, 255, 0.15);
    outline: 1px solid var(--primary-color);
    min-height: 60px;
    /* Expand on focus */
}



/* CKEDITOR Override */
.cke_combo__strinsert,
.cke_combo_button,
.cke_combo_label {
    width: 170px !important;
}

.cke_combo_text,
.cke_combo_open {
    width: 135px !important;
}

.notice.alert .left {
    margin-right: 10px;
    flex: 1;
}



#available-sections-list {
    margin-top: 18px;
}



.actions-right {
    display: flex;
    gap: 12px;
}

div#cke_contract-editor,
.cke_inner.cke_reset,
.editor-container,
span#cke_1_top,
span#cke_1_bottom {
    border-radius: 10px;
}


/* Section Header Row */
.section-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.section-header-row h4 {
    margin-bottom: 0;
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(4px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    animation: fadeIn 0.2s ease-out;
}

.modal-ai {
    background-color: var(--surface-dark);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 32px;
    width: 100%;
    max-width: 1100px;
    margin: 30px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    transform: translateY(0);
    animation: slideUp 0.3s ease-out;
}

.wizard-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 40px;
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 20px 0;
    background: #0a1120d1;
    justify-content: center;
    box-shadow: 0px -5px 10px 0px rgb(0 0 0 / 25%);
    border-top: 1px solid #ffffff1c;
    backdrop-filter: blur(4px);
}

#galaxy-background {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    pointer-events: none;
    background-color: #000000;
    opacity: 0.4;
}

button#prev-btn {
    padding: 16px 36px;
    font-size: 18px;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-ai h3 {
    margin-bottom: 24px;
    font-size: 24px;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 32px;
}

/* Input Validation Error */
.input-error {
    border-color: #ef4444 !important;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.2) !important;
    animation: shake 0.4s cubic-bezier(.36, .07, .19, .97) both;
}

@keyframes shake {

    10%,
    90% {
        transform: translate3d(-1px, 0, 0);
    }

    20%,
    80% {
        transform: translate3d(2px, 0, 0);
    }

    30%,
    50%,
    70% {
        transform: translate3d(-4px, 0, 0);
    }

    40%,
    60% {
        transform: translate3d(4px, 0, 0);
    }
}

/* Disclaimer Modal Specifics */
.disclaimer-modal-content {
    background-color: var(--surface-dark);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 1000px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    animation: slideUp 0.3s ease-out;
}

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

.disclaimer-modal-content .modal-header h3 {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 0;
}

.disclaimer-modal-content .close-modal-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 20px;
    cursor: pointer;
    padding: 4px;
    transition: color 0.2s;
}

.disclaimer-modal-content .close-modal-btn:hover {
    color: var(--text-main);
}

.disclaimer-modal-content .modal-body {
    padding: 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

i.fas.fa-exclamation-triangle {
    color: #fbbf24;
    margin-right: 10px;
}

.disclaimer-text {
    font-size: 18px;
    color: var(--text-main);
    margin-bottom: 12px;
    line-height: 1.5;
}

.disclaimer-subtext {
    font-size: 12px;
    color: var(--text-muted);
}

.disclaimer-modal-content .modal-footer {
    padding: 20px 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}