/* ===== Order Generator Specific Styles ===== */

/* Hero adjustments for order page */
.order-hero {
    min-height: 45vh;
}

@media (max-width: 768px) {
    .order-hero {
        min-height: 50vh;
    }
}

.order-main {
    padding-bottom: 2rem;
}

/* PDF Dropzone styling */
.pdf-dropzone {
    min-height: 200px;
    border-style: dashed;
}

.pdf-dropzone .dropzone-icon svg {
    width: 56px;
    height: 56px;
}

/* Auth Prompt - Sign in nudge (blue style) */
.auth-prompt {
    display: none; /* Hidden by default, shown via JS for guests */
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.25rem;
    background: linear-gradient(135deg, rgba(61, 90, 152, 0.12) 0%, rgba(61, 90, 152, 0.06) 100%);
    border: 1px solid rgba(61, 90, 152, 0.3);
    border-radius: var(--radius-md);
    margin-bottom: 1.5rem;
}

.auth-prompt.visible {
    display: flex;
}

.auth-prompt-icon {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    background: var(--brand-blue);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-prompt-icon svg {
    width: 20px;
    height: 20px;
    stroke: white;
}

.auth-prompt-content {
    flex: 1;
}

.auth-prompt-content p {
    margin: 0;
    font-size: 0.9rem;
    color: var(--text-primary);
    line-height: 1.5;
}

.auth-prompt-content strong {
    color: var(--brand-blue);
    font-weight: 600;
}

.auth-prompt-link {
    flex-shrink: 0;
    font-size: 0.85rem;
    font-weight: 600;
    color: white;
    text-decoration: none;
    padding: 0.6rem 1.25rem;
    background: var(--brand-blue);
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
    box-shadow: 0 2px 8px rgba(61, 90, 152, 0.25);
}

.auth-prompt-link:hover {
    background: #324a7d;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(61, 90, 152, 0.35);
}

/* Hide auth prompt when logged in */
.auth-prompt.hidden {
    display: none !important;
}

@media (max-width: 600px) {
    .auth-prompt {
        flex-direction: column;
        text-align: center;
        gap: 0.75rem;
    }
    
    .auth-prompt-link {
        width: 100%;
        text-align: center;
    }
}

/* File Info Display */
.file-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.25rem;
    background: var(--bg-secondary);
    border: 1px solid var(--success);
    border-radius: var(--radius-md);
}

.file-info-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(34, 197, 94, 0.1);
    border-radius: var(--radius-sm);
    color: var(--success);
}

.file-info-icon svg {
    width: 24px;
    height: 24px;
}

.file-info-details {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

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

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

.remove-file-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-base);
}

.remove-file-btn:hover {
    background: var(--error);
    border-color: var(--error);
    color: white;
}

.remove-file-btn svg {
    width: 16px;
    height: 16px;
}

/* Order History Section (for logged-in users) */
/* Orders Section - Matches account page style */
.orders-section {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-top: 2rem;
    min-height: 200px;
}

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

.section-header h2 {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-family: 'Playfair Display', serif;
    font-size: 1.5rem;
    margin: 0;
    color: var(--text-primary);
}

.section-header svg {
    width: 24px;
    height: 24px;
    color: var(--accent);
}

.order-count {
    font-size: 0.85rem;
    color: var(--text-muted);
    padding: 0.35rem 0.75rem;
    background: var(--bg-primary);
    border-radius: var(--radius-sm);
}

/* Orders Loading */
.orders-loading {
    text-align: center;
    padding: 3rem;
}

.orders-loading p {
    color: var(--text-muted);
    margin-top: 1rem;
}

/* Orders Empty State */
.orders-empty {
    text-align: center;
    padding: 3rem 2rem;
}

.orders-empty .empty-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 1rem;
    color: var(--text-muted);
    opacity: 0.5;
}

.orders-empty .empty-icon svg {
    width: 100%;
    height: 100%;
}

.orders-empty h3 {
    font-size: 1.25rem;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.orders-empty p {
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

/* Orders List */
.orders-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.order-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    transition: all var(--transition-base);
}

.order-card:hover {
    border-color: var(--accent);
    box-shadow: var(--shadow-sm);
}

.order-info {
    flex: 1;
}

.order-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.35rem;
}

.order-id {
    font-weight: 600;
    font-size: 1rem;
    color: var(--text-primary);
}

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

.order-details {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.order-items {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.order-total {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--accent);
}

.view-pdf-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-base);
}

.view-pdf-btn:hover {
    background: var(--accent-dim);
    border-color: var(--accent);
    color: var(--accent);
}

.view-pdf-btn.loading {
    opacity: 0.7;
    cursor: not-allowed;
}

.view-pdf-btn svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.btn-spinner {
    width: 14px;
    height: 14px;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* Processing State */
.processing-state {
    text-align: center;
    padding: 3rem 2rem;
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    margin-top: 1.5rem;
}

.processing-spinner {
    width: 48px;
    height: 48px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1.5rem;
}

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

.processing-state p {
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

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

/* Results Panel */
.results-panel {
    margin-top: 2rem;
}

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1.5rem;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
}

.results-summary h2 {
    font-family: 'Playfair Display', serif;
    font-size: 1.75rem;
    margin-bottom: 1rem;
}

.summary-stats {
    display: flex;
    gap: 1.5rem;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.75rem 1.25rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    min-width: 80px;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent);
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Order total stat styling */
.stat-item-total {
    border-color: var(--accent);
}

.results-actions {
    display: flex;
    gap: 0.75rem;
}

.action-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-base);
}

.action-btn svg {
    width: 18px;
    height: 18px;
}

.export-pdf-btn {
    background: #374ca0;
    color: white;
    border: none;
    box-shadow: var(--shadow-sm);
}

.export-pdf-btn:hover {
    background: #2a3a7a;
    transform: translateY(-1px);
}

/* Submit Order Button */
.submit-order-btn {
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    color: white;
    border: none;
    box-shadow: var(--shadow-sm), 0 0 0 0 rgba(34, 197, 94, 0.4);
    transition: all var(--transition-base), box-shadow 0.3s ease;
}

.submit-order-btn:hover {
    background: linear-gradient(135deg, #16a34a 0%, #15803d 100%);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md), 0 0 20px rgba(34, 197, 94, 0.3);
}

/* Category Filter Tabs */
.category-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    padding: 0.5rem;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
}

.category-tab {
    padding: 0.5rem 1rem;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-base);
}

.category-tab:hover {
    background: rgba(0, 0, 0, 0.05);
    color: var(--text-primary);
}

.category-tab.active {
    background: var(--accent);
    color: white;
}

.category-tab .tab-count {
    margin-left: 0.35rem;
    font-size: 0.75rem;
    opacity: 0.8;
}

/* Items Grid */
.items-grid {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    margin-bottom: 2rem;
}

/* Section Groups */
.section-group {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.section-heading {
    font-size: 1.1rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
    margin: 0;
}

/* Items Table */
.items-table {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.items-header {
    display: grid;
    grid-template-columns: 60px 1fr 1fr 1fr 1fr 100px;
    gap: 1rem;
    padding: 0.75rem 1rem;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

.item-row {
    display: grid;
    grid-template-columns: 60px 1fr 1fr 1fr 1fr 100px;
    gap: 1rem;
    padding: 0.875rem 1rem;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
    align-items: center;
    transition: background var(--transition-base);
}

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

.item-row:hover {
    background: rgba(0, 0, 0, 0.02);
}

.item-row .col-qty {
    font-weight: 700;
    color: var(--accent);
}

.item-row .col-item {
    font-weight: 600;
    color: var(--text-primary);
}

.item-row .col-door {
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.item-row .col-door .door-na {
    color: var(--text-muted);
}

.item-row .col-finish {
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Door chip next to door style name */
.door-chip {
    width: 20px;
    height: 20px;
    border-radius: 3px;
    object-fit: cover;
    border: 1px solid var(--border);
    flex-shrink: 0;
    background: #f5f5f5;
}

.door-chip-empty {
    background: var(--bg-tertiary);
    display: inline-block;
}

/* Door editable styling (same pattern as finish) */
.door-editable {
    cursor: pointer;
    padding: 0.35rem 0.5rem;
    margin: -0.35rem -0.5rem;
    border-radius: var(--radius-sm);
    transition: all var(--transition-base);
}

.door-editable:hover {
    background: var(--accent-dim);
}

.door-edit-icon {
    width: 14px;
    height: 14px;
    color: var(--text-muted);
    opacity: 0.5;
    transition: opacity var(--transition-base);
    flex-shrink: 0;
}

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

/* Door and finish name text */
.door-name,
.finish-name {
    font-weight: 500;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* Placeholder text for unselected options */
.door-placeholder,
.finish-placeholder {
    color: var(--text-muted);
    font-size: 0.85em;
    font-weight: 400;
}

/* Color chip next to finish name */
.color-chip {
    width: 20px;
    height: 20px;
    border-radius: 3px;
    object-fit: cover;
    border: 1px solid var(--border);
    flex-shrink: 0;
}

.color-chip-empty {
    background: var(--bg-tertiary);
    display: inline-block;
}

.item-row .col-size {
    color: var(--text-muted);
    font-family: 'SF Mono', 'Monaco', 'Consolas', monospace;
    font-size: 0.85rem;
}

.item-row .col-price {
    font-weight: 600;
    color: var(--text-primary);
    text-align: right;
    font-family: 'SF Mono', 'Monaco', 'Consolas', monospace;
    font-size: 0.9rem;
}

.items-header .col-price {
    text-align: right;
}

/* Order Total Section */
.order-total-section {
    margin-top: 1.5rem;
    background: var(--bg-secondary);
    border: 2px solid var(--accent);
    border-radius: var(--radius-md);
    padding: 1.25rem 1.5rem;
}

.order-total-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.order-total-label {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.order-total-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent);
    font-family: 'SF Mono', 'Monaco', 'Consolas', monospace;
}

/* Category Badge */
.category-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.5rem;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.7rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--text-muted);
}

/* Category-specific colors */
.category-badge.cabinets { background: #E8EDF5; color: var(--brand-blue); border-color: var(--brand-blue); }
.category-badge.doors { background: #FDF6E9; color: #8B6914; border-color: var(--brand-gold); }
.category-badge.hardware { background: #E8F5E9; color: #2E7D32; border-color: #2E7D32; }
.category-badge.countertops { background: #FCE4EC; color: #C2185B; border-color: #C2185B; }
.category-badge.lighting { background: #FFF3E0; color: #E65100; border-color: #E65100; }
.category-badge.accessories { background: #E3F2FD; color: #1565C0; border-color: #1565C0; }
.category-badge.legs { background: #F3E5F5; color: #7B1FA2; border-color: #7B1FA2; }
.category-badge.panels { background: #EFEBE9; color: #5D4037; border-color: #5D4037; }

/* JSON Preview Section */
.json-preview-section {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.json-preview-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    background: transparent;
    border: none;
    cursor: pointer;
    transition: background var(--transition-base);
    text-align: left;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.json-preview-toggle:hover {
    background: rgba(0, 0, 0, 0.02);
}

.json-preview-toggle .toggle-icon {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    transition: transform var(--transition-base);
}

.json-preview-toggle .toggle-icon svg {
    width: 16px;
    height: 16px;
}

.json-preview-section.expanded .toggle-icon {
    transform: rotate(45deg);
}

.json-preview-content {
    display: none;
    position: relative;
    padding: 0 1.25rem 1.25rem;
}

.json-preview-section.expanded .json-preview-content {
    display: block;
}

.json-preview-content pre {
    background: #1A1A1A;
    color: #E8E8E8;
    padding: 1rem;
    border-radius: var(--radius-sm);
    overflow-x: auto;
    font-size: 0.8rem;
    line-height: 1.5;
    max-height: 400px;
    overflow-y: auto;
}

.copy-json-btn {
    position: absolute;
    top: 0.5rem;
    right: 1.75rem;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.75rem;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: var(--radius-sm);
    color: #E8E8E8;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all var(--transition-base);
}

.copy-json-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.copy-json-btn svg {
    width: 14px;
    height: 14px;
}

/* Back Navigation */
.back-nav {
    padding: 2rem 0;
    text-align: center;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all var(--transition-base);
}

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

.back-link svg {
    width: 18px;
    height: 18px;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem;
    color: var(--text-muted);
}

.empty-state svg {
    width: 64px;
    height: 64px;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-state p {
    font-size: 1rem;
}

.discontinued-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.2rem 0.5rem;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid var(--error);
    border-radius: var(--radius-sm);
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--error);
    text-transform: uppercase;
}

/* Responsive */
@media (max-width: 768px) {
    .results-header {
        flex-direction: column;
    }
    
    .results-summary {
        width: 100%;
    }
    
    .summary-stats {
        display: flex;
        flex-wrap: nowrap;
        width: 100%;
        gap: 0.5rem;
    }
    
    .summary-stats .stat-item {
        flex: 1 1 0;
        min-width: 0;
        padding: 0.6rem 0.5rem;
    }
    
    .results-actions {
        width: 100%;
    }
    
    .results-actions .action-btn {
        flex: 1;
        justify-content: center;
    }
    
    /* Order history responsive */
    .order-card {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .order-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.25rem;
    }
    
    .view-pdf-btn {
        width: 100%;
    }
    
    /* Mobile-friendly compact layout */
    .items-header {
        display: none;
    }
    
    .item-row {
        display: grid;
        grid-template-columns: 40px 1fr auto;
        grid-template-rows: auto auto auto auto;
        gap: 0.25rem 0.75rem;
        padding: 0.75rem 1rem;
        align-items: start;
    }
    
    .item-row .col-qty {
        grid-row: 1 / 5;
        grid-column: 1;
        align-self: stretch;
        display: flex;
        align-items: center;
        justify-content: center;
        background: var(--accent-dim);
        padding: 0.5rem;
        border-radius: var(--radius-sm);
        font-size: 0.9rem;
        font-weight: 700;
    }
    
    .item-row .col-item {
        grid-row: 1;
        grid-column: 2;
        font-size: 0.95rem;
        line-height: 1.3;
    }
    
    .item-row .col-door {
        grid-row: 2;
        grid-column: 2;
        font-size: 0.8rem;
        line-height: 1.3;
        display: flex;
        align-items: center;
    }
    
    /* Hide N/A door style rows on mobile */
    .item-row .col-door.door-na-row {
        display: none;
    }
    
    .item-row .col-door::before {
        content: 'Door Style:';
        font-weight: 400;
        color: var(--text-muted);
        width: 80px;
        flex-shrink: 0;
    }
    
    .item-row .col-door .door-chip {
        width: 16px;
        height: 16px;
    }
    
    .item-row .door-editable {
        padding: 0.2rem 0.35rem;
        margin: -0.2rem -0.35rem;
    }
    
    .door-edit-icon {
        width: 12px;
        height: 12px;
    }
    
    .item-row .col-finish {
        grid-row: 3;
        grid-column: 2;
        font-size: 0.8rem;
        line-height: 1.3;
        display: flex;
        align-items: center;
    }
    
    .item-row .col-finish::before {
        content: 'Finish:';
        font-weight: 400;
        color: var(--text-muted);
        width: 80px;
        flex-shrink: 0;
    }
    
    .item-row .col-finish .color-chip {
        width: 16px;
        height: 16px;
    }
    
    .item-row .finish-editable {
        padding: 0.2rem 0.35rem;
        margin: -0.2rem -0.35rem;
    }
    
    .finish-edit-icon {
        width: 12px;
        height: 12px;
    }
    
    .item-row .col-size {
        grid-row: 4;
        grid-column: 2;
        font-size: 0.8rem;
        line-height: 1.3;
        display: flex;
        align-items: center;
        font-family: inherit;
        gap: 0.5rem;
    }
    
    .item-row .col-size::before {
        content: 'Size:';
        font-weight: 400;
        color: var(--text-muted);
        width: 80px;
        flex-shrink: 0;
        /* Add padding to match chip width (16px) + gap (8px) */
        padding-right: 24px;
    }
    
    .item-row .col-price {
        grid-row: 1 / 5;
        grid-column: 3;
        align-self: center;
        font-size: 0.9rem;
        text-align: right;
    }
    
    /* Order total mobile adjustments */
    .order-total-section {
        padding: 1rem;
    }
    
    .order-total-label {
        font-size: 0.95rem;
    }
    
    .order-total-value {
        font-size: 1.25rem;
    }
    
    .category-tabs {
        overflow-x: auto;
        flex-wrap: nowrap;
        padding-bottom: 0.75rem;
    }
    
    .category-tab {
        white-space: nowrap;
    }
}

@media (max-width: 480px) {
    .summary-stats {
        gap: 0.35rem;
    }
    
    .summary-stats .stat-item {
        padding: 0.5rem 0.25rem;
    }
    
    .stat-value {
        font-size: 1.25rem;
    }
}

/* ===== Editable Finish Styling ===== */
.finish-editable {
    cursor: pointer;
    border-radius: var(--radius-sm);
    padding: 0.25rem 0.5rem;
    margin: -0.25rem -0.5rem;
    transition: background var(--transition-fast);
}

.finish-editable:hover {
    background: var(--accent-dim);
}

.finish-edit-icon {
    width: 14px;
    height: 14px;
    opacity: 0.4;
    flex-shrink: 0;
    margin-left: 0.25rem;
    transition: opacity var(--transition-fast);
}

.finish-editable:hover .finish-edit-icon {
    opacity: 0.8;
}

/* ===== Color Picker Modal ===== */
.color-picker-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-base);
}

.color-picker-overlay.active {
    opacity: 1;
    visibility: visible;
}

.color-picker-modal {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.4);
    max-width: 600px;
    width: 90%;
    max-height: 85vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transform: scale(0.95) translateY(10px);
    transition: transform var(--transition-base);
}

.color-picker-overlay.active .color-picker-modal {
    transform: scale(1) translateY(0);
}

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

.color-picker-header h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.color-picker-close {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.color-picker-close:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.color-picker-close svg {
    width: 18px;
    height: 18px;
}

.color-picker-current {
    padding: 0.75rem 1.5rem;
    background: var(--bg-secondary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
}

.current-label {
    color: var(--text-muted);
}

.current-finish {
    color: var(--text-primary);
    font-weight: 500;
}

/* ===== Apply to All Section - Prominent Toggle ===== */
.apply-all-section {
    padding: 1rem 1.5rem;
    background: linear-gradient(135deg, rgba(212, 149, 45, 0.08) 0%, rgba(212, 149, 45, 0.15) 100%);
    border-bottom: 1px solid var(--border);
    text-align: center;
}

.apply-all-toggle-large {
    display: inline-flex;
    align-items: center;
    gap: 1rem;
    cursor: pointer;
    user-select: none;
    padding: 0.75rem 1.25rem;
    background: var(--bg-primary);
    border-radius: var(--radius-md);
    border: 2px solid var(--border);
    transition: all var(--transition-base);
}

.apply-all-toggle-large:hover {
    border-color: var(--accent);
    box-shadow: 0 2px 8px rgba(212, 149, 45, 0.15);
}

.apply-all-toggle-large:has(input:checked) {
    border-color: var(--accent);
    background: var(--accent-dim);
}

.toggle-switch-large {
    position: relative;
    width: 56px;
    height: 30px;
    flex-shrink: 0;
}

.toggle-switch-large input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider-large {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: 0.3s;
    border-radius: 30px;
}

.toggle-slider-large:before {
    position: absolute;
    content: "";
    height: 22px;
    width: 22px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.toggle-switch-large input:checked + .toggle-slider-large {
    background-color: var(--accent);
}

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

.toggle-label-text {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.toggle-hint {
    margin: 0.75rem 0 0;
    font-size: 0.8rem;
    color: var(--text-muted);
    font-style: italic;
}

/* Legacy small toggle (keeping for backwards compatibility) */
.apply-all-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-left: auto;
    cursor: pointer;
    font-size: 0.8rem;
    color: var(--text-secondary);
    user-select: none;
}

.apply-all-toggle .toggle-switch {
    position: relative;
    width: 36px;
    height: 20px;
    flex-shrink: 0;
}

.apply-all-toggle .toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.apply-all-toggle .toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--border);
    transition: 0.3s;
    border-radius: 20px;
}

.apply-all-toggle .toggle-slider:before {
    position: absolute;
    content: "";
    height: 14px;
    width: 14px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.apply-all-toggle input:checked + .toggle-slider {
    background-color: var(--accent);
}

.apply-all-toggle input:checked + .toggle-slider:before {
    transform: translateX(16px);
}

.color-picker-grid {
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 0;
    overflow-y: auto;
    max-height: 60vh;
}

/* Clear option row */
.color-clear-row {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
}

.color-clear-row .color-option-clear {
    margin: 0;
}

@media (max-width: 480px) {
    .color-clear-row {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* ===== Color Picker Accordions ===== */
.color-accordion {
    border-bottom: 1px solid var(--border);
}

.color-accordion:last-child {
    border-bottom: none;
}

.color-accordion-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    background: var(--bg-secondary);
    border: none;
    cursor: pointer;
    text-align: left;
    transition: all var(--transition-fast);
}

.color-accordion-toggle:hover {
    background: var(--bg-tertiary);
}

.color-accordion-toggle .accordion-icon {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform var(--transition-base);
}

.color-accordion-toggle .accordion-icon svg {
    width: 16px;
    height: 16px;
    color: var(--text-muted);
}

.color-accordion-toggle.active .accordion-icon {
    transform: rotate(0deg);
}

.color-accordion-toggle:not(.active) .accordion-icon {
    transform: rotate(-90deg);
}

.color-accordion-toggle .accordion-text {
    flex: 1;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
}

.color-accordion-toggle .accordion-count {
    font-size: 0.75rem;
    color: var(--text-muted);
    background: var(--bg-primary);
    padding: 0.2rem 0.5rem;
    border-radius: var(--radius-sm);
}

.color-accordion-content {
    display: none;
    padding: 0.75rem 1rem 1rem;
    background: var(--bg-primary);
}

.color-accordion-content.active {
    display: block;
}

.color-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
}

.color-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    background: var(--bg-card);
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-base);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.color-option:hover {
    border-color: var(--text-muted);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.color-option.selected {
    border-color: var(--accent);
    background: var(--accent-dim);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

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

.color-option img {
    width: 100%;
    aspect-ratio: 1;
    border-radius: var(--radius-sm);
    object-fit: cover;
}

.color-option-name {
    font-size: 0.7rem;
    color: var(--text-secondary);
    text-align: center;
    font-weight: 500;
    line-height: 1.2;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Clear swatch option */
.clear-swatch {
    width: 100%;
    aspect-ratio: 1;
    border-radius: var(--radius-sm);
    border: 2px dashed var(--border);
    background: var(--bg-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
}

.clear-swatch svg {
    width: 24px;
    height: 24px;
    stroke: var(--text-muted);
}

.color-option-clear:hover .clear-swatch {
    border-color: var(--accent);
    background: var(--accent-dim);
}

.color-option-clear:hover .clear-swatch svg {
    stroke: var(--accent);
}

/* Picker Actions (OK button) */
.picker-actions {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border);
    background: var(--bg-secondary);
}

.picker-ok-btn {
    width: 100%;
    padding: 0.875rem 1.5rem;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-base);
}

.picker-ok-btn:hover {
    background: #b8842a;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(212, 149, 45, 0.3);
}

/* Mobile color picker adjustments */
@media (max-width: 768px) {
    .apply-all-section {
        padding: 0.875rem 1rem;
    }
    
    .apply-all-toggle-large {
        gap: 0.75rem;
        padding: 0.6rem 1rem;
    }
    
    .toggle-switch-large {
        width: 50px;
        height: 26px;
    }
    
    .toggle-slider-large:before {
        height: 18px;
        width: 18px;
    }
    
    .toggle-switch-large input:checked + .toggle-slider-large:before {
        transform: translateX(24px);
    }
    
    .toggle-label-text {
        font-size: 0.9rem;
    }
    
    .toggle-hint {
        font-size: 0.75rem;
    }
    
    .color-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 0.35rem;
    }
    
    .color-option-name {
        font-size: 0.65rem;
    }
    
    .color-accordion-toggle {
        padding: 0.75rem 1rem;
    }
    
    .color-accordion-content {
        padding: 0.5rem 0.75rem 0.75rem;
    }
}

@media (max-width: 480px) {
    .color-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* ===== Door Style Picker Modal Overrides ===== */
.door-picker-modal {
    max-width: 600px;
}

.door-picker-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
    padding: 1rem;
}

/* Door option styles */
.door-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    padding: 0.35rem;
    background: #ffffff;
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.door-option:hover {
    background: var(--bg-tertiary);
    border-color: var(--text-muted);
    transform: translateY(-3px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.door-option.selected {
    border-color: var(--accent);
    background: var(--accent-dim);
}

.door-option img {
    width: 70px;
    height: 90px;
    border-radius: var(--radius-sm);
    object-fit: cover;
    border: 1px solid var(--border);
    background: #f9f9f9;
}

.door-option-name {
    font-size: 0.7rem;
    color: var(--text-secondary);
    text-align: center;
    line-height: 1.2;
    max-width: 80px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

/* Clear swatch for door picker */
.door-option-clear .clear-swatch {
    width: 70px;
    height: 90px;
}

/* Mobile door picker adjustments */
@media (max-width: 768px) {
    .door-picker-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .door-option img,
    .door-option-clear .clear-swatch {
        width: 60px;
        height: 78px;
    }
}

@media (max-width: 480px) {
    .door-picker-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .door-option img,
    .door-option-clear .clear-swatch {
        width: 70px;
        height: 90px;
    }
}

/* ===== Submit Order Modal ===== */
.submit-order-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-base);
    padding: 1rem;
    overflow-y: auto;
}

.submit-order-overlay.active {
    opacity: 1;
    visibility: visible;
}

.submit-order-modal {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 420px;
    max-height: calc(100vh - 2rem);
    position: relative;
    transform: translateY(20px) scale(0.95);
    transition: transform var(--transition-base);
    overflow-y: auto;
    margin: auto 0;
}

.submit-order-overlay.active .submit-order-modal {
    transform: translateY(0) scale(1);
}

.submit-order-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-base);
    z-index: 1;
}

.submit-order-close:hover {
    background: var(--error);
    border-color: var(--error);
    color: white;
}

.submit-order-close svg {
    width: 16px;
    height: 16px;
}

.submit-order-header {
    text-align: center;
    padding: 2rem 2rem 1.5rem;
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.08) 0%, rgba(22, 163, 74, 0.04) 100%);
    border-bottom: 1px solid var(--border);
}

.submit-order-icon {
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
    box-shadow: 0 4px 12px rgba(34, 197, 94, 0.3);
}

.submit-order-icon svg {
    width: 28px;
    height: 28px;
    color: white;
}

.submit-order-header h3 {
    font-family: 'Playfair Display', serif;
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.submit-order-header p {
    font-size: 0.9rem;
    color: var(--text-muted);
    line-height: 1.5;
}

.submit-order-summary {
    padding: 1.25rem 2rem;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
}

.summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
}

.summary-row:not(:last-child) {
    border-bottom: 1px solid var(--border);
}

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

.summary-value {
    font-weight: 600;
    color: var(--text-primary);
}

.category-breakdown {
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.75rem;
    margin-bottom: 0.75rem;
}

.category-breakdown .summary-row {
    padding: 0.35rem 0;
}

.category-breakdown .summary-row:not(:last-child) {
    border-bottom: none;
}

.category-breakdown .summary-label {
    font-size: 0.85rem;
}

.category-breakdown .summary-value {
    font-size: 0.85rem;
}

.summary-row-total {
    margin-top: 0.5rem;
    padding-top: 0.75rem;
}

.summary-row-total .summary-label {
    font-weight: 600;
    color: var(--text-primary);
}

.summary-row-total .summary-value {
    font-size: 1.25rem;
    color: var(--accent);
    font-family: 'SF Mono', 'Monaco', 'Consolas', monospace;
}

.submit-order-form {
    padding: 1rem 2rem 1.5rem;
}

.form-group {
    margin-bottom: 0.75rem;
}

.form-group label {
    display: block;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.35rem;
}

.form-group input {
    width: 100%;
    padding: 0.65rem 0.85rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    background: var(--bg-secondary);
    color: var(--text-primary);
    transition: all var(--transition-base);
}

.form-group input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-dim);
}

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

.form-row {
    display: flex;
    gap: 0.75rem;
}

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

.submit-order-confirm {
    width: 100%;
    padding: 1rem;
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-base);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.submit-order-confirm:hover:not(:disabled) {
    background: linear-gradient(135deg, #16a34a 0%, #15803d 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(34, 197, 94, 0.3);
}

.submit-order-confirm:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.btn-loading {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-loading .spinner {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.submit-order-note {
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-muted);
    padding: 0 2rem 1.5rem;
}

/* Mobile adjustments */
@media (max-width: 480px) {
    .submit-order-overlay {
        padding: 0.5rem;
    }
    
    .submit-order-modal {
        max-width: 100%;
        max-height: calc(100vh - 1rem);
        border-radius: var(--radius-md);
    }
    
    .submit-order-header,
    .submit-order-form {
        padding-left: 1.25rem;
        padding-right: 1.25rem;
    }
    
    .submit-order-summary {
        padding-left: 1.25rem;
        padding-right: 1.25rem;
    }
}
