/* ===========================================
   HEIRLOOM WARMTH THEME
   A warm, nostalgic design that honors family heritage
   =========================================== */

/* CSS Variables - Heirloom Warmth Palette */
:root {
    /* Core Colors */
    --color-background: #FAF8F5;
    --color-surface: #F5F2EC;
    --color-surface-elevated: #FFFFFF;
    --color-primary: #8B7355;
    --color-primary-dark: #6B5A45;
    --color-primary-light: #A89070;
    --color-accent: #C67B5C;
    --color-accent-light: rgba(198, 123, 92, 0.15);

    /* Text Colors */
    --color-text: #3D3229;
    --color-text-secondary: #6B5E52;
    --color-text-muted: #9C9488;
    --color-text-inverse: #FFFCF8;

    /* UI Colors */
    --color-border: #E5DED4;
    --color-border-dark: #C9BFB1;
    --color-success: #7D8B6A;
    --color-success-light: rgba(125, 139, 106, 0.15);
    --color-warning: #D4A853;
    --color-warning-light: rgba(212, 168, 83, 0.15);
    --color-error: #C45C5C;
    --color-error-light: rgba(196, 92, 92, 0.1);

    /* Typography */
    --font-display: 'Lora', 'Playfair Display', Georgia, serif;
    --font-body: 'Lato', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-accent: 'Caveat', cursive;

    /* Spacing */
    --spacing-xs: 0.5rem;
    --spacing-sm: 1rem;
    --spacing-md: 1.5rem;
    --spacing-lg: 2rem;
    --spacing-xl: 3rem;
    --spacing-2xl: 4rem;

    /* Borders & Shadows */
    --border-radius-sm: 6px;
    --border-radius: 10px;
    --border-radius-lg: 16px;
    --shadow-soft: 0 2px 8px rgba(61, 50, 41, 0.06);
    --shadow-medium: 0 4px 16px rgba(61, 50, 41, 0.08);
    --shadow-elevated: 0 8px 32px rgba(61, 50, 41, 0.12);
    --shadow-glow: 0 0 0 4px rgba(139, 115, 85, 0.15);

    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition: 0.25s ease;
    --transition-slow: 0.4s ease;
}

/* ===========================================
   Reset & Base Styles
   =========================================== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
    overflow-x: hidden;
}

body {
    font-family: var(--font-body);
    background-color: var(--color-background);
    color: var(--color-text);
    line-height: 1.65;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

/* Subtle paper texture overlay */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
    opacity: 0.015;
    pointer-events: none;
    z-index: 0;
}

/* ===========================================
   Back Link
   =========================================== */
.back-link {
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 100;
    background: var(--color-surface-elevated);
    padding: 10px 18px;
    border-radius: 25px;
    box-shadow: var(--shadow-medium);
    text-decoration: none;
    color: var(--color-primary);
    font-size: 0.9rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition);
}

.back-link:hover {
    background: var(--color-primary);
    color: var(--color-text-inverse);
    transform: translateX(-3px);
}

.back-link span {
    font-size: 1.1rem;
}

@media (max-width: 768px) {
    .back-link {
        top: 10px;
        left: 10px;
        padding: 8px 14px;
        font-size: 0.85rem;
    }
}

/* ===========================================
   Container & Layout
   =========================================== */
.container {
    max-width: 900px;
    margin: 0 auto;
    padding: var(--spacing-md);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 1;
    width: 100%;
    box-sizing: border-box;
}

/* ===========================================
   Header
   =========================================== */
.header {
    text-align: center;
    padding: var(--spacing-xl) 0 var(--spacing-lg);
    margin-bottom: var(--spacing-lg);
    position: relative;
}

.header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 120px;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--color-primary), transparent);
}

/* Usage Indicator */
.usage-indicator {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    padding: 8px 16px;
    border-radius: 20px;
    margin-top: var(--spacing-md);
    font-size: 0.875rem;
}

.usage-indicator.hidden {
    display: none;
}

.usage-count {
    color: var(--color-primary);
    font-weight: 600;
}

.usage-period {
    color: var(--color-text-muted);
}

.usage-indicator.usage-low .usage-count {
    color: var(--color-warning);
}

.usage-indicator.usage-critical .usage-count {
    color: var(--color-error);
}

.logo {
    font-family: var(--font-display);
    font-size: 2.75rem;
    font-weight: 600;
    color: var(--color-primary);
    letter-spacing: -0.02em;
    margin-bottom: var(--spacing-xs);
}

.tagline {
    font-family: var(--font-accent);
    font-size: 1.35rem;
    color: var(--color-text-secondary);
    margin-top: var(--spacing-xs);
}

/* ===========================================
   Main Content
   =========================================== */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding-top: var(--spacing-md);
}

/* ===========================================
   Step Sections (Cards)
   =========================================== */
.step {
    width: 100%;
    max-width: 620px;
    padding: var(--spacing-xl);
    background: var(--color-surface-elevated);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-medium);
    border: 1px solid var(--color-border);
    position: relative;
    animation: fadeSlideUp 0.4s ease;
    box-sizing: border-box;
}

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

.step h2 {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 1.85rem;
    color: var(--color-text);
    margin-bottom: var(--spacing-sm);
    text-align: center;
    letter-spacing: -0.01em;
}

.step-description {
    text-align: center;
    color: var(--color-text-secondary);
    margin-bottom: var(--spacing-lg);
    font-size: 1.05rem;
    line-height: 1.7;
}

.hidden {
    display: none !important;
}

/* ===========================================
   Welcome Section
   =========================================== */
.welcome-section {
    text-align: center;
}

.welcome-section p {
    margin-bottom: var(--spacing-xl);
    color: var(--color-text-secondary);
    font-size: 1.1rem;
    line-height: 1.8;
    max-width: 480px;
    margin-left: auto;
    margin-right: auto;
}

/* ===========================================
   Buttons
   =========================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-xs);
    padding: 0.875rem 1.75rem;
    font-family: var(--font-body);
    font-size: 1rem;
    font-weight: 500;
    text-decoration: none;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: all var(--transition);
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(180deg, rgba(255,255,255,0.1) 0%, transparent 50%);
    pointer-events: none;
}

.btn-primary {
    background: linear-gradient(180deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
    color: var(--color-text-inverse);
    box-shadow: 0 2px 8px rgba(139, 115, 85, 0.25), inset 0 1px 0 rgba(255,255,255,0.1);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(139, 115, 85, 0.35), inset 0 1px 0 rgba(255,255,255,0.15);
}

.btn-primary:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(139, 115, 85, 0.2);
}

.btn-secondary {
    background: var(--color-surface);
    color: var(--color-text-secondary);
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow-soft);
}

.btn-secondary:hover {
    background: var(--color-surface-elevated);
    border-color: var(--color-border-dark);
    color: var(--color-text);
    transform: translateY(-1px);
}

.btn-text {
    background: none;
    border: none;
    color: var(--color-primary);
    padding: 0.5rem 1rem;
    box-shadow: none;
}

.btn-text::before {
    display: none;
}

.btn-text:hover {
    color: var(--color-primary-dark);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none;
}

.btn-small {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
}

.btn-large {
    padding: 1rem 2rem;
    font-size: 1.1rem;
}

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: none;
    background: transparent;
    color: var(--color-text-muted);
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
    font-size: 1.1rem;
}

.btn-icon:hover {
    background: var(--color-surface);
    color: var(--color-text);
}

.btn-icon.btn-delete:hover {
    background: var(--color-error-light);
    color: var(--color-error);
}

/* Button Groups */
.button-group {
    display: flex;
    justify-content: space-between;
    gap: var(--spacing-sm);
    margin-top: var(--spacing-lg);
}

.button-group-three {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--spacing-sm);
}

/* ===========================================
   Form Elements
   =========================================== */
.form-group {
    margin-bottom: var(--spacing-md);
}

.form-label {
    display: block;
    font-weight: 500;
    color: var(--color-text);
    margin-bottom: var(--spacing-xs);
    font-size: 0.95rem;
    letter-spacing: 0.01em;
}

.form-input,
.form-textarea,
.form-select {
    width: 100%;
    padding: 0.875rem 1rem;
    font-family: var(--font-body);
    font-size: 1rem;
    color: var(--color-text);
    background: var(--color-surface);
    border: 1.5px solid var(--color-border);
    border-radius: var(--border-radius);
    transition: all var(--transition-fast);
}

.form-input:hover,
.form-textarea:hover,
.form-select:hover {
    border-color: var(--color-border-dark);
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: var(--shadow-glow);
    background: var(--color-surface-elevated);
}

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

.form-textarea {
    resize: vertical;
    min-height: 100px;
    line-height: 1.6;
}

.form-row {
    display: flex;
    gap: var(--spacing-sm);
}

.form-group-small {
    flex: 1;
}

.field-description {
    font-size: 0.9rem;
    color: var(--color-text-muted);
    margin-bottom: var(--spacing-sm);
    line-height: 1.5;
}

/* ===========================================
   Recipe Input Section
   =========================================== */
.recipe-input-section {
    position: relative;
}

.input-container {
    margin-bottom: var(--spacing-md);
}

.recipe-textarea {
    width: 100%;
    min-height: 280px;
    padding: var(--spacing-md);
    font-family: var(--font-body);
    font-size: 1rem;
    line-height: 1.7;
    color: var(--color-text);
    background: var(--color-surface);
    border: 2px solid var(--color-border);
    border-radius: var(--border-radius);
    resize: vertical;
    transition: all var(--transition);
}

.recipe-textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: var(--shadow-glow);
    background: var(--color-surface-elevated);
}

.recipe-textarea::placeholder {
    color: var(--color-text-muted);
    font-style: italic;
}

/* ===========================================
   Loading Overlay
   =========================================== */
.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 252, 248, 0.97);
    border-radius: var(--border-radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    backdrop-filter: blur(4px);
}

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

.spinner {
    width: 48px;
    height: 48px;
    border: 3px solid var(--color-border);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto var(--spacing-md);
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-text {
    color: var(--color-text-secondary);
    font-size: 1.05rem;
}

.loading-phases {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: var(--spacing-sm);
}

.phase-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--color-border);
    transition: all 0.3s ease;
}

.phase-dot.active {
    background: var(--color-primary);
    transform: scale(1.3);
    box-shadow: 0 0 8px rgba(139, 115, 85, 0.4);
}

.phase-dot.complete {
    background: var(--color-success);
}

/* ===========================================
   Enhancement Options
   =========================================== */
.enhancement-options {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius);
    margin-bottom: var(--spacing-md);
    overflow: hidden;
}

.enhancement-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-sm) var(--spacing-md);
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--color-text-secondary);
    transition: all var(--transition-fast);
}

.enhancement-header:hover {
    background: var(--color-surface-elevated);
    color: var(--color-text);
}

.toggle-arrow {
    transition: transform var(--transition);
    font-size: 0.75rem;
}

.enhancement-header.open .toggle-arrow {
    transform: rotate(180deg);
}

.enhancement-body {
    padding: var(--spacing-md);
    border-top: 1px solid var(--color-border);
    background: var(--color-surface-elevated);
}

.enhancement-row {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-sm);
}

.enhancement-row:last-child {
    margin-bottom: 0;
}

.enhancement-label {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    font-size: 0.9rem;
    cursor: pointer;
    color: var(--color-text-secondary);
}

.enhancement-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--color-primary);
    cursor: pointer;
}

.servings-input {
    width: 60px;
    padding: 6px 10px;
    font-size: 0.9rem;
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius-sm);
    background: var(--color-surface);
    text-align: center;
}

.unit-select {
    padding: 6px 12px;
    font-size: 0.9rem;
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius-sm);
    background: var(--color-surface);
    cursor: pointer;
}

/* ===========================================
   Recipe Picker Section
   =========================================== */
.recipe-picker-section {
    max-width: 100%;
    width: 100%;
}

.recipe-picker-list {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-md);
}

.recipe-picker-option {
    background: var(--color-surface);
    border: 2px solid var(--color-border);
    border-radius: var(--border-radius);
    padding: var(--spacing-md);
    cursor: pointer;
    transition: all var(--transition);
}

.recipe-picker-option:hover {
    border-color: var(--color-primary-light);
    transform: translateX(4px);
}

.recipe-picker-option.selected {
    border-color: var(--color-primary);
    background: var(--color-accent-light);
    box-shadow: var(--shadow-glow);
}

.recipe-picker-option h4 {
    margin: 0 0 var(--spacing-xs) 0;
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--color-text);
}

.recipe-picker-option p {
    margin: 0;
    font-size: 0.9rem;
    color: var(--color-text-muted);
}

/* ===========================================
   Quality Review Section
   =========================================== */
.quality-review-section {
    max-width: 100%;
    width: 100%;
}

.quality-issues-list {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-md);
}

.quality-issue {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius);
    padding: var(--spacing-md);
}

.quality-issue.critical {
    border-left: 4px solid var(--color-error);
    background: var(--color-error-light);
}

.quality-issue.warning {
    border-left: 4px solid var(--color-warning);
    background: var(--color-warning-light);
}

.quality-issue-header {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-sm);
}

.quality-badge {
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.quality-badge.critical {
    background: var(--color-error);
    color: white;
}

.quality-badge.warning {
    background: var(--color-warning);
    color: var(--color-text);
}

.quality-issue-message {
    font-size: 0.95rem;
    color: var(--color-text);
}

.quality-issue-fix {
    margin-top: var(--spacing-sm);
}

.quality-issue-fix input,
.quality-issue-fix select {
    width: 100%;
    padding: 10px 14px;
    font-size: 0.95rem;
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius-sm);
    background: var(--color-surface-elevated);
}

/* ===========================================
   Editor Section
   =========================================== */
.editor-section {
    max-width: 100%;
    width: 100%;
}

/* Flags Alert */
.flags-alert {
    background: var(--color-warning-light);
    border: 1px solid var(--color-warning);
    border-radius: var(--border-radius);
    padding: var(--spacing-md);
    margin-bottom: var(--spacing-lg);
}

.flags-header {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-sm);
    color: var(--color-text);
}

.flags-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background: var(--color-warning);
    color: white;
    border-radius: 50%;
    font-size: 0.8rem;
    font-weight: bold;
}

.flags-list {
    list-style: none;
    margin-bottom: var(--spacing-sm);
}

.flags-list li {
    padding: var(--spacing-xs) 0;
    color: var(--color-text-secondary);
    font-size: 0.9rem;
    border-bottom: 1px solid rgba(212, 168, 83, 0.3);
}

.flags-list li:last-child {
    border-bottom: none;
}

/* Ingredients Table */
.ingredients-table-wrapper {
    overflow-x: auto;
    margin-bottom: var(--spacing-sm);
    border-radius: var(--border-radius);
    border: 1px solid var(--color-border);
}

.ingredients-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
}

.ingredients-table th {
    text-align: left;
    padding: var(--spacing-sm);
    background: var(--color-surface);
    color: var(--color-text-muted);
    font-weight: 500;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 2px solid var(--color-border);
}

.ingredients-table td {
    padding: var(--spacing-sm);
    border-bottom: 1px solid var(--color-border);
    vertical-align: middle;
    background: var(--color-surface-elevated);
}

.ingredients-table tr:last-child td {
    border-bottom: none;
}

.ingredients-table .col-amount { width: 80px; }
.ingredients-table .col-unit { width: 100px; }
.ingredients-table .col-item { width: auto; }
.ingredients-table .col-actions { width: 44px; text-align: center; }

.ingredients-table input,
.ingredients-table select {
    width: 100%;
    padding: 8px 10px;
    font-size: 0.95rem;
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius-sm);
    background: var(--color-surface);
    transition: all var(--transition-fast);
}

.ingredients-table input:focus,
.ingredients-table select:focus {
    outline: none;
    border-color: var(--color-primary);
    background: var(--color-surface-elevated);
}

.ingredient-row.flagged td {
    background: var(--color-warning-light);
}

.ingredient-row.flagged input,
.ingredient-row.flagged select {
    border-color: var(--color-warning);
}

/* Instructions List */
.instructions-list {
    margin-bottom: var(--spacing-sm);
}

.instruction-item {
    display: flex;
    align-items: flex-start;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius);
    margin-bottom: var(--spacing-xs);
    transition: all var(--transition-fast);
}

.instruction-item:hover {
    border-color: var(--color-border-dark);
}

.instruction-item.flagged {
    border-color: var(--color-warning);
    background: var(--color-warning-light);
}

.instruction-number {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    background: linear-gradient(180deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
    color: var(--color-text-inverse);
    border-radius: 50%;
    font-size: 0.9rem;
    font-weight: 600;
    flex-shrink: 0;
}

.instruction-text {
    flex: 1;
    padding: 8px 10px;
    font-family: var(--font-body);
    font-size: 0.95rem;
    line-height: 1.5;
    border: 1px solid transparent;
    border-radius: var(--border-radius-sm);
    background: transparent;
    resize: none;
    min-height: 44px;
    transition: all var(--transition-fast);
}

.instruction-text:focus {
    outline: none;
    border-color: var(--color-primary);
    background: var(--color-surface-elevated);
}

.instruction-actions {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

/* ===========================================
   Story Section
   =========================================== */
.story-section {
    max-width: 100%;
    width: 100%;
}

.story-section-group {
    margin-top: var(--spacing-lg);
    padding-top: var(--spacing-lg);
    border-top: 1px solid var(--color-border);
}

.section-subtitle {
    font-family: var(--font-display);
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--color-primary);
    margin-bottom: var(--spacing-md);
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.section-subtitle::before {
    content: '';
    width: 4px;
    height: 20px;
    background: var(--color-accent);
    border-radius: 2px;
}

/* Photo Upload Areas */
.photo-upload-area,
.handwriting-upload-area {
    border: 2px dashed var(--color-border);
    border-radius: var(--border-radius);
    padding: var(--spacing-xl);
    text-align: center;
    cursor: pointer;
    transition: all var(--transition);
    background: var(--color-surface);
    position: relative;
}

.photo-upload-area:hover,
.photo-upload-area.dragover,
.handwriting-upload-area:hover,
.handwriting-upload-area.dragover {
    border-color: var(--color-primary);
    background: var(--color-accent-light);
}

.photo-upload-area.has-image,
.handwriting-upload-area.has-image {
    border-style: solid;
    cursor: default;
    padding: var(--spacing-md);
    background: var(--color-surface-elevated);
}

.upload-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-xs);
}

.upload-icon {
    font-size: 2.5rem;
    opacity: 0.8;
}

.upload-text {
    font-size: 1rem;
    color: var(--color-text);
    font-weight: 500;
}

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

.upload-preview {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-sm);
}

.upload-preview img {
    max-width: 100%;
    max-height: 220px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-medium);
    object-fit: contain;
}

.remove-image-btn {
    color: var(--color-error) !important;
}

.photo-upload-small {
    padding: var(--spacing-md);
}

.photo-upload-small .upload-icon {
    font-size: 1.75rem;
}

.photo-upload-small .upload-text {
    font-size: 0.9rem;
}

.photo-upload-small .upload-preview img {
    max-height: 150px;
}

.photo-uploads-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--spacing-md);
}

.caption-group {
    margin-top: var(--spacing-sm);
}

/* Heritage Indicator */
.heritage-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-xs);
    margin-top: var(--spacing-md);
    padding: var(--spacing-sm) var(--spacing-md);
    background: linear-gradient(135deg, var(--color-surface) 0%, var(--color-accent-light) 100%);
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius);
    color: var(--color-text);
}

.heritage-icon {
    font-size: 1.25rem;
}

.heritage-text {
    font-size: 0.9rem;
    color: var(--color-text-secondary);
}

/* ===========================================
   Style Selection Section
   =========================================== */
.style-section {
    max-width: 100%;
    width: 100%;
}

.style-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--spacing-xl);
    margin-bottom: var(--spacing-lg);
}

/* Stacked layout - preview below options */
.style-layout.style-layout-stacked {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-lg);
}

.style-layout-stacked .style-options {
    width: 100%;
}

.style-layout-stacked .preview-panel-large {
    width: 100%;
}

.style-options {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}

/* Theme Gallery */
.theme-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: var(--spacing-sm);
    max-height: 280px;
    overflow-y: auto;
    padding: var(--spacing-xs);
    background: var(--color-surface);
    border-radius: var(--border-radius);
    border: 1px solid var(--color-border);
}

.theme-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: var(--spacing-sm);
    background: var(--color-surface-elevated);
    border: 2px solid var(--color-border);
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: all var(--transition);
}

.theme-card:hover:not(:disabled) {
    border-color: var(--color-primary-light);
    transform: translateY(-3px);
    box-shadow: var(--shadow-medium);
}

.theme-card.selected {
    border-color: var(--color-primary);
    box-shadow: var(--shadow-glow), var(--shadow-medium);
}

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

.theme-preview {
    width: 100%;
    aspect-ratio: 4/3;
    border-radius: var(--border-radius-sm);
    padding: 10px;
    margin-bottom: var(--spacing-xs);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.theme-preview .tp-title {
    font-size: 11px;
    font-weight: 600;
    margin-bottom: 6px;
}

.theme-preview .tp-line {
    width: 80%;
    height: 3px;
    border-radius: 2px;
    margin: 2px 0;
}

.theme-preview .tp-line.short {
    width: 50%;
}

/* Theme preview colors */
.theme-preview-clean-modern {
    background: #ffffff;
    border: 1px solid #eee;
}
.theme-preview-clean-modern .tp-title { color: #333; }
.theme-preview-clean-modern .tp-line { background: #ddd; }

.theme-preview-classic-kitchen {
    background: #FDF8F3;
    border: 1px solid #D4AF37;
}
.theme-preview-classic-kitchen .tp-title { color: #3D3229; font-family: 'Playfair Display', serif; }
.theme-preview-classic-kitchen .tp-line { background: #D4AF37; }

.theme-preview-chalkboard {
    background: #2C2C2C;
}
.theme-preview-chalkboard .tp-title { color: #F5F5DC; font-family: 'Amatic SC', cursive; font-size: 13px; }
.theme-preview-chalkboard .tp-line { background: rgba(245, 245, 220, 0.5); }

.theme-preview-minimalist-mono {
    background: #ffffff;
    border: 1px solid #000;
}
.theme-preview-minimalist-mono .tp-title { color: #000; font-family: 'JetBrains Mono', monospace; font-size: 9px; }
.theme-preview-minimalist-mono .tp-line { background: #000; }

.theme-preview-farmhouse {
    background: #FAF7F2;
    border: 1px solid #7D9B76;
}
.theme-preview-farmhouse .tp-title { color: #2D2D2D; font-family: 'Caveat', cursive; font-size: 13px; }
.theme-preview-farmhouse .tp-line { background: #7D9B76; }

.theme-preview-elegant-script {
    background: #ffffff;
    border: 1px solid #D4AF37;
}
.theme-preview-elegant-script .tp-title { color: #1A1A1A; font-family: 'Great Vibes', cursive; font-size: 12px; }
.theme-preview-elegant-script .tp-line { background: #D4AF37; }

.theme-preview-retro-diner {
    background: #FFF8E7;
    border: 2px solid #8B0000;
}
.theme-preview-retro-diner .tp-title { color: #8B0000; font-family: 'Pacifico', cursive; font-size: 10px; }
.theme-preview-retro-diner .tp-line { background: #8B0000; }

.theme-preview-garden-botanical {
    background: #ffffff;
    border: 1px solid #2D4A3E;
}
.theme-preview-garden-botanical .tp-title { color: #2D4A3E; font-family: 'Cormorant Infant', serif; font-size: 11px; }
.theme-preview-garden-botanical .tp-line { background: #A8C5A8; }

.theme-preview-warm-sunset {
    background: #FFF5EB;
    border: 1px solid #C4784A;
}
.theme-preview-warm-sunset .tp-title { color: #4A3728; font-family: 'Quicksand', sans-serif; font-size: 10px; }
.theme-preview-warm-sunset .tp-line { background: #C4784A; }

.theme-preview-heritage {
    background: #F4ECD8;
    border: 1px solid #5C4033;
}
.theme-preview-heritage .tp-title { color: #5C4033; font-family: 'Special Elite', cursive; font-size: 9px; }
.theme-preview-heritage .tp-line { background: #8B7355; }

.theme-preview-bright-cheerful {
    background: #ffffff;
    border: 2px solid #FF6B6B;
}
.theme-preview-bright-cheerful .tp-title { color: #333; font-family: 'Poppins', sans-serif; font-size: 10px; }
.theme-preview-bright-cheerful .tp-line { background: #FF6B6B; }

.theme-preview-holiday-christmas {
    background: #FDF8F5;
    border: 2px solid #C41E3A;
}
.theme-preview-holiday-christmas .tp-title { color: #165B33; font-family: 'Playfair Display', serif; font-size: 10px; }
.theme-preview-holiday-christmas .tp-line { background: #C41E3A; }

.theme-preview-holiday-thanksgiving {
    background: #FDF5E6;
    border: 2px solid #CC5500;
}
.theme-preview-holiday-thanksgiving .tp-title { color: #8B4513; font-family: 'Lora', serif; font-size: 10px; }
.theme-preview-holiday-thanksgiving .tp-line { background: #CC5500; }

.theme-preview-cottagecore {
    background: #FAF6F1;
    border: 1px solid #C9B8A8;
}
.theme-preview-cottagecore .tp-title { color: #5D4E42; font-family: 'Playfair Display', serif; font-size: 10px; }
.theme-preview-cottagecore .tp-line { background: #C9B8A8; }

.theme-preview-mediterranean {
    background: #FFFCF7;
    border: 2px solid #C67B5C;
}
.theme-preview-mediterranean .tp-title { color: #C67B5C; font-family: 'Georgia', serif; font-size: 10px; }
.theme-preview-mediterranean .tp-line { background: #6B8E6B; }

.theme-preview-dark-moody {
    background: #1A1A1A;
    border: 1px solid #3A3A3A;
}
.theme-preview-dark-moody .tp-title { color: #F5F0EB; font-family: 'Playfair Display', serif; font-size: 10px; }
.theme-preview-dark-moody .tp-line { background: #C9A86C; }

.theme-preview-nyt-cooking {
    background: #FFFFFF;
    border-top: 3px solid #121212;
    border-bottom: 1px solid #E0E0E0;
    border-left: none;
    border-right: none;
}
.theme-preview-nyt-cooking .tp-title { color: #121212; font-family: Georgia, serif; font-weight: 700; font-size: 10px; }
.theme-preview-nyt-cooking .tp-line { background: #121212; }

.theme-preview-bon-appetit {
    background: #FFFFFF;
    border: none;
    border-left: 4px solid #E60000;
}
.theme-preview-bon-appetit .tp-title { color: #1A1A1A; font-weight: 700; text-transform: uppercase; font-size: 9px; }
.theme-preview-bon-appetit .tp-line { background: #E60000; }

.theme-preview-sage-terracotta {
    background: #FDFBF7;
    border: 1px solid #B8C5B3;
}
.theme-preview-sage-terracotta .tp-title { color: #C67B5C; font-family: Georgia, serif; font-size: 10px; }
.theme-preview-sage-terracotta .tp-line { background: #6B8E6B; }

.theme-preview-french-bistro {
    background: #FFFEF9;
    border: 2px solid #8B0000;
}
.theme-preview-french-bistro .tp-title { color: #8B0000; font-family: 'Playfair Display', serif; font-style: italic; font-size: 10px; }
.theme-preview-french-bistro .tp-line { background: #8B0000; }

.theme-preview-japanese-zen {
    background: #FAF8F5;
    border: none;
    border-bottom: 2px solid #2B2B2B;
}
.theme-preview-japanese-zen .tp-title { color: #2B2B2B; font-family: sans-serif; letter-spacing: 0.05em; font-size: 9px; }
.theme-preview-japanese-zen .tp-line { background: #999999; }

.theme-preview-scandinavian {
    background: #FFFFFF;
    border: 1px solid #E8E8E8;
    box-shadow: 0 1px 4px rgba(0,0,0,0.05);
}
.theme-preview-scandinavian .tp-title { color: #2C3E50; font-family: sans-serif; font-size: 10px; }
.theme-preview-scandinavian .tp-line { background: #95A5A6; }

.theme-preview-luxury-gold {
    background: linear-gradient(135deg, #FFFEF9, #FDF8EE);
    border: 1px solid #D4AF37;
}
.theme-preview-luxury-gold .tp-title { color: #D4AF37; font-family: Georgia, serif; font-size: 10px; letter-spacing: 0.05em; }
.theme-preview-luxury-gold .tp-line { background: #D4AF37; }

.theme-name {
    font-size: 0.8rem;
    color: var(--color-text-secondary);
    font-weight: 500;
}

/* ===========================================
   Format Gallery
   =========================================== */
.format-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(95px, 1fr));
    gap: var(--spacing-sm);
    max-height: 220px;
    overflow-y: auto;
    padding: var(--spacing-xs);
    background: var(--color-surface);
    border-radius: var(--border-radius);
    border: 1px solid var(--color-border);
}

.format-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 8px;
    background: var(--color-surface-elevated);
    border: 2px solid var(--color-border);
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: all var(--transition);
    gap: 4px;
}

.format-card:hover:not(:disabled) {
    border-color: var(--color-primary-light);
    transform: translateY(-2px);
    box-shadow: var(--shadow-medium);
}

.format-card.selected {
    border-color: var(--color-primary);
    box-shadow: var(--shadow-glow), var(--shadow-medium);
    background: var(--color-accent-light);
}

.format-preview {
    width: 100%;
    aspect-ratio: 8.5/11;
    border-radius: 2px;
    padding: 4px;
    background: #fff;
    border: 1px solid var(--color-border);
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.format-name {
    font-size: 0.75rem;
    color: var(--color-text);
    font-weight: 600;
    text-align: center;
    line-height: 1.2;
}

.format-desc {
    font-size: 0.65rem;
    color: var(--color-text-muted);
    text-align: center;
}

/* Format preview elements */
.fp-header {
    height: 12%;
    background: var(--color-border);
    border-radius: 1px;
}

.fp-cols {
    display: flex;
    gap: 2px;
    flex: 1;
}

.fp-col-narrow {
    flex: 0.8;
    background: var(--color-surface);
    border-radius: 1px;
}

.fp-col-wide {
    flex: 1.2;
    background: var(--color-surface);
    border-radius: 1px;
}

/* Magazine format preview */
.fp-hero-large {
    height: 35%;
    background: var(--color-accent-light);
    border-radius: 1px;
}

.fp-content-below {
    flex: 1;
    background: var(--color-surface);
    border-radius: 1px;
}

/* Elegant format preview */
.format-preview-elegant {
    padding: 6px 10px;
    gap: 4px;
}

.fp-elegant-header {
    height: 15%;
    background: var(--color-border);
    border-radius: 1px;
    margin: 0 15%;
}

.fp-elegant-section {
    flex: 1;
    background: var(--color-surface);
    border-radius: 1px;
    margin: 0 8%;
}

/* Compact format preview */
.format-preview-compact {
    padding: 3px;
    gap: 2px;
}

.fp-compact-header {
    height: 10%;
    background: var(--color-border);
    border-radius: 1px;
}

.fp-compact-cols {
    display: flex;
    gap: 2px;
    flex: 1;
}

.fp-compact-col {
    flex: 1;
    background: var(--color-surface);
    border-radius: 1px;
}

/* Heritage format preview */
.fp-story-block {
    height: 20%;
    background: linear-gradient(135deg, var(--color-accent-light), var(--color-surface));
    border-radius: 1px;
    border: 1px dashed var(--color-border-dark);
}

/* Cookbook format preview */
.format-preview-cookbook {
    flex-direction: row;
    gap: 0;
    padding: 0;
    overflow: hidden;
}

.fp-cookbook-photo {
    width: 45%;
    background: var(--color-accent-light);
}

.fp-cookbook-content {
    flex: 1;
    background: var(--color-surface);
    margin: 3px;
    border-radius: 1px;
}

/* Step Cards format preview */
.format-preview-steps {
    flex-direction: column;
    gap: 2px;
    justify-content: center;
}

.fp-step-card {
    width: 85%;
    height: 10px;
    background: linear-gradient(90deg, var(--color-primary-light) 20%, var(--color-surface-elevated) 20%);
    border-radius: 2px;
    border: 1px solid var(--color-border);
}

/* Infographic format preview */
.format-preview-infographic {
    flex-direction: column;
    gap: 3px;
    padding: 4px;
}

.fp-info-header {
    width: 60%;
    height: 8px;
    background: var(--color-primary);
    border-radius: 2px;
    align-self: center;
}

.fp-info-icons {
    display: flex;
    justify-content: center;
    gap: 4px;
}

.fp-icon {
    width: 12px;
    height: 12px;
    background: var(--color-accent-light);
    border-radius: 50%;
    border: 1px solid var(--color-primary-light);
}

.fp-info-flow {
    width: 80%;
    height: 6px;
    background: linear-gradient(90deg, var(--color-primary-light), var(--color-accent-light));
    border-radius: 3px;
    align-self: center;
}

/* Mise en Place format preview */
.format-preview-mise {
    flex-direction: column;
    gap: 3px;
    padding: 3px;
}

.fp-mise-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2px;
    flex: 1;
}

.fp-mise-item {
    background: var(--color-surface-elevated);
    border: 1px solid var(--color-border);
    border-radius: 2px;
}

.fp-mise-steps {
    height: 10px;
    background: var(--color-primary-light);
    border-radius: 2px;
}

/* Newspaper format preview */
.format-preview-newspaper {
    flex-direction: column;
    gap: 3px;
    padding: 4px 8px;
}

.fp-news-title {
    width: 70%;
    height: 10px;
    background: var(--color-text);
    align-self: center;
}

.fp-news-col {
    flex: 1;
    width: 60%;
    background: repeating-linear-gradient(
        0deg,
        var(--color-border) 0px,
        var(--color-border) 1px,
        transparent 1px,
        transparent 4px
    );
    align-self: center;
}

/* Poster format preview */
.format-preview-poster {
    flex-direction: column;
    gap: 4px;
    padding: 4px;
    background: var(--color-surface-elevated);
}

.fp-poster-title {
    width: 80%;
    height: 14px;
    background: var(--color-primary);
    align-self: center;
    border-radius: 2px;
}

.fp-poster-content {
    flex: 1;
    width: 90%;
    background: repeating-linear-gradient(
        0deg,
        var(--color-border-dark) 0px,
        var(--color-border-dark) 1px,
        transparent 1px,
        transparent 5px
    );
    align-self: center;
}

/* Checklist format preview */
.format-preview-checklist {
    flex-direction: column;
    gap: 3px;
    padding: 5px;
}

.fp-check-item {
    display: flex;
    align-items: center;
    gap: 4px;
    height: 8px;
}

.fp-checkbox {
    width: 8px;
    height: 8px;
    border: 1.5px solid var(--color-primary);
    border-radius: 2px;
    flex-shrink: 0;
}

.fp-check-item::after {
    content: '';
    flex: 1;
    height: 4px;
    background: var(--color-border-dark);
    border-radius: 1px;
}

/* Photo Essay format preview */
.format-preview-essay {
    flex-direction: column;
    gap: 3px;
    padding: 3px;
}

.fp-essay-step {
    display: flex;
    gap: 3px;
    flex: 1;
}

.fp-essay-img {
    width: 35%;
    background: var(--color-accent-light);
    border-radius: 2px;
}

.fp-essay-text {
    flex: 1;
    background: repeating-linear-gradient(
        0deg,
        var(--color-border) 0px,
        var(--color-border) 1px,
        transparent 1px,
        transparent 4px
    );
}

/* Minimal format preview */
.format-preview-minimal {
    flex-direction: column;
    gap: 6px;
    padding: 8px;
    justify-content: center;
    background: #fff;
}

.fp-minimal-title {
    width: 50%;
    height: 8px;
    background: var(--color-text);
    align-self: center;
}

.fp-minimal-line {
    width: 70%;
    height: 3px;
    background: var(--color-border);
    align-self: center;
}

.fp-minimal-line.short {
    width: 40%;
}

/* Timeline format preview */
.format-preview-timeline {
    flex-direction: column;
    justify-content: center;
    padding: 8px 4px;
    position: relative;
}

.fp-timeline-bar {
    width: 90%;
    height: 3px;
    background: var(--color-primary-light);
    align-self: center;
    border-radius: 2px;
}

.fp-timeline-dots {
    position: absolute;
    top: 50%;
    left: 5%;
    right: 5%;
    display: flex;
    justify-content: space-between;
    transform: translateY(-50%);
}

.fp-dot {
    width: 10px;
    height: 10px;
    background: var(--color-primary);
    border-radius: 50%;
    border: 2px solid var(--color-surface);
}

/* Index Card format preview */
.format-preview-index {
    background: #FFFEF0;
    border: 1px solid #E8D9A0;
    padding: 4px;
}

.fp-index-lines {
    display: flex;
    flex-direction: column;
    gap: 5px;
    height: 100%;
    justify-content: flex-end;
}

.fp-ruled-line {
    width: 100%;
    height: 1px;
    background: #ADD8E6;
}

/* Color Picker */
.color-picker-row {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.color-picker-row input[type="color"] {
    width: 52px;
    height: 40px;
    padding: 2px;
    border: 2px solid var(--color-border);
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    background: var(--color-surface);
}

.color-label {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
    color: var(--color-text-muted);
}

/* Toggle Group */
.toggle-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toggle-label {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    cursor: pointer;
    font-size: 0.95rem;
    color: var(--color-text-secondary);
    transition: color var(--transition-fast);
}

.toggle-label:hover {
    color: var(--color-text);
}

.toggle-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--color-primary);
    cursor: pointer;
}

/* Preview Panel */
.preview-panel {
    display: flex;
    flex-direction: column;
}

.preview-label {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--color-text-muted);
    margin-bottom: var(--spacing-sm);
}

.preview-container {
    flex: 1;
    background: linear-gradient(135deg, #E8E4DE 0%, #D4CFC6 100%);
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 420px;
    box-shadow: inset 0 2px 8px rgba(0,0,0,0.06);
    position: relative;
    overflow: hidden;
}

/* Preview Frame (Paged.js) */
.preview-frame {
    width: 100%;
    height: 100%;
    min-height: 420px;
    border: none;
    background: transparent;
}

.preview-frame.loading {
    opacity: 0.5;
}

.preview-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-sm);
}

.preview-loading.hidden {
    display: none;
}

.preview-info {
    text-align: center;
    font-size: 0.85rem;
    color: var(--color-text-muted);
    margin-top: var(--spacing-sm);
}

.preview-info .heritage-badge {
    color: var(--color-accent);
    font-weight: 500;
}

/* Large Preview Panel (stacked layout) */
.preview-panel-large {
    display: flex;
    flex-direction: column;
}

.preview-panel-large .preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-sm);
}

.preview-panel-large .preview-label {
    margin-bottom: 0;
}

.preview-panel-large .preview-info {
    margin-top: 0;
}

.preview-container-large {
    min-height: 600px;
    max-height: 80vh;
    background: linear-gradient(135deg, #E8E4DE 0%, #D4CFC6 100%);
    border-radius: var(--border-radius);
    box-shadow: inset 0 2px 8px rgba(0,0,0,0.06);
    overflow-x: hidden;
    overflow-y: auto;
    width: 100%;
    box-sizing: border-box;
}

.preview-container-large .preview-frame {
    width: 100%;
    height: 100%;
    min-height: 600px;
}

/* Recipe Card Preview (legacy - now rendered in iframe) */
.recipe-card {
    background: white;
    box-shadow: var(--shadow-elevated);
    transition: all 0.3s ease;
    overflow: hidden;
    border-radius: 4px;
}

.recipe-card.size-3x5 { width: 225px; min-height: 150px; }
.recipe-card.size-4x6 { width: 300px; min-height: 225px; }
.recipe-card.size-5x7 { width: 350px; min-height: 262px; }
.recipe-card.size-full { width: 100%; max-width: 400px; min-height: 300px; }

/* ===========================================
   Download Section
   =========================================== */
.download-section {
    max-width: 100%;
    width: 100%;
    text-align: center;
}

/* Print Layout Selector */
.print-layout-group {
    text-align: left;
    margin-bottom: var(--spacing-lg);
}

.print-layout-selector {
    display: flex;
    gap: var(--spacing-md);
    justify-content: center;
}

.print-layout-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-xs);
    padding: var(--spacing-md);
    background: var(--color-surface-elevated);
    border: 2px solid var(--color-border);
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: all var(--transition);
    min-width: 130px;
}

.print-layout-option:hover {
    border-color: var(--color-primary-light);
    transform: translateY(-2px);
    box-shadow: var(--shadow-soft);
}

.print-layout-option.selected {
    border-color: var(--color-primary);
    background: var(--color-accent-light);
    box-shadow: var(--shadow-glow);
}

.layout-icon {
    width: 64px;
    height: 76px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius-sm);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    padding: 6px;
    gap: 4px;
}

.layout-card {
    background: linear-gradient(180deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
    border-radius: 3px;
}

.layout-icon-single .layout-card { width: 40px; height: 54px; }
.layout-icon-2up { flex-direction: column; }
.layout-icon-2up .layout-card { width: 44px; height: 28px; }
.layout-icon-4up { flex-wrap: wrap; gap: 3px; }
.layout-icon-4up .layout-card { width: 26px; height: 30px; }

.layout-name {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--color-text);
}

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

/* PDF Preview Container */
.pdf-preview-container {
    background: #48494B;
    border-radius: var(--border-radius);
    overflow: hidden;
    margin-bottom: var(--spacing-lg);
    min-height: 420px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-medium);
}

.pdf-loading,
.pdf-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-2xl);
    color: rgba(255,255,255,0.9);
}

.pdf-loading .spinner {
    border-color: rgba(255,255,255,0.2);
    border-top-color: rgba(255,255,255,0.9);
}

.pdf-error {
    color: #ffaaaa;
}

.pdf-viewer-wrapper {
    width: 100%;
    display: flex;
    flex-direction: column;
}

.pdf-viewer-wrapper iframe {
    width: 100%;
    height: 520px;
    border: none;
    background: #48494B;
}

.pdf-info {
    background: #3a3d40;
    color: rgba(255,255,255,0.7);
    padding: var(--spacing-sm) var(--spacing-md);
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-md);
}

.pdf-info .heritage-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(198, 123, 92, 0.25);
    color: #E8B090;
    padding: 5px 14px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
}

/* Download Actions */
.download-actions {
    display: flex;
    gap: var(--spacing-md);
    justify-content: center;
    margin-bottom: var(--spacing-lg);
}

.download-actions .btn-large .btn-icon {
    font-size: 1.15rem;
    width: auto;
    height: auto;
    background: none;
    color: inherit;
}

.download-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-lg);
    color: var(--color-text-muted);
    font-style: italic;
}

/* Secondary Actions */
.download-secondary-actions {
    display: flex;
    gap: var(--spacing-xl);
    justify-content: center;
    padding-top: var(--spacing-md);
    border-top: 1px solid var(--color-border);
}

/* ===========================================
   Toast Notifications
   =========================================== */
.toast-container {
    position: fixed;
    top: var(--spacing-md);
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
    max-width: 90%;
    width: 480px;
    pointer-events: none;
}

.toast {
    background: var(--color-surface-elevated);
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius);
    padding: var(--spacing-md);
    box-shadow: var(--shadow-elevated);
    display: flex;
    align-items: flex-start;
    gap: var(--spacing-sm);
    animation: toastSlideIn 0.35s ease;
    pointer-events: auto;
}

.toast.toast-hiding {
    animation: toastSlideOut 0.3s ease forwards;
}

.toast-error {
    background: #FEF8F8;
    border-color: #E8C4C4;
}

.toast-error .toast-icon {
    background: var(--color-error);
}

.toast-success {
    background: #F6FAF4;
    border-color: #C4D9BE;
}

.toast-success .toast-icon {
    background: var(--color-success);
}

.toast-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 26px;
    height: 26px;
    background: var(--color-warning);
    color: white;
    border-radius: 50%;
    font-size: 0.85rem;
    font-weight: bold;
    flex-shrink: 0;
}

.toast-content {
    flex: 1;
}

.toast-title {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--color-text);
    margin-bottom: 2px;
}

.toast-message {
    font-size: 0.9rem;
    color: var(--color-text-secondary);
    line-height: 1.45;
}

.toast-close {
    background: none;
    border: none;
    color: var(--color-text-muted);
    font-size: 1.35rem;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    transition: color var(--transition-fast);
}

.toast-close:hover {
    color: var(--color-text);
}

@keyframes toastSlideIn {
    from {
        opacity: 0;
        transform: translateY(-16px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes toastSlideOut {
    from {
        opacity: 1;
        transform: translateY(0);
    }
    to {
        opacity: 0;
        transform: translateY(-16px);
    }
}

/* ===========================================
   Footer
   =========================================== */
.footer {
    text-align: center;
    padding: var(--spacing-xl) 0 var(--spacing-lg);
    margin-top: var(--spacing-xl);
    color: var(--color-text-muted);
    font-size: 0.9rem;
    position: relative;
}

.footer::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 1px;
    background: var(--color-border);
}

.footer p {
    font-family: var(--font-accent);
    font-size: 1.1rem;
}

/* ===========================================
   Responsive Styles
   =========================================== */
@media (max-width: 800px) {
    .style-layout {
        grid-template-columns: 1fr;
    }

    .preview-panel {
        order: -1;
    }

    .preview-container {
        min-height: 320px;
    }

    .preview-frame {
        min-height: 320px;
    }

    .preview-container-large {
        min-height: 400px;
    }

    .preview-container-large .preview-frame {
        min-height: 400px;
    }

    .theme-gallery {
        max-height: 200px;
    }

    .theme-gallery {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 600px) {
    html {
        font-size: 15px;
    }

    .container {
        padding: var(--spacing-sm);
    }

    .header {
        padding: var(--spacing-lg) 0 var(--spacing-md);
    }

    .logo {
        font-size: 2.25rem;
    }

    .tagline {
        font-size: 1.15rem;
    }

    .step {
        padding: var(--spacing-lg);
        border-radius: var(--border-radius);
    }

    .step h2 {
        font-size: 1.5rem;
    }

    .recipe-textarea {
        min-height: 220px;
    }

    .button-group {
        flex-direction: column-reverse;
    }

    .button-group .btn {
        width: 100%;
    }

    .button-group-three {
        flex-direction: column;
    }

    .button-group-three .btn {
        width: 100%;
        order: unset;
    }

    .button-group-three .btn-primary {
        order: -1;
    }

    .form-row {
        flex-direction: column;
    }

    .photo-uploads-row {
        grid-template-columns: 1fr;
    }

    /* Mobile ingredients table */
    .ingredients-table thead {
        display: none;
    }

    .ingredients-table,
    .ingredients-table tbody,
    .ingredients-table tr,
    .ingredients-table td {
        display: block;
    }

    .ingredients-table tr {
        padding: var(--spacing-sm);
        margin-bottom: var(--spacing-xs);
        background: var(--color-surface);
        border: 1px solid var(--color-border);
        border-radius: var(--border-radius);
    }

    .ingredients-table td {
        padding: 6px 0;
        border: none;
        display: flex;
        align-items: center;
        background: transparent;
    }

    .ingredients-table td::before {
        content: attr(data-label);
        font-weight: 500;
        width: 85px;
        flex-shrink: 0;
        color: var(--color-text-muted);
        font-size: 0.8rem;
    }

    .ingredients-table .col-actions {
        justify-content: flex-end;
    }

    .ingredients-table .col-actions::before {
        display: none;
    }

    .instruction-item {
        flex-wrap: wrap;
    }

    .instruction-actions {
        flex-direction: row;
        width: 100%;
        justify-content: flex-end;
        margin-top: var(--spacing-xs);
        padding-top: var(--spacing-xs);
        border-top: 1px solid var(--color-border);
    }

    /* Mobile print layout */
    .print-layout-selector {
        flex-direction: column;
        align-items: stretch;
    }

    .print-layout-option {
        flex-direction: row;
        min-width: auto;
        text-align: left;
        padding: var(--spacing-sm);
    }

    .layout-icon {
        width: 52px;
        height: 64px;
        flex-shrink: 0;
    }

    .layout-icon-single .layout-card { width: 32px; height: 44px; }
    .layout-icon-2up .layout-card { width: 36px; height: 24px; }
    .layout-icon-4up .layout-card { width: 22px; height: 26px; }

    .print-layout-option > div:last-of-type {
        display: flex;
        flex-direction: column;
        margin-left: var(--spacing-sm);
    }

    .download-actions {
        flex-direction: column;
    }

    .download-actions .btn {
        width: 100%;
    }

    .download-secondary-actions {
        flex-direction: column;
        gap: var(--spacing-sm);
    }

    .size-selector {
        flex-direction: column;
    }

    .size-option {
        width: 100%;
    }

    .toast-container {
        top: var(--spacing-sm);
        width: calc(100% - var(--spacing-md));
    }

    .toast {
        padding: var(--spacing-sm);
    }
}

@media (max-width: 400px) {
    .theme-gallery {
        grid-template-columns: 1fr 1fr;
        gap: var(--spacing-xs);
    }

    .theme-card {
        padding: var(--spacing-xs);
    }

    .theme-preview {
        padding: 8px;
    }

    .theme-name {
        font-size: 0.7rem;
    }
}

/* ===========================================
   Print Styles
   =========================================== */
@media print {
    body * {
        visibility: hidden;
    }

    .download-preview,
    .download-preview * {
        visibility: visible !important;
    }

    .download-preview {
        position: absolute !important;
        left: 0 !important;
        top: 0 !important;
        width: auto !important;
        margin: 0 !important;
        padding: 0 !important;
        box-shadow: none !important;
    }

    header, footer, nav,
    .step-indicator, .btn, .button-group,
    .form-group, .toast-container, .loading-overlay {
        display: none !important;
    }

    body {
        background: white !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    .recipe-card {
        box-shadow: none !important;
        margin: 0 !important;
        page-break-inside: avoid;
    }
}

/* ===========================================
   Utility Classes
   =========================================== */
.text-center { text-align: center; }
.mt-sm { margin-top: var(--spacing-sm); }
.mt-md { margin-top: var(--spacing-md); }
.mt-lg { margin-top: var(--spacing-lg); }
