/* ==============================================================================
   Learnistry Together - Builder Stylesheet (builder.css)
   ============================================================================== */

.builder-wrapper {
    background: #fdf8f9;
    padding: 3rem 1.5rem 6rem 1.5rem;
    min-height: calc(100vh - 180px);
}

.builder-container {
    max-width: 900px;
    margin: 0 auto;
}

/* Stepper Progress Bar */
.stepper-card {
    background: #fff;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-subtle);
    padding: 1.5rem;
    margin-bottom: 2.5rem;
    box-shadow: var(--shadow-sm);
}

.stepper-progress-bg {
    background: #f1f5f9;
    height: 8px;
    border-radius: var(--radius-full);
    overflow: hidden;
    margin-bottom: 1.2rem;
}

.stepper-progress-fill {
    background: linear-gradient(90deg, #fb7185, #e11d48);
    height: 100%;
    transition: width 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.stepper-labels {
    display: flex;
    justify-content: space-between;
    gap: 0.5rem;
    overflow-x: auto;
}

.step-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-subtle);
    cursor: default;
    white-space: nowrap;
    transition: color 0.2s ease;
}

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

.step-label.completed {
    color: var(--text-main);
}

/* Builder Step Content */
.builder-step {
    display: none;
    background: #fff;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-subtle);
    padding: 2.5rem 2rem;
    box-shadow: var(--shadow-sm);
    animation: stepIn 0.35s ease forwards;
}

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

@keyframes stepIn {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

.step-header {
    margin-bottom: 2rem;
    border-bottom: 1px solid #f1f5f9;
    padding-bottom: 1.2rem;
}

.step-header h2 {
    font-family: var(--font-heading);
    font-size: 1.85rem;
    margin-bottom: 0.4rem;
    color: var(--text-main);
}

.step-header p {
    color: var(--text-muted);
    font-size: 0.98rem;
}

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

.builder-tpl-card {
    border: 2px solid #e2e8f0;
    border-radius: var(--radius-md);
    overflow: hidden;
    cursor: pointer;
    transition: all 0.25s ease;
    display: flex;
    flex-direction: column;
}

.builder-tpl-card input[type="radio"] {
    display: none;
}

.builder-tpl-card:hover {
    border-color: #fda4af;
    transform: translateY(-2px);
}

.builder-tpl-card.selected {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.builder-tpl-preview {
    height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.builder-tpl-info {
    padding: 1.2rem;
    flex-grow: 1;
}

.builder-tpl-info h3 {
    font-size: 1.15rem;
    margin-bottom: 0.25rem;
}

.builder-tpl-tagline {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--primary);
    display: block;
    margin-bottom: 0.6rem;
}

.builder-tpl-info p {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.5;
}

/* Form Controls */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    margin-bottom: 1.5rem;
}

.form-group.full-width {
    grid-column: 1 / -1;
}

.form-group label {
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 0.5rem;
    color: var(--text-main);
}

.form-group .required {
    color: var(--primary);
}

.form-control {
    width: 100%;
    padding: 0.85rem 1.1rem;
    font-size: 1rem;
    border: 1.5px solid #cbd5e1;
    border-radius: 12px;
    font-family: inherit;
    transition: all 0.2s ease;
    background: #fff;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.form-hint {
    font-size: 0.82rem;
    color: var(--text-subtle);
    margin-top: 0.35rem;
}

.char-counter {
    text-align: right;
    font-size: 0.82rem;
    color: var(--text-subtle);
    margin-top: 0.3rem;
}

/* Dropzone */
.upload-dropzone {
    border: 2px dashed #cbd5e1;
    border-radius: var(--radius-md);
    padding: 3rem 1.5rem;
    text-align: center;
    background: #f8fafc;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-bottom: 2rem;
}

.upload-dropzone:hover, .upload-dropzone.dragover {
    border-color: var(--primary);
    background: var(--primary-light);
}

.dropzone-icon {
    font-size: 3rem;
    margin-bottom: 0.8rem;
}

.browse-link {
    color: var(--primary);
    text-decoration: underline;
    font-weight: 600;
}

.photos-preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 1rem;
}

.photo-preview-item {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    height: 120px;
    box-shadow: var(--shadow-sm);
    border: 1px solid #e2e8f0;
}

.photo-preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.photo-preview-remove {
    position: absolute;
    top: 5px;
    right: 5px;
    background: rgba(0, 0, 0, 0.65);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}

/* AI Helper Banner */
.ai-helper-banner {
    background: linear-gradient(135deg, #fdf2f8, #f5f3ff);
    border: 1px solid #fbcfe8;
    border-radius: var(--radius-md);
    padding: 1.25rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    gap: 1rem;
}

.btn-ai {
    background: linear-gradient(135deg, var(--accent-purple), #d946ef);
    color: #fff;
    border: none;
    padding: 0.75rem 1.4rem;
    border-radius: var(--radius-full);
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    white-space: nowrap;
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.3);
    transition: all 0.2s ease;
}

.btn-ai:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(139, 92, 246, 0.4);
}

/* Toggle Switch */
.toggle-box {
    margin-bottom: 2rem;
    padding: 1rem;
    background: #f8fafc;
    border-radius: 12px;
}

.switch-label {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    cursor: pointer;
}

.switch-slider {
    position: relative;
    width: 48px;
    height: 26px;
    background: #cbd5e1;
    border-radius: 9999px;
    transition: background 0.3s;
}

.switch-slider:before {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #fff;
    top: 3px;
    left: 3px;
    transition: transform 0.3s;
}

input:checked + .switch-slider {
    background: var(--primary);
}

input:checked + .switch-slider:before {
    transform: translateX(22px);
}

/* Dynamic Item Lists */
.dynamic-group {
    margin-bottom: 2rem;
}

.group-title {
    font-weight: 700;
    margin-bottom: 0.8rem;
    display: block;
}

.dynamic-list {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    margin-bottom: 0.8rem;
}

.dynamic-item {
    display: flex;
    gap: 0.6rem;
}

.btn-remove {
    background: #fee2e2;
    color: #b91c1c;
    border: none;
    border-radius: 10px;
    width: 44px;
    font-size: 1.2rem;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-remove:hover {
    background: #fecaca;
}

.btn-add-more {
    background: #f1f5f9;
    color: var(--text-main);
    border: 1px dashed #94a3b8;
    padding: 0.6rem 1.2rem;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-add-more:hover {
    background: #e2e8f0;
}

/* Color Picker */
.color-picker-wrap {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.form-color {
    width: 50px;
    height: 44px;
    padding: 0;
    border: 1.5px solid #cbd5e1;
    border-radius: 10px;
    cursor: pointer;
    background: none;
}

/* Summary Box */
.summary-box {
    background: #f8fafc;
    border-radius: var(--radius-md);
    padding: 1.5rem;
    margin-bottom: 2rem;
    border: 1px solid #e2e8f0;
}

.summary-row {
    padding: 0.5rem 0;
    border-bottom: 1px solid #eef2f6;
    display: flex;
    justify-content: space-between;
}

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

/* Publish Actions */
.publish-actions {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.btn-publish {
    flex: 1;
    background: linear-gradient(135deg, var(--primary), #fb7185);
    color: #fff;
    padding: 1.1rem;
    border: none;
    border-radius: 16px;
    font-size: 1.15rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 10px 25px var(--primary-glow);
    transition: all 0.3s ease;
}

.btn-publish:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 30px rgba(225, 29, 72, 0.4);
}

.btn-export-zip {
    flex: 1;
    background: #1e293b;
    color: #fff;
    padding: 1.1rem;
    border: none;
    border-radius: 16px;
    font-size: 1.05rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-export-zip:hover {
    background: #0f172a;
    transform: translateY(-2px);
}

/* Published Success Card */
.published-success-card {
    background: #fff;
    border: 2px solid var(--primary);
    border-radius: var(--radius-lg);
    padding: 2.5rem;
    text-align: center;
    margin-top: 2.5rem;
    box-shadow: var(--shadow-lg);
}

.link-box {
    text-align: left;
}

.copy-input-group {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.4rem;
}

.btn-copy {
    background: #1e293b;
    color: #fff;
    border: none;
    padding: 0 1.2rem;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}

/* Stepper Bottom Nav */
.stepper-nav {
    display: flex;
    justify-content: space-between;
    margin-top: 2rem;
}

.btn-prev {
    background: #fff;
    border: 1px solid #cbd5e1;
    padding: 0.85rem 1.8rem;
    border-radius: var(--radius-full);
    font-weight: 600;
    cursor: pointer;
}

.btn-next {
    margin-left: auto;
    background: var(--primary);
    color: #fff;
    border: none;
    padding: 0.85rem 2.2rem;
    border-radius: var(--radius-full);
    font-weight: 700;
    font-size: 1.05rem;
    cursor: pointer;
    box-shadow: 0 4px 15px var(--primary-glow);
    transition: all 0.2s ease;
}

.btn-next:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
}

/* Modal Overlay */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 1.5rem;
}

.modal-card {
    background: #fff;
    border-radius: var(--radius-lg);
    max-width: 580px;
    width: 100%;
    padding: 2rem;
    box-shadow: var(--shadow-lg);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.2rem;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.8rem;
    cursor: pointer;
    line-height: 1;
}

@media (max-width: 650px) {
    .form-grid {
        grid-template-columns: 1fr;
    }
    .publish-actions {
        flex-direction: column;
    }
}
