/* Visionary Style System */
:root {
    --color-primary-base: #3b82f6;
    --color-primary-dark: #2563eb;
    --color-primary-focus-ring: rgba(59, 130, 246, 0.15);
    --color-primary-bg-tint: #e7f3ff;
    --color-accent-danger: #ef4444;
    --color-accent-danger-hover: #d91c1c;
    --color-text-primary: #1d1d1f;
    --color-text-secondary: #525866;
    --color-text-inverse: #ffffff;
    --color-text-subtle: #909ab0;
    --color-bg-body: #f0f2f5;
    --color-bg-canvas: #ffffff;
    --color-bg-subtle: #f8f9fa;
    --color-bg-muted: #f0f3f7;
    --color-border-subtle: #e1e5e9;
    --color-border-base: #dfe3e9;
    --font-family-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Inter", sans-serif;
    --font-size-xs: 0.75rem; --font-size-sm: 0.8125rem; --font-size-base: 0.9375rem; --font-size-md: 1rem; --font-size-lg: 1.125rem;
    --font-weight-medium: 500; --font-weight-semibold: 600;
    --line-height-base: 1.6;
    --space-1: 0.25rem; --space-2: 0.5rem; --space-3: 0.75rem; --space-4: 1rem; --space-5: 1.25rem; --space-6: 1.5rem;
    --radius-sm: 8px; --radius-md: 12px; --radius-lg: 18px; --radius-full: 50%;
    --border-width-base: 1px;
    --shadow-sm: 0 4px 12px rgba(30, 40, 60, 0.06); --shadow-md: 0 8px 25px rgba(30, 40, 60, 0.1); --shadow-lg: 0 15px 35px rgba(30, 40, 60, 0.12);
    --shadow-focus-ring: 0 0 0 4px var(--color-primary-focus-ring);
    --transition-snap: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-springy: 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    --z-card: 10; --z-dragging: 1000; --z-modal-backdrop: 2000; --z-modal-content: 2001; --z-popover: 3000; --z-context-menu: 4000; --z-confirm-modal: 5000;
}

.modal-backdrop { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: transparent; backdrop-filter: none; -webkit-backdrop-filter: none; display: flex; justify-content: center; align-items: center; padding-top: 0; opacity: 0; transition: opacity 0.3s ease; pointer-events: none; z-index: var(--z-modal-backdrop); }
.modal-backdrop:not(.hidden) { opacity: 1; pointer-events: auto; }
#modal-backdrop { z-index: var(--z-modal-backdrop); }
#modal-backdrop .modal-content { max-width: 800px; background: rgba(255, 255, 255, 0.25); backdrop-filter: blur(15px); -webkit-backdrop-filter: blur(15px); border: 1px solid rgba(255, 255, 255, 0.3); box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1); }
#flavor-manager-modal-backdrop { background-color: transparent; backdrop-filter: none; -webkit-backdrop-filter: none; z-index: calc(var(--z-modal-backdrop) + 100); pointer-events: none; }
#flavor-manager-modal-backdrop .modal-content {
    max-width: 620px;
    background: rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    pointer-events: auto;
    position: absolute;
    cursor: move;
    padding-top: 12px !important;
    padding-bottom: 12px !important;
    border-radius: 18px !important;
}
#flavor-manager-modal-backdrop .modal-content.dragging { cursor: grabbing; user-select: none; }
#flavor-manager-modal-backdrop .flavor-palette-grid { cursor: default; }
#flavor-manager-modal-backdrop .modal-header {
    display: block;
    width: 100%;
    padding-left: 0% !important;
    padding-right: 18px !important;
    padding-top: 3px !important;
    padding-bottom: 0 !important;
    position: relative;
}
#flavor-manager-modal-backdrop .modal-header h4 {
    margin: 0;
    font-size: 1rem;
    font-family: 'Inter', 'Segoe UI', Arial, sans-serif;
    font-weight: 400;
    text-align: left;
    color: #1d1d1f;
    letter-spacing: -0.5px;
    margin-bottom: 16px;
    width: 100%;
}
#flavor-manager-modal-backdrop .modal-close-btn {
    position: absolute;
    top: 0px;
    right: 2px;
    font-size: 1.2rem;
    width: 24px;
    height: 24px;
    padding-top: 0 !important;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: #888;
    cursor: pointer;
    line-height: 1;
}
#flavor-manager-modal-backdrop .modal-body {
    padding-top: 0 !important;
    padding-bottom: 0 !important;
}
#confirm-modal-backdrop { z-index: var(--z-confirm-modal); align-items: center; padding-top: 0; background-color: transparent; backdrop-filter: none; -webkit-backdrop-filter: none; }
#confirm-modal-backdrop .modal-content { max-width: 400px; padding: var(--space-5); background: rgba(255, 255, 255, 0.15); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); border: 1px solid rgba(255, 255, 255, 0.2); box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2); }
#confirm-modal-backdrop .modal-actions { background-color: transparent; border-top: none; }
#confirm-modal-backdrop h4 { font-weight: var(--font-weight-semibold); color: var(--color-text-primary); font-size: var(--font-size-base); margin-bottom: var(--space-3); }
#confirm-modal-backdrop p { color: var(--color-text-subtle); font-size: var(--font-size-sm); font-weight: normal; line-height: 1.5; }
#confirm-modal-backdrop .btn-secondary { background-color: rgba(0, 0, 0, 0.08); color: var(--color-text-primary); border: none; }
#confirm-modal-backdrop .btn-secondary:hover { background-color: rgba(0, 0, 0, 0.12); }

.modal-backdrop .modal-content { width: 90vw; border-radius: var(--radius-lg); background: transparent; box-shadow: var(--shadow-lg); transform: scale(0.95); transition: transform 0.3s var(--transition-springy); display: flex; flex-direction: column; max-height: 90vh; z-index: var(--z-modal-content); position: relative; }
.modal-backdrop:not(.hidden) .modal-content { transform: scale(1); }
#modal-backdrop .modal-content { max-width: 800px; }
#flavor-manager-modal-backdrop .modal-content { max-width: 400px; }
#flavor-manager-modal-backdrop .modal-body { padding: var(--space-1) var(--space-3) var(--space-5); display: flex; justify-content: center; align-items: flex-start; }
#confirm-modal-backdrop .modal-content { max-width: 400px; padding: var(--space-5);}

/* === NEW FUSE MODAL STYLES === */
#flavor-editor-modal-backdrop { background-color: transparent; backdrop-filter: none; -webkit-backdrop-filter: none; align-items: center; padding-top: 0; z-index: calc(var(--z-modal-backdrop) + 200); }
#flavor-editor-modal-backdrop .modal-content { 
    background: rgba(255, 255, 255, 0.25); 
    backdrop-filter: blur(15px); 
    -webkit-backdrop-filter: blur(15px); 
    border: 1px solid rgba(255, 255, 255, 0.3); 
    border-radius: 20px; 
    padding: 25px 35px; 
    box-shadow: 0 20px 40px rgba(0,0,0,0.25); 
    width: 90%; 
    max-width: 720px; 
    transform: scale(0.95) translateY(10px); 
    transition: transform 0.35s cubic-bezier(0.25, 0.8, 0.25, 1), opacity 0.3s ease-out; 
    max-height: 90vh; 
    overflow-y: auto; 
    position: relative; 
    z-index: calc(var(--z-modal-content) + 200);
}
#flavor-editor-modal-backdrop .modal-content::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(ellipse 1600px 1200px at -500px -350px, rgba(0, 0, 0, 0.25) 0%, rgba(0, 0, 0, 0.15) 50%, rgba(0, 0, 0, 0.05) 80%, transparent 100%);
    border-radius: 20px;
    pointer-events: none;
    z-index: 1;
}
#flavor-editor-modal-backdrop.hidden .modal-content { transform: scale(0.95) translateY(10px); }
#flavor-editor-modal-backdrop:not(.hidden) .modal-content { transform: scale(1) translateY(0); }
#flavor-editor-modal-backdrop .modal-header { padding: 0; border: none; margin-bottom: 8px; text-align: center; position: relative; z-index: 10; }
#flavor-editor-modal-backdrop h2 { font-size: 1.75rem; font-weight: 700; color: #1d1d1f; line-height: 1.2; width: 100%; position: relative; z-index: 10; }
#flavor-editor-modal-backdrop .modal-body { padding: 0; position: relative; z-index: 10; }
#flavor-editor-modal-backdrop .modal-subtitle { font-size: 0.95rem; color: #3c3c43; opacity: 0.9; margin-top: 0; margin-bottom: 20px; position: relative; z-index: 10; }
#flavor-editor-modal-backdrop .modal-close-btn { position: absolute; z-index: 10; }

/* Enhanced Apple-sequel form styles for flavor editor */
#flavor-editor-modal-backdrop .form-group { margin-bottom: 1rem; }
#flavor-editor-modal-backdrop .form-label { display: block; font-size: 0.875rem; font-weight: 500; color: #1d1d1f; margin-bottom: 0.5rem; }
#flavor-editor-modal-backdrop .form-input, 
#flavor-editor-modal-backdrop .form-textarea, 
#flavor-editor-modal-backdrop .form-select { width: 100%; padding: 12px 16px; border-radius: 10px; font-size: 0.95rem; color: #1d1d1f; background-color: #f7f7f8; border: 1px solid rgba(170, 170, 180, 0.4); transition: background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease; -webkit-appearance: none; -moz-appearance: none; appearance: none; }
#flavor-editor-modal-backdrop .form-select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%236B7280'%3E%3Cpath fill-rule='evenodd' d='M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z' clip-rule='evenodd'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 0.75rem center; background-size: 1.25em 1.25em; padding-right: 2.5rem; }
#flavor-editor-modal-backdrop .form-input::placeholder, 
#flavor-editor-modal-backdrop .form-textarea::placeholder { color: rgba(60, 60, 67, 0.6); }
#flavor-editor-modal-backdrop .form-input:focus, 
#flavor-editor-modal-backdrop .form-textarea:focus, 
#flavor-editor-modal-backdrop .form-select:focus { outline: none; border-color: #007aff; background-color: rgba(255, 255, 255, 0.5); box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.2); }
#flavor-editor-modal-backdrop .form-helper-text { font-size: 0.8rem; color: #6e6e73; margin-top: 0.4rem; padding-left: 2px; }

/* Enhanced modal buttons for flavor editor */
#flavor-editor-modal-backdrop .btn { padding: 10px 20px; border-radius: 8px; font-weight: 500; font-size: 0.95rem; transition: background-color 0.2s ease, transform 0.1s ease, box-shadow 0.2s ease; }
#flavor-editor-modal-backdrop .btn-primary { background-color: #007aff; color: white; border: none; }
#flavor-editor-modal-backdrop .btn-primary:hover { background-color: #005ecb; }
#flavor-editor-modal-backdrop .btn-secondary { background-color: transparent; color: #007aff; font-weight: 500; box-shadow: none; border: none; }
#flavor-editor-modal-backdrop .btn-secondary:hover { background-color: rgba(0, 122, 255, 0.08); }
#flavor-editor-modal-backdrop .btn:active { transform: translateY(1px) scale(0.98); }

/* Modal close button styling */
.modal-close-btn { position: absolute; top: 18px; right: 18px; background: none; border: none; font-size: 1.9rem; color: rgba(60, 60, 67, 0.5); cursor: pointer; padding: 5px; line-height: 1; transition: color 0.2s ease, transform 0.2s ease; user-select: none; }
.modal-close-btn:hover { color: rgba(60, 60, 67, 0.8); transform: scale(1.1); }

.modal-header .modal-close-btn {
    position: static;
    top: auto;
    right: auto;
    margin-left: var(--space-3);
}

/* Modal subtitle styling */
#flavor-editor-modal-backdrop .modal-subtitle { font-size: 0.95rem; color: #3c3c43; opacity: 0.9; margin-top: 0; margin-bottom: 20px; }

.modal-header { padding: var(--space-4) var(--space-5); display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid rgba(255, 255, 255, 0.2); flex-shrink: 0; }
.modal-title-area { flex-grow: 1; }
.modal-title-area input { font-size: var(--font-size-lg); font-weight: var(--font-weight-semibold); border: none; padding: 0; box-shadow: none; width: 100%; }
.modal-title-area small { font-size: var(--font-size-xs); color: var(--color-text-subtle); }
.modal-tabs { display: flex; gap: var(--space-1); background: var(--color-bg-muted); padding: var(--space-1); border-radius: var(--radius-md); margin: 0 var(--space-4); }
.modal-tab { padding: var(--space-2) var(--space-3); border-radius: var(--radius-sm); font-size: var(--font-size-sm); font-weight: var(--font-weight-medium); cursor: pointer; border: none; background: transparent; transition: all .2s ease; }
.modal-tab.active { background: var(--color-bg-canvas); color: var(--color-primary-base); box-shadow: var(--shadow-sm); }
.modal-body { overflow-y: auto; padding: var(--space-5) }
.modal-actions { padding: var(--space-4); display: flex; justify-content: space-between; align-items: center; border-top: 1px solid var(--color-border-subtle); background-color: var(--color-bg-subtle); border-bottom-left-radius: var(--radius-lg); border-bottom-right-radius: var(--radius-lg); flex-shrink: 0; }
.form-group { margin-bottom: 1rem; }
label, .form-label { display: block; font-size: 0.875rem; font-weight: 500; color: #1d1d1f; margin-bottom: 0.5rem; }

/* Custom title input styling */
#modal-title-input {
    font-size: 1.5rem !important;
    font-weight: var(--font-weight-semibold) !important;
    border: none !important;
    padding: 4px 8px !important;
    margin: -4px -8px !important;
    background-color: transparent !important;
    box-shadow: none !important;
}
#modal-title-input:hover {
     background-color: var(--color-bg-subtle) !important;
}
#modal-title-input:focus {
     background-color: var(--color-bg-subtle) !important;
     border: none !important;
     box-shadow: none !important;
}

#modal-title-input::placeholder {
    color: var(--color-text-subtle);
}

input[type="text"], textarea, select, .form-input, .form-textarea, .form-select { width: 100%; padding: 12px 16px; border-radius: 10px; font-size: 0.95rem; color: #1d1d1f; background-color: #f7f7f8; border: 1px solid rgba(170, 170, 180, 0.4); transition: background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease; -webkit-appearance: none; -moz-appearance: none; appearance: none; }
input[type="text"]:focus, textarea:focus, select:focus, .form-input:focus, .form-textarea:focus, .form-select:focus { outline: none; border-color: #007aff; background-color: rgba(255, 255, 255, 0.5); box-shadow: none; }
.flavor-palette-grid { display: flex; gap: 8px; margin-top: 0; justify-content: center; }
.flavor-swatch { width: 45px; height: 45px; border-radius: 8px; border: 1px solid #e0e0e0; cursor: pointer; transition: transform 0.2s ease-out, box-shadow 0.2s ease-out; position: relative; box-sizing: border-box; }
.flavor-swatch:hover { transform: translateY(-5px); box-shadow: 0 6px 15px rgba(0, 0, 0, 0.15); }
.flavor-swatch-color { width: 100%; height: 100%; border-radius: 7px; border: none; }
.flavor-swatch.selected { border-color: var(--color-primary-base); background-color: var(--color-primary-bg-tint); }
.flavor-swatch .selected-icon { margin-left: auto; color: var(--color-primary-base); opacity: 0; transition: opacity 0.2s ease; }
.flavor-swatch.selected .selected-icon { opacity: 1; }
.decon-recon-layout { display: grid; grid-template-columns: 250px 1fr; gap: var(--space-5); }
.block-palette, .crafting-canvas { padding: var(--space-4); background: var(--color-bg-subtle); border-radius: var(--radius-md); }
.block-palette h4, .crafting-canvas h4 { font-size: var(--font-size-base); margin-top: 0; margin-bottom: var(--space-4); color: var(--color-text-secondary); }
.algo-block { background:#fff; border:1px solid #e1e5eb; padding: var(--space-2) var(--space-3); border-radius: var(--radius-sm); font-size: var(--font-size-sm); cursor: grab; display:flex; align-items:center; gap: var(--space-2); transition: all .2s ease; margin-bottom: var(--space-2); }
.algo-block:hover { border-color: var(--color-primary-base); box-shadow:0 2px 8px rgba(59,130,246,0.1);}
#recipe-constructor-canvas { min-height: 300px; display: flex; flex-direction: column; gap: var(--space-2); }
.constructor-block { padding: var(--space-3); border: 1px solid var(--color-border-base); border-radius: var(--radius-sm); background: #fff; display: flex; justify-content: space-between; align-items: center; gap: var(--space-3); }
.constructor-block.drop-placeholder { height: 50px; border-style: dashed; background: var(--color-primary-bg-tint); border-color: var(--color-primary-base); }
.constructor-block-main { display: flex; align-items: center; gap: var(--space-3); flex-grow: 1; }
.constructor-block label { margin: 0; font-size: var(--font-size-base); }
.file-list { 
    display: flex; 
    flex-direction: column; 
    gap: var(--space-2);
}

.file-item { 
    display: flex; 
    align-items: center; 
    gap: var(--space-4); 
    padding: var(--space-4); 
    background: var(--color-bg-canvas); 
    border: 1px solid var(--color-border-subtle); 
    border-radius: var(--radius-md);
    transition: all 0.2s ease; 
    position: relative;
    margin-bottom: 0;
}

.file-item:last-child {
    margin-bottom: 0;
}

.file-item:hover { 
    background: rgba(59, 130, 246, 0.03);
    border-color: var(--color-primary-base);
    transform: none;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.1);
}

.btn { font-family: inherit; border: none; border-radius: var(--radius-md); padding: var(--space-3) var(--space-5); font-size: var(--font-size-base); font-weight: var(--font-weight-medium); cursor: pointer; transition: all var(--transition-snap); display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2); }
.btn:active { transform: translateY(1px) scale(0.98); }
.btn-primary { background-color: #007aff; color: white; }
.btn-primary:hover { background-color: #005ecb; box-shadow: 0 3px 6px rgba(0,0,0,0.1); }
.btn-secondary { background-color: var(--color-bg-muted); color: var(--color-text-primary); }
.btn-secondary:hover { background-color: #e6e9ef; }
.btn-danger { background-color: var(--color-accent-danger); color: white; }
.btn-danger:hover { background-color: var(--color-accent-danger-hover); }
.btn-icon { background: none; border: none; padding: var(--space-1); cursor: pointer; color: var(--color-text-secondary); line-height: 0; border-radius: var(--radius-sm); }
.btn-icon:hover { background-color: #eef2f7; color: var(--color-accent-danger); }
#context-menu { position: fixed; z-index: var(--z-context-menu); background: var(--color-bg-canvas); border-radius: var(--radius-md); box-shadow: var(--shadow-lg); padding: var(--space-2); min-width: 200px; opacity: 0; transform: scale(0.95); transition: all .15s ease; pointer-events: none; }
#context-menu.visible { opacity: 1; transform: scale(1); pointer-events: auto; }
.context-menu-item { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-2) var(--space-3); border-radius: var(--radius-sm); font-size: var(--font-size-sm); cursor: pointer; background: none; border: none; width: 100%; text-align: left; }
.context-menu-item:hover { background-color: var(--color-bg-muted); }
.context-menu-item i { color: var(--color-text-secondary); }
.context-menu-divider { height: 1px; background-color: var(--color-border-subtle); margin: var(--space-2) 0; }

/* === FILE MANAGEMENT STYLES === */
.file-upload-area { 
    border: none; 
    border-radius: var(--radius-md); 
    overflow: hidden; 
    background: transparent;
}

.file-drop-zone { 
    padding: var(--space-6) var(--space-4); 
    border: 1px dashed var(--color-border-base); 
    border-radius: var(--radius-md); 
    text-align: center; 
    background: #f7f7f8;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); 
    margin-bottom: 0; 
    position: relative;
}

.file-drop-zone.drag-over { 
    border-color: var(--color-primary-base); 
    background: var(--color-primary-bg-tint);
    border-style: solid; 
    transform: scale(1.02);
    box-shadow: 0 8px 25px rgba(59, 130, 246, 0.15);
}

.drop-zone-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-2);
}

.drop-zone-icon { 
    display: none;
}

.file-drop-zone p {
    font-size: var(--font-size-base);
    color: var(--color-text-subtle);
    margin: 0;
    font-weight: var(--font-weight-normal);
}

.upload-browse-btn { 
    background: none; 
    border: none; 
    color: var(--color-text-subtle); 
    text-decoration: underline;
    cursor: pointer; 
    font-size: inherit; 
    padding: 0;
    margin: 0;
    font-weight: var(--font-weight-normal);
    transition: all 0.2s ease;
    display: inline;
}

.upload-browse-btn:hover { 
    color: var(--color-primary-base); 
    text-decoration: underline;
}

.upload-progress-container { 
    margin-bottom: var(--space-4); 
}

.upload-progress-item { 
    background: var(--color-bg-canvas); 
    border: 1px solid var(--color-border-subtle); 
    border-radius: var(--radius-md); 
    padding: var(--space-4); 
    margin-bottom: var(--space-3); 
    box-shadow: var(--shadow-sm);
}

.upload-progress-item:last-child { 
    margin-bottom: 0; 
}

.upload-progress-header { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    margin-bottom: var(--space-3); 
}

.upload-filename { 
    font-weight: var(--font-weight-semibold); 
    color: var(--color-text-primary); 
    font-size: var(--font-size-base);
}

.upload-filesize { 
    font-size: var(--font-size-sm); 
    color: var(--color-text-secondary); 
}

.upload-progress-bar { 
    width: 100%; 
    height: 8px; 
    background: var(--color-bg-muted); 
    border-radius: var(--radius-full); 
    overflow: hidden; 
}

.upload-progress-fill { 
    height: 100%; 
    background: linear-gradient(90deg, var(--color-primary-base) 0%, var(--color-primary-dark) 100%);
    border-radius: var(--radius-full); 
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1); 
}

.upload-status { 
    font-size: var(--font-size-sm); 
    color: var(--color-text-secondary); 
    margin-top: var(--space-2); 
}

.upload-status.success { 
    color: #10b981; 
}

.upload-status.error { 
    color: var(--color-accent-danger); 
}

.file-list-container { 
    margin-top: var(--space-4); 
    background: transparent;
    border: none;
    overflow: visible;
}

.file-list-container:empty { 
    display: none; 
}

.file-list { 
    display: flex; 
    flex-direction: column; 
    gap: var(--space-3);
}

.file-item { 
    display: flex; 
    align-items: center; 
    gap: var(--space-4); 
    padding: var(--space-4); 
    background: var(--color-bg-canvas); 
    border: 1px solid var(--color-border-subtle); 
    border-radius: var(--radius-md);
    transition: all 0.2s ease; 
    position: relative;
    margin-bottom: 0;
    box-shadow: var(--shadow-sm);
}

.file-item:last-child {
    margin-bottom: 0;
}

.file-item:hover { 
    background: rgba(59, 130, 246, 0.03);
    border-color: var(--color-primary-base);
    transform: none;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.1);
}

.file-preview { 
    width: 48px; 
    height: 48px; 
    border-radius: var(--radius-md); 
    overflow: hidden; 
    flex-shrink: 0; 
    background: linear-gradient(135deg, var(--color-bg-muted) 0%, var(--color-bg-subtle) 100%);
    display: flex; 
    align-items: center; 
    justify-content: center; 
    border: 1px solid var(--color-border-subtle);
    box-shadow: var(--shadow-sm);
}

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

.file-preview-icon { 
    width: 24px; 
    height: 24px; 
    color: var(--color-primary-base); 
    opacity: 0.7;
}

.file-info { 
    flex-grow: 1; 
    min-width: 0; 
}

.file-name { 
    font-weight: var(--font-weight-semibold); 
    color: var(--color-text-primary); 
    white-space: nowrap; 
    overflow: hidden; 
    text-overflow: ellipsis; 
    font-size: var(--font-size-base);
    margin-bottom: var(--space-1);
}

.file-meta { 
    font-size: var(--font-size-sm); 
    color: var(--color-text-subtle); 
}

.file-actions { 
    display: flex; 
    gap: var(--space-2);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.file-item:hover .file-actions {
    opacity: 1;
}

.file-action-btn { 
    background: var(--color-bg-muted); 
    border: 1px solid var(--color-border-base); 
    padding: var(--space-2); 
    border-radius: var(--radius-sm); 
    cursor: pointer; 
    transition: all 0.2s ease; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    width: 32px;
    height: 32px;
}

.file-action-btn:hover { 
    background: var(--color-bg-canvas); 
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.file-action-btn i { 
    width: 14px; 
    height: 14px; 
    color: var(--color-text-secondary); 
}

.file-action-btn.delete:hover { 
    background: var(--color-accent-danger); 
    border-color: var(--color-accent-danger);
}

.file-action-btn.delete:hover i { 
    color: white; 
}

.upload-progress { 
    margin-top: var(--space-3); 
}

.progress-bar { 
    width: 100%; 
    height: 6px; 
    background: var(--color-bg-muted); 
    border-radius: var(--radius-full); 
    overflow: hidden; 
    margin-bottom: var(--space-2); 
}

.progress-fill { 
    height: 100%; 
    background: var(--color-primary-base); 
    border-radius: var(--radius-full); 
    transition: width 0.3s ease; 
}

.progress-text { 
    font-size: var(--font-size-xs); 
    color: var(--color-text-secondary); 
    text-align: center; 
}

/* Custom Resize Handle */
#recipe-content-group {
    position: relative;
}
.custom-resize-handle {
    position: absolute;
    bottom: 5px;
    right: 5px;
    width: 20px;
    height: 20px;
    cursor: se-resize;
    opacity: 0.4;
    transition: opacity 0.2s ease;
    background-image: url("data:image/svg+xml,%3Csvg width='16' height='16' viewBox='0 0 16 16' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M11 5L5 11' stroke='%23888' stroke-width='1.5' stroke-linecap='round'/%3E%3Cpath d='M13 7L7 13' stroke='%23888' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E%0A");
    background-repeat: no-repeat;
}

/* === FLAVOR PALETTE STYLES === */
.flavor-palette-mini {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    margin-top: var(--space-1);
}

.flavor-pip-mini {
    width: 28px;
    height: 28px;
    border-radius: var(--radius-full);
    border: 2px solid rgba(255, 255, 255, 0.6);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.flavor-pip-mini:hover {
    transform: scale(1.1);
    border-color: rgba(255, 255, 255, 0.8);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15);
}

.flavor-pip-mini.selected {
    border-color: rgba(255, 255, 255, 0.9);
    border-width: 3px;
    transform: scale(1.02);
    position: relative;
}

.flavor-pip-mini.selected::before {
    content: '';
    position: absolute;
    top: -3px;
    left: -3px;
    right: -3px;
    bottom: -3px;
    border-radius: var(--radius-full);
    background: inherit;
    opacity: 0.6;
    z-index: -1;
}

.flavor-pip-mini.selected::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 12px;
    font-weight: bold;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
    z-index: 2;
}

/* Special handling for yellow flavors - no outer ring needed */
.flavor-pip-mini.selected[style*="rgb(255, 255, 0)"],
.flavor-pip-mini.selected[style*="#ffff00"],
.flavor-pip-mini.selected[style*="#FFFF00"],
.flavor-pip-mini.selected[style*="yellow"] {
    border-color: rgba(255, 255, 255, 0.9);
}

.flavor-pip-mini.selected[style*="rgb(255, 255, 0)"]::before,
.flavor-pip-mini.selected[style*="#ffff00"]::before,
.flavor-pip-mini.selected[style*="#FFFF00"]::before,
.flavor-pip-mini.selected[style*="yellow"]::before {
    display: none;
}

.flavor-pip-mini.selected[style*="#FFFF00"]::before,
.flavor-pip-mini.selected[style*="yellow"]::before {
    display: none;
}