﻿/* Base styles */
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            font-family: 'Cormorant Garamond', 'Noto Serif', serif;
            background: #f5f0e8;
            min-height: 100vh;
            color: #4a3728;
            overflow-x: hidden;
            transition: background 0.3s;
        }

        /* Screen Switcher Mechanics */
        .screen {
            display: none;
            min-height: 100vh;
        }
        
        .screen.active {
            display: block;
        }

        /* SCREEN 1: UPLOAD SCREEN */
        .upload-screen {
            display: none;
            justify-content: center;
            align-items: center;
            flex-direction: column;
            padding: 60px 20px;
            max-width: 800px;
            margin: 0 auto;
        }
        
        .upload-screen.active {
            display: flex;
        }

        .app-header {
            text-align: center;
            margin-bottom: 40px;
        }

        .app-title {
            font-family: 'Great Vibes', cursive;
            font-size: 72px;
            color: #5a3e2b;
            margin-bottom: 10px;
            text-shadow: 1px 1px 2px rgba(0,0,0,0.1);
        }

        .app-subtitle {
            font-size: 18px;
            letter-spacing: 3px;
            text-transform: uppercase;
            color: #8b7355;
            font-weight: 600;
        }

        .upload-card {
            background: #e8dcc8;
            border: 3px solid #8b7355;
            position: relative;
            padding: 40px;
            width: 100%;
            border-radius: 4px;
            box-shadow: 0 10px 30px rgba(0,0,0,0.1);
            text-align: center;
        }

        .upload-card::before {
            content: '';
            position: absolute;
            top: 8px; left: 8px; right: 8px; bottom: 8px;
            border: 1px solid #a89070;
            pointer-events: none;
        }

        .drop-zone {
            border: 2px dashed #8b7355;
            padding: 60px 20px;
            border-radius: 4px;
            background: rgba(255, 255, 255, 0.2);
            cursor: pointer;
            transition: all 0.3s ease;
        }

        .drop-zone:hover, .drop-zone.dragover {
            background: rgba(255, 255, 255, 0.5);
            border-color: #5a3e2b;
        }

        .upload-icon {
            width: 64px;
            height: 64px;
            margin: 0 auto 15px;
            opacity: 0.7;
            stroke: #5a3e2b;
        }

        .drop-zone-text {
            font-size: 18px;
            font-weight: 600;
            color: #5a3e2b;
            margin-bottom: 10px;
        }

        .drop-zone-subtext {
            font-size: 13px;
            color: #8b7355;
            font-style: italic;
        }

        .preview-container {
            margin-top: 30px;
            display: none;
            flex-direction: column;
            align-items: center;
            gap: 20px;
        }

        .preview-image {
            max-width: 100%;
            max-height: 300px;
            border: 2px solid #8b7355;
            border-radius: 4px;
            box-shadow: 0 5px 15px rgba(0,0,0,0.1);
        }

        .btn-analyze {
            background: #5a3e2b;
            color: #f5f0e8;
            padding: 12px 30px;
            border: none;
            border-radius: 4px;
            font-family: 'Cormorant Garamond', 'Noto Serif', serif;
            font-size: 18px;
            font-weight: 700;
            cursor: pointer;
            box-shadow: 0 4px 15px rgba(0,0,0,0.2);
            transition: all 0.3s;
            display: inline-flex;
            align-items: center;
            gap: 10px;
        }

        .btn-analyze:hover {
            background: #7a5e4b;
            transform: translateY(-2px);
        }

        /* LOADING OVERLAY */
        .loading-overlay {
            position: fixed;
            top: 0; left: 0; right: 0; bottom: 0;
            background: rgba(74, 55, 40, 0.9);
            z-index: 1000;
            display: none;
            flex-direction: column;
            justify-content: center;
            align-items: center;
            color: #f5f0e8;
        }

        .loading-spinner {
            width: 80px;
            height: 80px;
            border: 4px solid rgba(245, 240, 232, 0.1);
            border-left-color: #e8dcc8;
            border-radius: 50%;
            animation: spin 1.5s linear infinite;
            margin-bottom: 25px;
            position: relative;
        }

        .loading-text {
            font-size: 24px;
            font-family: 'Playfair Display', 'Noto Serif', serif;
            font-style: italic;
            margin-bottom: 10px;
            letter-spacing: 1px;
            text-align: center;
        }

        .loading-subtext {
            font-size: 14px;
            color: #a89070;
            letter-spacing: 2px;
            text-transform: uppercase;
            animation: pulse 2s infinite ease-in-out;
        }

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

        @keyframes pulse {
            0%, 100% { opacity: 0.6; }
            50% { opacity: 1; }
        }

        /* SCREEN 2: EDITOR SCREEN */
        .editor-screen {
            padding-top: 70px;
            min-height: 100vh;
            display: flex;
            flex-direction: column;
        }

        /* Sticky Toolbar */
        .toolbar {
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            height: 70px;
            background: #e8dcc8;
            border-bottom: 2px solid #8b7355;
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding: 0 30px;
            z-index: 500;
            box-shadow: 0 4px 20px rgba(0,0,0,0.1);
        }

        .toolbar::before {
            content: '';
            position: absolute;
            top: 4px; left: 4px; right: 4px; bottom: 4px;
            border-bottom: 1px solid #a89070;
            pointer-events: none;
        }

        .toolbar-brand {
            font-family: 'Great Vibes', 'Noto Serif', cursive;
            font-size: 32px;
            color: #5a3e2b;
            text-decoration: none;
        }

        .toolbar-actions {
            display: flex;
            align-items: center;
            gap: 10px;
        }

        .btn {
            padding: 8px 14px;
            border: 1px solid #8b7355;
            border-radius: 4px;
            cursor: pointer;
            font-family: 'Cormorant Garamond', 'Noto Serif', serif;
            font-size: 13px;
            font-weight: 700;
            transition: all 0.3s;
            display: inline-flex;
            align-items: center;
            gap: 6px;
            background: #f5f0e8;
            color: #5a3e2b;
        }

        .btn:hover {
            background: #e8dcc8;
            border-color: #5a3e2b;
        }

        .btn-primary {
            background: #5a3e2b;
            color: #f5f0e8;
            border-color: #5a3e2b;
        }

        .btn-primary:hover {
            background: #7a5e4b;
        }

        .btn-back {
            background: transparent;
            border-color: transparent;
            font-weight: 600;
        }
        
        .btn-back:hover {
            background: rgba(90, 62, 43, 0.1);
        }

        /* Zoom Slider Tool */
        .zoom-control {
            display: flex;
            align-items: center;
            gap: 8px;
            background: rgba(90, 62, 43, 0.05);
            padding: 6px 12px;
            border-radius: 4px;
            border: 1px solid rgba(139, 115, 85, 0.2);
        }

        .zoom-label {
            font-size: 12px;
            font-weight: 700;
            color: #5a3e2b;
        }

        .zoom-slider {
            width: 80px;
            accent-color: #5a3e2b;
            cursor: pointer;
        }

        /* Editor Layout split */
        .editor-layout {
            display: grid;
            grid-template-columns: 280px 1fr 300px;
            transition: all 0.3s ease;
            flex: 1;
            width: 100%;
        }

        /* Hide reference/config sidebar dynamics */
        .editor-layout.ref-collapsed {
            grid-template-columns: 0px 1fr 300px;
        }

        .editor-layout.conf-collapsed {
            grid-template-columns: 280px 1fr 0px;
        }

        .editor-layout.both-collapsed {
            grid-template-columns: 0px 1fr 0px;
        }

        /* Left Column: Reference Image */
        .reference-column {
            background: #e8dcc8;
            border-right: 2px solid #8b7355;
            padding: 20px;
            height: calc(100vh - 70px);
            position: sticky;
            top: 70px;
            overflow: hidden;
            display: flex;
            flex-direction: column;
            transition: padding 0.3s ease, opacity 0.3s ease;
        }

        .editor-layout.ref-collapsed .reference-column, 
        .editor-layout.both-collapsed .reference-column {
            padding: 0;
            opacity: 0;
            border-right: none;
        }

        .reference-title {
            font-family: 'Playfair Display', 'Noto Serif', serif;
            font-size: 16px;
            font-weight: 700;
            color: #5a3e2b;
            margin-bottom: 15px;
            text-align: center;
            border-bottom: 1px solid #8b7355;
            padding-bottom: 8px;
            white-space: nowrap;
        }

        .reference-img-wrapper {
            flex: 1;
            overflow-y: auto;
            border: 1px solid #a89070;
            background: #f5f0e8;
            display: flex;
            justify-content: center;
            align-items: flex-start;
            padding: 10px;
        }

        .reference-img {
            max-width: 100%;
            height: auto;
            display: block;
            box-shadow: 0 4px 10px rgba(0,0,0,0.1);
        }

        /* Right Column: Customizer Settings */
        .settings-column {
            background: #e8dcc8;
            border-left: 2px solid #8b7355;
            padding: 20px;
            height: calc(100vh - 70px);
            position: sticky;
            top: 70px;
            overflow-y: auto;
            display: flex;
            flex-direction: column;
            gap: 20px;
            transition: padding 0.3s ease, opacity 0.3s ease;
        }

        .editor-layout.conf-collapsed .settings-column,
        .editor-layout.both-collapsed .settings-column {
            padding: 0;
            opacity: 0;
            border-left: none;
        }

        .settings-section-title {
            font-family: 'Playfair Display', 'Noto Serif', serif;
            font-size: 15px;
            font-weight: 700;
            color: #5a3e2b;
            border-bottom: 1px solid #8b7355;
            padding-bottom: 6px;
            margin-bottom: 12px;
            text-transform: uppercase;
            letter-spacing: 1px;
        }

        .settings-group {
            display: flex;
            flex-direction: column;
            gap: 10px;
        }

        .settings-row {
            display: flex;
            justify-content: space-between;
            align-items: center;
            font-size: 13px;
            font-weight: 600;
        }

        .settings-row label {
            color: #5a3e2b;
        }

        .settings-row input[type="color"] {
            border: none;
            width: 45px;
            height: 25px;
            background: transparent;
            cursor: pointer;
        }

        .settings-row input[type="range"] {
            width: 100px;
            accent-color: #5a3e2b;
        }

        .settings-select {
            padding: 4px 8px;
            border: 1px solid #8b7355;
            background: #f5f0e8;
            color: #5a3e2b;
            font-family: inherit;
            font-size: 12px;
            border-radius: 3px;
            width: 120px;
        }

        .btn-settings-toggle {
            padding: 4px 8px;
            font-size: 11px;
            font-weight: bold;
            border-radius: 3px;
        }

        /* Center Column: Menu Canvas */
        .canvas-column {
            display: flex;
            justify-content: center;
            align-items: flex-start;
            padding: 40px 20px;
            overflow: auto;
            height: calc(100vh - 70px);
            background: #f5f0e8;
        }

        .menu-scale-wrapper {
            transform-origin: top center;
            transition: transform 0.2s ease;
        }

        /* VINTAGE MENU STYLES */
        .menu-container {
            width: 900px;
            min-height: 650px;
            background: #e8dcc8;
            background-image: 
                url("data:image/svg+xml,%3Csvg width='100' height='100' viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M11 18c3.866 0 7-3.134 7-7s-3.134-7-7-7-7 3.134-7 7 3.134 7 7 7zm48 25c3.866 0 7-3.134 7-7s-3.134-7-7-7-7 3.134-7 7 3.134 7 7 7zm-43-7c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zm63 31c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zM34 90c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zm56-76c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zM12 86c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm28-65c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm23-11c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm-6 60c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm29 22c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zM32 63c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm57-13c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm-9-21c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM60 91c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM35 41c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM12 60c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2z' fill='%23d4c4a8' fill-opacity='0.2' fill-rule='evenodd'/%3E%3C/svg%3E");
            padding: 35px 40px;
            position: relative;
            box-shadow: 0 10px 40px rgba(0,0,0,0.15);
            border: 3px solid #8b7355;
            transition: all 0.3s ease;
        }

        /* Border presets style */
        .menu-container.border-double {
            border: 3px double #8b7355;
        }
        .menu-container.border-double::before {
            content: '';
            position: absolute;
            top: 10px; left: 10px; right: 10px; bottom: 10px;
            border: 1px solid #a89070;
            pointer-events: none;
        }
        .menu-container.border-thick {
            border: 6px solid #8b7355;
        }
        .menu-container.border-thick::before {
            display: none;
        }
        .menu-container.border-dashed {
            border: 3px dashed #8b7355;
        }
        .menu-container.border-dashed::before {
            display: none;
        }
        .menu-container.border-none {
            border: none;
            box-shadow: none;
        }
        .menu-container.border-none::before {
            display: none;
        }

        /* Header */
        .header {
            display: flex;
            align-items: center;
            justify-content: center;
            margin-bottom: 25px;
            position: relative;
        }

        .logo-section {
            display: flex;
            align-items: center;
            justify-content: center;
            flex-direction: column;
            gap: 10px;
            width: 100%;
        }

        .logo-section.align-left {
            align-items: flex-start;
        }

        .logo-wrapper-row {
            display: flex;
            align-items: center;
            gap: 15px;
        }

        .logo-icon {
            width: 70px;
            height: 70px;
        }

        .custom-logo-image {
            display: block;
            object-fit: contain;
            border-radius: 4px;
        }

        .logo-upload-row {
            align-items: flex-start;
        }

        .logo-upload-actions {
            display: flex;
            flex-direction: column;
            gap: 6px;
            width: 120px;
        }

        .logo-upload-actions .btn {
            justify-content: center;
            width: 100%;
        }

        .logo-text {
            font-family: 'Great Vibes', 'Noto Serif', cursive;
            font-size: 52px;
            color: #5a3e2b;
            line-height: 1;
            text-align: left;
        }

        .logo-sub {
            font-family: 'Cormorant Garamond', 'Noto Serif', serif;
            font-size: 11px;
            letter-spacing: 3px;
            text-transform: uppercase;
            color: #8b7355;
            text-align: center;
            margin-top: 2px;
            display: block;
        }

        /* Divider */
        .divider {
            display: flex;
            align-items: center;
            gap: 15px;
            margin: 20px 0;
        }

        .divider-line {
            flex: 1;
            height: 1px;
            background: #8b7355;
        }

        .divider-icon {
            width: 24px;
            height: 24px;
            opacity: 0.6;
        }

        /* Content Grid */
        .content-grid {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 30px;
        }

        .content-grid.single-column {
            grid-template-columns: 1fr;
            max-width: 600px;
            margin: 0 auto;
        }

        .column {
            display: flex;
            flex-direction: column;
            gap: 20px;
        }

        /* Section */
        .section {
            position: relative;
            border: 1px solid transparent;
            transition: all 0.2s ease;
        }

        .section.selected-edit {
            border: 1px dashed #8b7355;
            background: rgba(255, 255, 255, 0.05);
        }

        .section-title {
            font-family: 'Playfair Display', 'Noto Serif', serif;
            font-size: 28px;
            color: #5a3e2b;
            text-align: center;
            margin-bottom: 12px;
            position: relative;
        }

        .section-title::after {
            content: '';
            display: block;
            width: 60px;
            height: 1px;
            background: #8b7355;
            margin: 5px auto 0;
        }

        /* Menu Items */
        .item {
            display: flex;
            justify-content: space-between;
            align-items: baseline;
            margin-bottom: 8px;
            position: relative;
            border: 1px solid transparent;
            transition: all 0.2s ease;
        }

        .item.selected-edit {
            border: 1px dashed #8b7355;
            background: rgba(255, 255, 255, 0.08);
        }

        .item::after {
            content: '';
            position: absolute;
            bottom: 4px;
            left: 0;
            right: 0;
            border-bottom: 1px dotted #b8a88a;
            z-index: 0;
        }

        /* Custom dotted connector styles */
        .item.connector-dashed::after {
            border-bottom-style: dashed;
        }
        .item.connector-solid::after {
            border-bottom-style: solid;
            opacity: 0.5;
        }
        .item.connector-none::after {
            display: none;
        }

        .item-name {
            font-size: 15px;
            color: #4a3728;
            background: #e8dcc8;
            padding-right: 8px;
            position: relative;
            z-index: 1;
            font-weight: 600;
            display: inline-block;
            transition: background 0.3s ease;
        }

        .item-desc {
            font-size: 11px;
            color: #8b7355;
            font-style: italic;
            display: block;
            margin-top: -2px;
            margin-bottom: 4px;
            padding-left: 2px;
        }

        .item-price {
            font-size: 15px;
            color: #5a3e2b;
            font-weight: 700;
            background: #e8dcc8;
            padding-left: 8px;
            position: relative;
            z-index: 1;
            white-space: nowrap;
            display: inline-block;
            transition: background 0.3s ease;
        }

        /* Special Box */
        .special-box {
            border: 2px solid #8b7355;
            padding: 15px 20px;
            margin-top: 10px;
            position: relative;
            background: rgba(255,255,255,0.1);
        }

        .special-box::before {
            content: '';
            position: absolute;
            top: 4px; left: 4px; right: 4px; bottom: 4px;
            border: 1px solid #a89070;
            pointer-events: none;
        }

        .special-title {
            font-family: 'Playfair Display', 'Noto Serif', serif;
            font-size: 32px;
            color: #5a3e2b;
            text-align: center;
            margin-bottom: 10px;
        }

        /* Bottom decorative */
        .bottom-deco {
            text-align: center;
            margin-top: 20px;
            font-size: 11px;
            color: #8b7355;
            font-style: italic;
        }

        /* Hair icon SVG */
        .hair-icon {
            width: 50px;
            height: 50px;
            margin: 0 auto 10px;
            display: block;
        }

        /* Quick Deletion & Insertion overlays */
        .delete-btn-quick {
            position: absolute;
            right: -24px;
            top: 50%;
            transform: translateY(-50%);
            background: #c94a4a;
            color: white;
            border: none;
            border-radius: 50%;
            width: 18px;
            height: 18px;
            font-size: 10px;
            display: none;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            z-index: 100;
            box-shadow: 0 2px 5px rgba(0,0,0,0.15);
        }

        .delete-btn-quick:hover {
            background: #a83232;
        }

        .section-delete-btn-quick {
            position: absolute;
            right: -55px;
            top: 0;
            background: #c94a4a;
            color: white;
            border: none;
            border-radius: 4px;
            padding: 2px 6px;
            font-size: 11px;
            display: none;
            align-items: center;
            cursor: pointer;
            z-index: 100;
            box-shadow: 0 2px 5px rgba(0,0,0,0.15);
        }

        .section-delete-btn-quick:hover {
            background: #a83232;
        }

        .section:hover {
            border: 1px dashed rgba(139, 115, 85, 0.4);
        }
        .section:hover .section-delete-btn-quick {
            display: block;
        }

        .item:hover {
            border: 1px dashed rgba(139, 115, 85, 0.3);
        }
        .item:hover .delete-btn-quick {
            display: flex;
        }

        .add-item-btn-inline {
            display: flex;
            align-items: center;
            justify-content: center;
            width: 100%;
            margin-top: 8px;
            padding: 4px;
            border: 1px dashed #8b7355;
            background: rgba(255, 255, 255, 0.2);
            color: #5a3e2b;
            font-family: 'Cormorant Garamond', 'Noto Serif', serif;
            font-size: 12px;
            font-weight: 700;
            cursor: pointer;
            opacity: 0.6;
            transition: all 0.2s;
        }

        .add-item-btn-inline:hover {
            opacity: 1;
            background: rgba(255, 255, 255, 0.5);
        }

        [contenteditable="true"] {
            outline: none;
        }

        [contenteditable="true"]:hover {
            background: rgba(255, 255, 255, 0.2);
        }

        [contenteditable="true"]:focus {
            background: rgba(255, 255, 255, 0.35);
            box-shadow: 0 0 0 1px #8b7355;
        }

        /* TOAST NOTIFICATION */
        .toast {
            position: fixed;
            bottom: 30px;
            right: 30px;
            background: #5a3e2b;
            color: #f5f0e8;
            padding: 12px 24px;
            border-radius: 4px;
            box-shadow: 0 5px 15px rgba(0,0,0,0.3);
            border-left: 4px solid #8b7355;
            font-size: 14px;
            font-weight: 600;
            z-index: 2000;
            transform: translateY(100px);
            opacity: 0;
            transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
        }

        .toast.show {
            transform: translateY(0);
            opacity: 1;
        }
/* Quick Style Presets */
.style-preset-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.style-preset-btn {
    min-height: 58px;
    padding: 8px;
    border: 1px solid #8b7355;
    border-radius: 4px;
    background: #f5f0e8;
    color: #5a3e2b;
    font-family: inherit;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.2;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 6px;
    text-align: left;
    transition: all 0.2s ease;
}

.style-preset-btn:hover {
    transform: translateY(-1px);
    border-color: #5a3e2b;
    box-shadow: 0 4px 10px rgba(0,0,0,0.08);
}

.style-preset-swatches {
    display: flex;
    gap: 4px;
}

.style-preset-swatch {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 1px solid rgba(0,0,0,0.16);
}
