/* ============================================
   MapToPoster Generate Page
   MVP v1.0 - 2026-02-01
   
   Clean Flow Design: Configure → Preview → Download
   ============================================ */

.generate-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--bg-primary);
}

/* Header with Steps */
.generate-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 2rem;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.generate-header .logo {
    font-family: var(--font-serif);
    font-size: 1.25rem;
    color: var(--text-primary);
    text-decoration: none;
}

.generate-header .logo:hover {
    color: var(--accent);
}

.header-steps {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.step-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: 100px;
    font-size: 0.8125rem;
    color: var(--text-muted);
    transition: var(--transition-fast);
}

.step-indicator.active {
    background: var(--accent-soft);
    color: var(--accent);
}

.step-indicator.complete {
    color: #4ade80;
}

.step-num {
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary);
    border-radius: 50%;
    font-size: 0.75rem;
    font-weight: 500;
}

.step-indicator.active .step-num {
    background: var(--accent);
    color: var(--bg-primary);
}

.step-indicator.complete .step-num {
    background: #4ade80;
    color: var(--bg-primary);
}

.step-divider {
    width: 24px;
    height: 1px;
    background: var(--border);
}

.step-label {
    display: none;
}

@media (min-width: 600px) {
    .step-label {
        display: inline;
    }
}

.header-spacer {
    width: 100px;
}

/* Main */
.generate-main {
    flex: 1;
    position: relative;
}

/* Step Sections */
.step-section {
    display: none;
    animation: fadeIn 0.3s ease;
}

.step-section[data-active="true"] {
    display: block;
}

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

/* Step 1: Configure */
.step-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 3rem 2rem;
}

.step-header {
    text-align: center;
    margin-bottom: 3rem;
}

.step-header h1 {
    font-family: var(--font-serif);
    font-size: 2.5rem;
    font-weight: 400;
    margin-bottom: 0.5rem;
}

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

/* Config Cards */
.config-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.config-card-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

.config-num {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent);
    color: var(--bg-primary);
    border-radius: 50%;
    font-size: 0.875rem;
    font-weight: 600;
}

.config-card-header h2 {
    font-family: var(--font-serif);
    font-size: 1.25rem;
    font-weight: 400;
}

/* City Input */
.autocomplete-wrapper {
    position: relative;
}

.autocomplete-wrapper input {
    padding-left: 3rem;
}

.input-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
}

/* Theme Gallery */
.theme-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 0.75rem;
}

.theme-card {
    position: relative;
    border: 2px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: var(--transition-fast);
}

.theme-card:hover {
    border-color: var(--border-hover);
    transform: translateY(-2px);
}

.theme-card.selected {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-soft);
}

.theme-preview {
    height: 80px;
    position: relative;
    overflow: hidden;
}

.theme-preview-bg {
    position: absolute;
    inset: 0;
}

.theme-preview-roads {
    position: absolute;
    inset: 0;
    opacity: 0.8;
}

.theme-preview-roads svg {
    width: 100%;
    height: 100%;
}

.theme-info {
    padding: 0.625rem 0.75rem;
    background: var(--bg-card);
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
}

.theme-name {
    font-size: 0.8125rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.theme-desc {
    font-size: 0.6875rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.theme-card.selected .theme-name {
    color: var(--accent);
}

.theme-check {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    width: 20px;
    height: 20px;
    background: var(--accent);
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    color: var(--bg-primary);
}

.theme-card.selected .theme-check {
    display: flex;
}

/* Radius Gallery */
.radius-gallery {
    display: flex;
    gap: 0.75rem;
}

.radius-option {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem 0.5rem;
    background: var(--bg-tertiary);
    border: 2px solid var(--border);
    border-radius: 12px;
    cursor: pointer;
    transition: var(--transition-fast);
}

.radius-option:hover {
    border-color: var(--border-hover);
    background: var(--bg-card);
}

.radius-option.selected {
    border-color: var(--accent);
    background: var(--accent-soft);
}

.radius-preview {
    width: 48px;
    height: 48px;
    color: var(--text-muted);
}

.radius-option.selected .radius-preview {
    color: var(--accent);
}

.radius-label {
    font-size: 0.9375rem;
    font-weight: 500;
}

.radius-option.selected .radius-label {
    color: var(--accent);
}

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

/* Options Grid */
.options-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

@media (max-width: 600px) {
    .options-grid {
        grid-template-columns: 1fr;
    }
    
    .radius-gallery {
        flex-wrap: wrap;
    }
    
    .radius-option {
        min-width: calc(33% - 0.5rem);
    }
}

/* Config Actions */
.config-actions {
    margin-top: 2rem;
}

.config-actions .btn {
    font-size: 1.0625rem;
    padding: 1.125rem 2rem;
}

/* Step 2: Preview */
.preview-container {
    display: grid;
    grid-template-columns: 1fr 380px;
    min-height: calc(100vh - 60px);
}

@media (max-width: 900px) {
    .preview-container {
        grid-template-columns: 1fr;
    }
}

.preview-main {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    background: var(--bg-secondary);
}

.preview-image-wrapper {
    position: relative;
    max-width: 100%;
    max-height: 80vh;
}

.preview-image-wrapper img {
    max-width: 100%;
    max-height: 75vh;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.preview-badge {
    position: absolute;
    top: 1rem;
    left: 1rem;
    padding: 0.5rem 1rem;
    background: rgba(232, 197, 71, 0.9);
    color: var(--bg-primary);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-radius: 100px;
}

.preview-sidebar {
    padding: 2rem;
    background: var(--bg-card);
    border-left: 1px solid var(--border);
    display: flex;
    flex-direction: column;
}

.preview-info {
    margin-bottom: 2rem;
}

.preview-info h2 {
    font-family: var(--font-serif);
    font-size: 1.75rem;
    font-weight: 400;
    margin-bottom: 0.25rem;
}

.preview-info p {
    color: var(--text-secondary);
    font-size: 0.9375rem;
}

.preview-actions-main {
    margin-bottom: 1.5rem;
}

.preview-actions-main .btn {
    gap: 0.75rem;
}

.action-hint {
    text-align: center;
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin-top: 0.75rem;
}

.preview-divider {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 1.5rem 0;
    color: var(--text-muted);
    font-size: 0.8125rem;
}

.preview-divider::before,
.preview-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

.preview-actions-alt h3 {
    font-size: 1rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.preview-actions-alt p {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    line-height: 1.6;
}

.preview-actions-alt strong {
    color: var(--accent);
}

.preview-actions-alt .btn {
    gap: 0.5rem;
}

/* Previous Previews */
.previous-previews {
    margin-top: auto;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}

.previous-previews h4 {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.previews-mini-grid {
    display: flex;
    gap: 0.75rem;
}

.mini-preview {
    width: 70px;
    height: 93px;
    border-radius: 8px;
    overflow: hidden;
    border: 2px solid var(--border);
    cursor: pointer;
    transition: var(--transition-fast);
    position: relative;
}

.mini-preview:hover {
    border-color: var(--border-hover);
}

.mini-preview.active {
    border-color: var(--accent);
}

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

.mini-preview-remove {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 18px;
    height: 18px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    transition: var(--transition-fast);
}

.mini-preview:hover .mini-preview-remove {
    opacity: 1;
}

.mini-preview-remove svg {
    width: 10px;
    height: 10px;
    color: var(--text-muted);
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(10, 10, 10, 0.95);
    backdrop-filter: blur(10px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 200;
}

.loading-overlay.active {
    display: flex;
}

.loading-card {
    text-align: center;
}

.progress-ring {
    position: relative;
    width: 160px;
    height: 160px;
    margin: 0 auto 2rem;
}

.progress-ring svg {
    transform: rotate(-90deg);
    width: 100%;
    height: 100%;
}

.progress-ring-bg {
    fill: none;
    stroke: var(--bg-tertiary);
    stroke-width: 6;
}

.progress-ring-fill {
    fill: none;
    stroke: var(--accent);
    stroke-width: 6;
    stroke-linecap: round;
    stroke-dasharray: 283;
    stroke-dashoffset: 283;
    transition: stroke-dashoffset 0.3s ease;
}

.progress-percent {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-sans);
    font-size: 2.5rem;
    font-weight: 500;
    color: var(--text-primary);
}

.progress-status {
    font-size: 1rem;
    color: var(--text-secondary);
}

/* Button States */
#generateBtn .btn-loading {
    display: none;
    align-items: center;
    gap: 0.75rem;
}

#generateBtn.loading .btn-text {
    display: none;
}

#generateBtn.loading .btn-loading {
    display: flex;
}

/* Responsive */
@media (max-width: 600px) {
    .generate-header {
        padding: 1rem;
    }
    
    .step-container {
        padding: 2rem 1rem;
    }
    
    .theme-gallery {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    }
    
    .theme-preview {
        height: 60px;
    }
    
    .preview-sidebar {
        padding: 1.5rem;
    }
}
