/* ============================================
   Paint Visualizer v8.1 – Styles
   Prefix: vz-
   Module: visualizers/paint
   ============================================ */

/* --- CSS Variables --- */
:root {
    --vz-primary-dark: #0d2c4f;
    --vz-primary-light: #1a4a7a;
    --vz-accent: #f77f00;
    --vz-accent-hover: #d66e00;
    --vz-text: #212529;
    --vz-text-muted: #6c757d;
    --vz-bg: #ffffff;
    --vz-bg-section: #f4f7f9;
    --vz-border: #e2e8f0;
    --vz-error: #dc3545;
    --vz-success: #198754;
    --vz-radius: 12px;
    --vz-radius-lg: 20px;
    --vz-shadow-sm: 0 2px 5px rgba(0, 0, 0, 0.05);
    --vz-shadow-card: 0 10px 30px rgba(13, 44, 79, 0.1);
    --vz-shadow-lg: 0 8px 25px rgba(0, 0, 0, 0.1);
    --vz-font-body: 'Assistant', sans-serif;
    --vz-font-heading: 'Rubik', sans-serif;
    --vz-transition: 0.3s ease-in-out;
}

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

body {
    font-family: var(--vz-font-body);
    color: var(--vz-text);
    background: var(--vz-bg);
    line-height: 1.6;
    direction: rtl;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

html[dir="ltr"] body {
    direction: ltr;
    text-align: left;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

[hidden] {
    display: none !important;
}

/* --- Container --- */
.vz-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ============================================
   Header
   ============================================ */
.vz-header {
    background: linear-gradient(135deg, var(--vz-primary-dark) 0%, var(--vz-primary-light) 100%);
    padding: 16px 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--vz-shadow-card);
}

.vz-header .vz-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.vz-logo-link {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
}

.vz-logo {
    max-height: 45px;
    width: auto;
}

.vz-logo-text {
    font-family: var(--vz-font-heading);
    font-weight: 700;
    font-size: 1.4rem;
    color: #fff;
    letter-spacing: 0.02em;
}

.vz-logo-text__sbs {
    color: var(--vz-accent);
}

.vz-header-title {
    font-family: var(--vz-font-heading);
    font-size: 1.3rem;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: -0.02em;
}

/* ============================================
   Main
   ============================================ */
.vz-main {
    padding: 40px 0 60px;
    min-height: calc(100vh - 160px);
    background: var(--vz-bg-section);
}

/* --- Intro --- */
.vz-intro {
    text-align: center;
    margin-bottom: 40px;
}

.vz-intro-heading {
    font-family: var(--vz-font-heading);
    font-size: clamp(1.6rem, 4vw, 2.2rem);
    font-weight: 700;
    color: var(--vz-primary-dark);
    margin-bottom: 10px;
}

.vz-intro-text {
    font-size: 1.05rem;
    color: var(--vz-text-muted);
    max-width: 600px;
    margin: 0 auto;
}

/* ============================================
   Two Column Layout
   ============================================ */
.vz-layout {
    display: grid;
    grid-template-columns: 340px 1fr;
    gap: 30px;
    align-items: start;
}

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

.vz-panel--preview {
    position: sticky;
    top: 100px;
}

/* ============================================
   Card
   ============================================ */
.vz-card {
    background: var(--vz-bg);
    border-radius: var(--vz-radius-lg);
    border: 1px solid var(--vz-border);
    padding: 24px;
    box-shadow: var(--vz-shadow-sm);
    transition: box-shadow var(--vz-transition);
}

.vz-card:hover {
    box-shadow: var(--vz-shadow-card);
}

.vz-card-title {
    font-family: var(--vz-font-heading);
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--vz-primary-dark);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.vz-card-title i {
    color: var(--vz-accent);
    font-size: 1.1rem;
}

/* ============================================
   Upload Zone
   ============================================ */
.vz-upload-note {
    font-size: 0.85rem;
    color: var(--vz-text-muted);
    margin-bottom: 12px;
    line-height: 1.5;
}

.vz-upload-zone {
    border: 2px dashed var(--vz-border);
    border-radius: var(--vz-radius);
    padding: 32px 20px;
    text-align: center;
    cursor: pointer;
    transition: border-color var(--vz-transition), background var(--vz-transition);
    position: relative;
    overflow: hidden;
    min-height: 160px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.vz-upload-zone:hover,
.vz-upload-zone:focus-visible {
    border-color: var(--vz-accent);
    background: rgba(247, 127, 0, 0.03);
}

.vz-upload-zone.vz-upload-zone--dragover {
    border-color: var(--vz-accent);
    background: rgba(247, 127, 0, 0.06);
    border-style: solid;
}

.vz-upload-zone.vz-upload-zone--has-image {
    padding: 0;
    border-style: solid;
    border-color: var(--vz-success);
}

.vz-upload-zone__content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.vz-upload-zone__icon {
    font-size: 2.5rem;
    color: var(--vz-accent);
    opacity: 0.7;
}

.vz-upload-zone__text {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--vz-text);
}

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

.vz-upload-zone__preview {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: calc(var(--vz-radius) - 2px);
    display: none;
}

.vz-upload-zone--has-image .vz-upload-zone__content { display: none; }
.vz-upload-zone--has-image .vz-upload-zone__preview { display: block; }

.vz-btn--remove {
    width: 100%;
    margin-top: 8px;
}

.vz-upload-error-msg {
    font-size: 0.8rem;
    color: var(--vz-error);
    text-align: center;
    margin-top: 8px;
    font-weight: 600;
}

/* ============================================
   Brand Tabs
   ============================================ */
.vz-brand-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 14px;
}

.vz-brand-tab {
    flex: 1;
    padding: 8px 12px;
    border: 2px solid var(--vz-border);
    border-radius: 8px;
    background: #f8f9fa;
    font-family: var(--vz-font-body);
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--vz-text-muted);
    cursor: pointer;
    transition: all var(--vz-transition);
    text-align: center;
}

.vz-brand-tab:hover {
    border-color: var(--vz-accent);
    color: var(--vz-accent);
    background: rgba(247, 127, 0, 0.04);
}

.vz-brand-tab.vz-brand-tab--active {
    border-color: var(--vz-primary-dark);
    background: var(--vz-primary-dark);
    color: #ffffff;
}

/* ============================================
   Search Input (replaces hex-only input)
   ============================================ */
.vz-search-group {
    margin-bottom: 16px;
}

.vz-search-label {
    display: block;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--vz-text);
    margin-bottom: 8px;
}

.vz-search-field {
    display: flex;
    align-items: center;
    background: #f8f9fa;
    border: 1px solid var(--vz-border);
    border-radius: 8px;
    overflow: hidden;
    transition: border-color var(--vz-transition), box-shadow var(--vz-transition);
}

.vz-search-field:focus-within {
    background: #ffffff;
    border-color: var(--vz-primary-light);
    box-shadow: 0 0 0 4px rgba(13, 44, 79, 0.1);
}

.vz-search-field__icon {
    padding: 10px 12px 10px 0;
    color: var(--vz-text-muted);
    font-size: 0.85rem;
}

html[dir="ltr"] .vz-search-field__icon {
    padding: 10px 0 10px 12px;
}

.vz-search-field__input {
    flex: 1;
    border: none;
    background: transparent;
    padding: 10px 8px;
    font-size: 0.95rem;
    font-family: monospace;
    color: var(--vz-text);
    outline: none;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    direction: ltr;
    text-align: left;
}

.vz-search-field__input::placeholder {
    color: #b0b8c4;
    text-transform: none;
    letter-spacing: 0;
    font-family: var(--vz-font-body);
    font-size: 0.85rem;
}

.vz-search-field__swatch {
    width: 36px;
    height: 36px;
    border-radius: 6px;
    margin: 4px 8px;
    border: 1px solid var(--vz-border);
    background: #ffffff;
    flex-shrink: 0;
    transition: background var(--vz-transition);
}

.vz-search-hint {
    font-size: 0.8rem;
    color: var(--vz-accent);
    margin-top: 6px;
    font-weight: 600;
}

.vz-search-error {
    font-size: 0.8rem;
    color: var(--vz-error);
    margin-top: 6px;
    font-weight: 600;
}

/* ============================================
   Fan Deck Palette
   ============================================ */
.vz-palette {
    max-height: 480px;
    overflow-y: auto;
    margin-bottom: 16px;
    border: 1px solid var(--vz-border);
    border-radius: var(--vz-radius);
    padding: 4px;
    /* Custom scrollbar */
    scrollbar-width: thin;
    scrollbar-color: var(--vz-accent) transparent;
}

.vz-palette::-webkit-scrollbar {
    width: 6px;
}

.vz-palette::-webkit-scrollbar-track {
    background: transparent;
}

.vz-palette::-webkit-scrollbar-thumb {
    background: var(--vz-accent);
    border-radius: 3px;
}

/* --- Family Section --- */
.vz-family {
    margin-bottom: 8px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--vz-border);
}

.vz-family:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.vz-family__header {
    position: sticky;
    top: 0;
    z-index: 5;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(4px);
    padding: 6px 8px;
    font-family: var(--vz-font-heading);
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--vz-primary-dark);
    border-bottom: 1px solid var(--vz-border);
    margin-bottom: 6px;
}

.vz-family__gradient {
    height: 5px;
    border-radius: 3px;
    margin: 0 4px 6px;
    opacity: 0.7;
}

.vz-family__grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(52px, 1fr));
    gap: 5px;
    padding: 0 4px 4px;
}

/* --- Palette Item (tall swatch) --- */
.vz-palette-item {
    aspect-ratio: 3 / 4;
    border-radius: 6px;
    border: 2px solid transparent;
    cursor: pointer;
    transition: transform var(--vz-transition), border-color var(--vz-transition), box-shadow var(--vz-transition);
    position: relative;
    outline: none;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 3px;
    overflow: hidden;
}

.vz-palette-item:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    z-index: 3;
}

.vz-palette-item:focus-visible {
    border-color: var(--vz-primary-dark);
    box-shadow: 0 0 0 3px rgba(13, 44, 79, 0.25);
}

.vz-palette-item.vz-palette-item--selected {
    border-color: var(--vz-primary-dark);
    transform: scale(1.1);
    box-shadow: 0 0 0 3px rgba(13, 44, 79, 0.3), 0 4px 12px rgba(0, 0, 0, 0.2);
}

.vz-palette-item.vz-palette-item--selected::after {
    content: '\f00c';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    position: absolute;
    top: 4px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.65rem;
    color: #ffffff;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

.vz-palette-item--light.vz-palette-item--selected::after {
    color: var(--vz-primary-dark);
    text-shadow: none;
}

/* Search highlight */
.vz-palette-item.vz-palette-item--highlight {
    border-color: var(--vz-accent);
    animation: vzHighlightPulse 1.2s ease-in-out infinite;
}

@keyframes vzHighlightPulse {
    0%, 100% { box-shadow: 0 0 0 2px rgba(247, 127, 0, 0.3); }
    50%      { box-shadow: 0 0 0 4px rgba(247, 127, 0, 0.6); }
}

/* Code label on swatch */
.vz-palette-item__code {
    font-size: 0.55rem;
    font-weight: 700;
    font-family: monospace;
    color: #ffffff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
    text-align: center;
    line-height: 1;
    pointer-events: none;
    letter-spacing: 0.02em;
}

.vz-palette-item--light .vz-palette-item__code {
    color: rgba(0, 0, 0, 0.6);
    text-shadow: none;
}

/* Name label — visible on hover and when selected */
.vz-palette-item__name {
    font-size: 0;
    opacity: 0;
    position: absolute;
    bottom: 18px;
    left: 0;
    right: 0;
    text-align: center;
    pointer-events: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 0 3px;
    transition: opacity 0.15s ease;
}

.vz-palette-item:hover .vz-palette-item__name,
.vz-palette-item.vz-palette-item--selected .vz-palette-item__name {
    font-size: 0.48rem;
    opacity: 1;
    color: #fff;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.7);
    background: rgba(0, 0, 0, 0.22);
    border-radius: 2px;
    padding: 1px 3px;
}

.vz-palette-item--light:hover .vz-palette-item__name,
.vz-palette-item--light.vz-palette-item--selected .vz-palette-item__name {
    color: rgba(0, 0, 0, 0.7);
    text-shadow: none;
    background: rgba(255, 255, 255, 0.45);
}

/* ============================================
   Selected Color Display
   ============================================ */
.vz-selected-color {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: linear-gradient(135deg, #f8fafc 0%, #edf2ff 100%);
    border-radius: var(--vz-radius);
    border: 1px solid var(--vz-border);
}

.vz-selected-color__swatch {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    border: 2px solid rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
}

.vz-selected-color__info {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
}

.vz-selected-color__brand {
    font-size: 0.7rem;
    color: var(--vz-text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.vz-selected-color__code {
    font-size: 1.05rem;
    font-weight: 700;
    font-family: monospace;
    color: var(--vz-primary-dark);
    letter-spacing: 0.05em;
}

.vz-selected-color__name {
    font-size: 0.82rem;
    color: var(--vz-text);
    font-weight: 600;
}

.vz-selected-color__hex {
    font-size: 0.75rem;
    font-family: monospace;
    color: var(--vz-text-muted);
}

/* ============================================
   Room Type Selector
   ============================================ */
.vz-room-card {
    padding: 18px 24px;
}

.vz-room-select {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--vz-border);
    border-radius: 8px;
    font-family: var(--vz-font-body);
    font-size: 0.95rem;
    color: var(--vz-text);
    background: #f8f9fa;
    cursor: pointer;
    transition: border-color var(--vz-transition), box-shadow var(--vz-transition);
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236c757d' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: left 12px center;
    background-size: 12px;
    direction: rtl;
}

html[dir="ltr"] .vz-room-select {
    background-position: right 12px center;
}

.vz-room-select:focus {
    outline: none;
    border-color: var(--vz-primary-light);
    box-shadow: 0 0 0 4px rgba(13, 44, 79, 0.1);
    background-color: #ffffff;
}

.vz-room-note {
    font-size: 0.78rem;
    color: var(--vz-text-muted);
    margin-top: 8px;
    opacity: 0.8;
}

/* ============================================
   Buttons
   ============================================ */
.vz-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: 50px;
    font-family: var(--vz-font-body);
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    border: none;
    transition: all var(--vz-transition);
    text-decoration: none;
    line-height: 1.4;
}

.vz-btn:focus-visible {
    outline: 3px solid var(--vz-accent);
    outline-offset: 2px;
}

.vz-btn--primary {
    background: linear-gradient(135deg, var(--vz-accent) 0%, #ff9a3c 100%);
    color: #ffffff;
    box-shadow: 0 4px 15px rgba(247, 127, 0, 0.3);
}

.vz-btn--primary:hover:not(:disabled) {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 8px 25px rgba(247, 127, 0, 0.4);
}

.vz-btn--primary:active:not(:disabled) {
    transform: translateY(-1px) scale(1);
}

.vz-btn--primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    filter: grayscale(0.3);
}

.vz-btn--outline {
    background: transparent;
    border: 2px solid var(--vz-border);
    color: var(--vz-text-muted);
}

.vz-btn--outline:hover {
    border-color: var(--vz-error);
    color: var(--vz-error);
    background: rgba(220, 53, 69, 0.04);
}

.vz-btn--apply {
    width: 100%;
    padding: 14px 24px;
    font-size: 1.1rem;
}

.vz-btn--apply:not(:disabled) {
    animation: vzApplyGlow 2.8s ease-in-out infinite;
}

@keyframes vzApplyGlow {
    0%, 100% { box-shadow: 0 4px 15px rgba(247, 127, 0, 0.25); }
    50%       { box-shadow: 0 6px 28px rgba(247, 127, 0, 0.6); }
}

.vz-btn--apply .vz-btn__loader { display: none; }
.vz-btn--apply.vz-btn--loading span:first-of-type { display: none; }
.vz-btn--apply.vz-btn--loading .vz-btn__loader { display: inline-flex; }

/* ============================================
   Preview Card
   ============================================ */
.vz-preview-card {
    min-height: 520px;
    display: flex;
    flex-direction: column;
    position: relative;
}

.vz-preview-empty {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 60px 20px;
    text-align: center;
}

.vz-preview-empty__icon {
    font-size: 3rem;
    color: var(--vz-border);
}

.vz-preview-empty__text {
    font-size: 0.95rem;
    color: var(--vz-text-muted);
    max-width: 280px;
}

/* ============================================
   Image Preview (Mode A — no boundary)
   ============================================ */
.vz-image-preview {
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex: 1;
}

.vz-image-preview img {
    max-height: 500px;
    width: 100%;
    object-fit: contain;
    border-radius: var(--vz-radius);
    background: #f0f0f0;
}

.vz-image-preview__hint {
    font-size: 0.85rem;
    color: var(--vz-accent);
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-weight: 600;
}

/* ============================================
   Before/After Comparison Slider
   ============================================ */
.vz-compare-slider {
    position: relative;
    border-radius: var(--vz-radius);
    overflow: hidden;
    cursor: col-resize;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    background: #f0f0f0;
}

.vz-compare-slider__before {
    display: block;
    width: 100%;
    height: auto;
}

.vz-compare-slider__after-wrap {
    position: absolute;
    inset: 0;
    clip-path: inset(0 50% 0 0);
    transition: clip-path 0.05s linear;
}

.vz-compare-slider__after {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.vz-compare-slider__handle {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    width: 4px;
    transform: translateX(-50%);
    z-index: 10;
    cursor: col-resize;
    display: flex;
    align-items: center;
    justify-content: center;
}

.vz-compare-slider__line {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--vz-accent);
    box-shadow: 0 0 10px rgba(247, 127, 0, 0.7), 0 0 3px rgba(247, 127, 0, 0.4);
    border-radius: 2px;
}

.vz-compare-slider__grip {
    position: relative;
    z-index: 11;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--vz-accent) 0%, var(--vz-accent-hover) 100%);
    box-shadow: 0 2px 12px rgba(247, 127, 0, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-size: 0.85rem;
    transition: transform var(--vz-transition), box-shadow var(--vz-transition);
}

.vz-compare-slider__handle--active .vz-compare-slider__grip {
    transform: scale(1.18);
    box-shadow: 0 4px 22px rgba(247, 127, 0, 0.75);
}

.vz-compare-slider__label {
    position: absolute;
    top: 10px;
    background: rgba(0, 0, 0, 0.6);
    color: #ffffff;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 20px;
    z-index: 5;
    pointer-events: none;
}

.vz-compare-slider__label--before {
    right: 10px;
}

.vz-compare-slider__label--after {
    left: 10px;
    background: var(--vz-accent);
}

html[dir="ltr"] .vz-compare-slider__label--before { left: 10px; right: auto; }
html[dir="ltr"] .vz-compare-slider__label--after { right: 10px; left: auto; }

/* ============================================
   Refine Hint
   ============================================ */
.vz-refine-hint {
    font-size: 0.82rem;
    color: var(--vz-text-muted);
    text-align: center;
    margin-top: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.vz-refine-hint i {
    color: var(--vz-accent);
}

/* ============================================
   Result Stage
   ============================================ */
.vz-result-stage {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.vz-result-wrap {
    border-radius: var(--vz-radius);
    overflow: hidden;
    background: #f0f0f0;
    flex: 1;
}

.vz-result-img {
    width: 100%;
    height: auto;
    display: block;
}

.vz-result-actions {
    display: flex;
    gap: 10px;
}

.vz-result-actions .vz-btn {
    flex: 1;
}

.vz-btn--download {
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.vz-result-stage:not([hidden]) {
    animation: vzRevealResult 0.45s ease-out;
}

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

/* Mode B: Generated Image */
.vz-result-generated {
    position: relative;
    border-radius: var(--vz-radius);
    overflow: hidden;
    background: #f8f9fa;
    flex: 1;
}

.vz-result-generated img {
    width: 100%;
    height: auto;
    border-radius: var(--vz-radius);
}

.vz-result__label {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.6);
    color: #ffffff;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 20px;
    z-index: 2;
}

html[dir="ltr"] .vz-result__label { right: auto; left: 10px; }

/* Back Button */
.vz-btn--back {
    width: 100%;
    margin-top: 12px;
    border-radius: 8px;
}

.vz-btn--back:hover {
    border-color: var(--vz-accent);
    color: var(--vz-accent);
    background: rgba(247, 127, 0, 0.04);
}

html[dir="rtl"] .vz-btn--back i { transform: none; }
html[dir="ltr"] .vz-btn--back i { transform: scaleX(-1); }

/* ============================================
   Loading Overlay – Paint Roller Animation
   ============================================ */
.vz-preview-loading {
    position: absolute;
    inset: 0;
    background: rgba(13, 44, 79, 0.82);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
    border-radius: var(--vz-radius-lg);
    z-index: 10;
}

.vz-loading-roller {
    --vz-roller-color: var(--vz-accent);
    position: relative;
    width: 160px;
    height: 80px;
}

.vz-loading-roller__handle {
    position: absolute;
    width: 6px;
    height: 40px;
    background: #8B7355;
    border-radius: 3px;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%) rotate(-25deg);
    transform-origin: bottom center;
}

.vz-loading-roller__cylinder {
    position: absolute;
    width: 50px;
    height: 22px;
    background: linear-gradient(180deg, #888 0%, #aaa 40%, #999 100%);
    border-radius: 11px;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    animation: vzRollerMove 2.5s ease-in-out infinite;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

.vz-loading-roller__trail {
    position: absolute;
    bottom: 0;
    left: 10%;
    right: 10%;
    height: 8px;
    background: linear-gradient(90deg, var(--vz-roller-color) 0%, var(--vz-roller-color) 100%);
    border-radius: 4px;
    opacity: 0.7;
    animation: vzTrailGrow 2.5s ease-in-out infinite;
}

.vz-loading-roller__drip {
    position: absolute;
    width: 4px;
    background: var(--vz-roller-color);
    border-radius: 0 0 4px 4px;
    opacity: 0;
    animation: vzDrip 2.5s ease-in infinite;
}

.vz-loading-roller__drip:nth-child(4) {
    left: 30%;
    top: 30px;
    height: 0;
    animation-delay: 0.8s;
}

.vz-loading-roller__drip:nth-child(5) {
    left: 65%;
    top: 30px;
    height: 0;
    animation-delay: 1.6s;
}

@keyframes vzRollerMove {
    0%, 100% { transform: translateX(-80%); }
    50%      { transform: translateX(-20%); }
}

@keyframes vzTrailGrow {
    0%   { left: 35%; right: 55%; opacity: 0.3; }
    25%  { left: 15%; right: 40%; opacity: 0.6; }
    50%  { left: 10%; right: 10%; opacity: 0.7; }
    75%  { left: 10%; right: 10%; opacity: 0.5; }
    100% { left: 35%; right: 55%; opacity: 0.3; }
}

@keyframes vzDrip {
    0%, 30%  { height: 0; opacity: 0; }
    50%      { height: 12px; opacity: 0.6; }
    80%      { height: 20px; opacity: 0.3; }
    100%     { height: 24px; opacity: 0; }
}

.vz-preview-loading__text {
    font-size: 1rem;
    font-weight: 700;
    color: #ffffff;
    text-align: center;
    transition: opacity 0.3s ease;
    min-height: 1.5em;
}

.vz-preview-loading__sub {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.65);
    opacity: 1;
    text-align: center;
}

/* ============================================
   Preview Error State
   ============================================ */
.vz-preview-error {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 40px 20px;
    text-align: center;
}

.vz-preview-error__icon {
    font-size: 2.5rem;
    color: var(--vz-error);
    opacity: 0.7;
}

.vz-preview-error__text {
    font-size: 0.95rem;
    color: var(--vz-text);
    max-width: 320px;
    line-height: 1.6;
}

.vz-btn--retry {
    border-radius: 8px;
    margin-top: 8px;
}

.vz-btn--retry:hover {
    border-color: var(--vz-accent);
    color: var(--vz-accent);
    background: rgba(247, 127, 0, 0.04);
}

/* ============================================
   Footer
   ============================================ */
.vz-footer {
    background: var(--vz-primary-dark);
    padding: 20px 0;
    text-align: center;
}

.vz-footer-text {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.6);
}

/* ============================================
   Responsive
   ============================================ */

/* Tablet */
@media (max-width: 992px) {
    .vz-layout {
        grid-template-columns: 1fr;
    }

    .vz-panel--preview {
        position: static;
    }

    .vz-preview-card {
        min-height: 300px;
    }
}

/* Mobile */
@media (max-width: 768px) {
    .vz-header .vz-container {
        flex-direction: column;
        gap: 8px;
        text-align: center;
    }

    .vz-header-title {
        font-size: 1.1rem;
    }

    .vz-main {
        padding: 24px 0 40px;
    }

    .vz-intro {
        margin-bottom: 24px;
    }

    .vz-intro-heading {
        font-size: 1.4rem;
    }

    .vz-card {
        padding: 18px;
    }

    .vz-family__grid {
        grid-template-columns: repeat(auto-fill, minmax(46px, 1fr));
    }

    .vz-palette {
        max-height: 340px;
    }

    .vz-compare-slider__grip {
        width: 36px;
        height: 36px;
        font-size: 0.75rem;
    }
}

/* Small Mobile */
@media (max-width: 400px) {
    .vz-family__grid {
        grid-template-columns: repeat(auto-fill, minmax(40px, 1fr));
    }

    .vz-palette-item__code {
        font-size: 0.5rem;
    }
}

/* ============================================
   Accessibility
   ============================================ */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ─── Access Code Modal ─────────────────────────────── */
.vz-code-modal {
    position: fixed;
    inset: 0;
    z-index: 9000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.vz-code-modal[hidden] { display: none; }

.vz-code-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
}

.vz-code-modal__box {
    position: relative;
    background: #fff;
    border-radius: 14px;
    padding: 36px 32px;
    width: 340px;
    max-width: calc(100vw - 32px);
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.22);
    text-align: center;
}

.vz-code-modal__title {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--vz-primary-dark);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.vz-code-modal__desc {
    color: var(--vz-text-muted);
    font-size: 0.9rem;
    margin-bottom: 24px;
}

.vz-code-modal__input {
    width: 100%;
    text-align: center;
    font-size: 2.2rem;
    letter-spacing: 0.5em;
    font-weight: 700;
    font-family: 'Courier New', monospace;
    border: 2px solid var(--vz-border);
    border-radius: 8px;
    padding: 14px 12px;
    outline: none;
    transition: border-color 0.2s;
    box-sizing: border-box;
    color: var(--vz-primary-dark);
}

.vz-code-modal__input:focus {
    border-color: var(--vz-primary-dark);
}

.vz-code-modal__error {
    color: #dc2626;
    font-size: 0.85rem;
    margin-top: 10px;
    min-height: 1.2em;
}

.vz-code-modal__error[hidden] { display: none; }

.vz-code-modal__actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
    justify-content: center;
}
