/* ============================================
   Rattan View - Garden Visualiser
   ============================================ */

:root {
    --rattan-gold: #B0864E;
    --rattan-dark: #213430;
    --rattan-mid: #506771;
    --rattan-light: #f0ebe0;
    --rattan-cream: #f7f3ec;
    --rattan-accent: #8a6a3a;
    --shadow-soft: 0 4px 24px rgba(33,52,48,0.12);
    --shadow-card: 0 2px 12px rgba(33,52,48,0.08);
    --radius: 16px;
    --radius-sm: 10px;
    --transition: all 0.25s ease;
}

.visualiser-page {
    background: var(--rattan-cream);
    min-height: 100vh;
}

/* ---- Hero ---- */

.vis-hero {
    background: linear-gradient(135deg, var(--rattan-dark) 0%, #2d4a44 60%, var(--rattan-mid) 100%);
    color: white;
    text-align: center;
    padding: 70px 20px 55px;
    position: relative;
    overflow: hidden;
}

.vis-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23c4a882' fill-opacity='0.07'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

.vis-hero-inner {
    position: relative;
    max-width: 680px;
    margin: 0 auto;
}

.vis-hero-logo {
    width: 260px;
    max-width: 80%;
    margin-bottom: 24px;
    filter: drop-shadow(0 4px 16px rgba(0,0,0,0.25));
}

.vis-hero-badge {
    display: inline-block;
    background: rgba(176,134,78,0.2);
    border: 1px solid rgba(176,134,78,0.45);
    color: var(--rattan-gold);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    padding: 6px 16px;
    border-radius: 20px;
    margin-bottom: 18px;
}

.vis-hero h1 {
    font-size: 46px;
    font-weight: 800;
    margin: 0 0 14px;
    line-height: 1.15;
    letter-spacing: -1px;
}

.vis-hero h1 span {
    color: var(--rattan-gold);
}

.vis-hero p {
    font-size: 17px;
    color: rgba(255,255,255,0.78);
    margin: 0 0 32px;
    line-height: 1.6;
}

.vis-hero-steps {
    display: flex;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
}

.vis-hero-step {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.14);
    padding: 9px 16px;
    border-radius: 30px;
    font-size: 13px;
    color: rgba(255,255,255,0.88);
}

.vis-hero-step-num {
    width: 22px;
    height: 22px;
    background: var(--rattan-gold);
    color: var(--rattan-dark);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 800;
    flex-shrink: 0;
}

/* ---- Steps Wrapper ---- */

.vis-steps-wrap {
    max-width: 1100px;
    margin: 0 auto;
    padding: 48px 20px 100px;
    display: flex;
    flex-direction: column;
    gap: 32px;
}

/* ---- Individual Step ---- */

.vis-step {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow-card);
    overflow: hidden;
    transition: var(--transition);
}

.vis-step-locked {
    opacity: 0.45;
    pointer-events: none;
    filter: grayscale(0.3);
}

.vis-step-header {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 22px 28px;
    border-bottom: 1px solid #f0ebe3;
    background: var(--rattan-cream);
}

.vis-step-num {
    width: 38px;
    height: 38px;
    background: linear-gradient(135deg, var(--rattan-dark), #2d4a44);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 800;
    flex-shrink: 0;
}

.vis-step-label {
    font-size: 17px;
    font-weight: 800;
    color: var(--rattan-dark);
}

.vis-step-body {
    padding: 28px;
}

/* ---- Upload Zone ---- */

.vis-upload-zone {
    border: 2px dashed #d8ccba;
    border-radius: var(--radius-sm);
    padding: 64px 32px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    background: var(--rattan-cream);
    position: relative;
}

.vis-upload-zone:hover,
.vis-upload-zone.drag-over {
    border-color: var(--rattan-gold);
    background: var(--rattan-light);
}

.vis-upload-zone input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
    width: 100%;
    height: 100%;
}

.vis-upload-icon {
    font-size: 52px;
    display: block;
    margin-bottom: 14px;
    opacity: 0.5;
}

.vis-upload-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--rattan-dark);
    margin-bottom: 8px;
}

.vis-upload-hint {
    font-size: 13px;
    color: #aaa;
}

.vis-upload-hint span {
    color: var(--rattan-gold);
    font-weight: 700;
}

.vis-upload-preview {
    display: none;
    position: relative;
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.vis-upload-preview img {
    width: 100%;
    max-height: 380px;
    object-fit: cover;
    display: block;
    border-radius: var(--radius-sm);
}

.vis-upload-change {
    position: absolute;
    top: 14px;
    right: 14px;
    background: rgba(33,52,48,0.8);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 8px 14px;
    font-size: 12px;
    font-weight: 700;
    font-family: 'Open Sans', sans-serif;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: var(--transition);
}

.vis-upload-change:hover {
    background: var(--rattan-dark);
}

.vis-step-cta {
    margin-top: 20px;
    text-align: center;
}

/* ---- Product Grid ---- */

.vis-products-search-bar {
    position: relative;
    margin-bottom: 20px;
}

.vis-products-search-bar i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: #bbb;
    font-size: 13px;
    pointer-events: none;
}

.vis-products-search-bar input {
    width: 100%;
    padding: 12px 16px 12px 40px;
    border: 1.5px solid #e0d4c0;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: 'Open Sans', sans-serif;
    color: var(--rattan-dark);
    background: var(--rattan-cream);
    outline: none;
    box-sizing: border-box;
    transition: var(--transition);
}

.vis-products-search-bar input:focus {
    border-color: var(--rattan-gold);
    background: white;
}

/* ---- Filter Bar ---- */

.vis-filter-bar {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.vis-filter-btn {
    padding: 7px 16px;
    border-radius: 20px;
    border: 1.5px solid #d8ccba;
    background: white;
    color: var(--rattan-mid);
    font-size: 12px;
    font-weight: 700;
    font-family: 'Open Sans', sans-serif;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.vis-filter-btn:hover {
    border-color: var(--rattan-gold);
    color: var(--rattan-dark);
}

.vis-filter-btn.active {
    background: var(--rattan-dark);
    border-color: var(--rattan-dark);
    color: white;
}

.vis-products-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

.vis-product-card {
    border: 2px solid transparent;
    border-radius: var(--radius-sm);
    overflow: hidden;
    cursor: pointer;
    transition: var(--transition);
    background: var(--rattan-cream);
    display: flex;
    flex-direction: column;
}

.vis-product-card:hover {
    border-color: var(--rattan-gold);
    transform: translateY(-3px);
    box-shadow: var(--shadow-card);
}

.vis-product-card.selected {
    border-color: var(--rattan-dark);
    box-shadow: 0 0 0 1px var(--rattan-dark), var(--shadow-soft);
}

.vis-product-img-wrap {
    position: relative;
    aspect-ratio: 1;
    overflow: hidden;
}

.vis-product-img-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

.vis-product-card:hover .vis-product-img-wrap img {
    transform: scale(1.04);
}

.vis-product-select-tick {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 26px;
    height: 26px;
    background: var(--rattan-dark);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    opacity: 0;
    transition: var(--transition);
}

.vis-product-card.selected .vis-product-select-tick {
    opacity: 1;
}

.vis-product-info {
    padding: 10px 12px 4px;
    flex: 1;
}

.vis-product-name {
    font-size: 12px;
    font-weight: 700;
    color: var(--rattan-dark);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 3px;
}

.vis-product-brand {
    font-size: 10px;
    color: var(--rattan-gold);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.vis-product-actions {
    padding: 8px 12px 12px;
    display: flex;
    gap: 6px;
}

.vis-product-view {
    font-size: 11px;
    color: var(--rattan-mid);
    text-decoration: none;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 4px;
    flex: 1;
}

.vis-product-view:hover {
    color: var(--rattan-dark);
}

.vis-product-choose {
    background: var(--rattan-dark);
    color: white;
    border: none;
    border-radius: 6px;
    padding: 6px 12px;
    font-size: 11px;
    font-weight: 700;
    font-family: 'Open Sans', sans-serif;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.vis-product-choose:hover {
    background: #2a2310;
}

/* ---- Step 3 — Generate ---- */

.vis-selection-summary {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 24px;
    margin-bottom: 28px;
    padding: 24px;
    background: var(--rattan-cream);
    border-radius: var(--radius-sm);
    border: 1px solid #ede3d3;
}

.vis-summary-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.vis-summary-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--rattan-gold);
}

.vis-summary-img {
    width: 140px;
    height: 100px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    border: 2px solid #e0d4c0;
}

.vis-summary-name {
    font-size: 12px;
    font-weight: 700;
    color: var(--rattan-dark);
    text-align: center;
    max-width: 140px;
    line-height: 1.4;
}

.vis-summary-plus {
    font-size: 32px;
    color: var(--rattan-gold);
    font-weight: 300;
}

.vis-generate-wrap {
    text-align: center;
    margin-bottom: 8px;
}

/* ---- Sunny Toggle ---- */

.vis-sunny-toggle {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
}

.vis-toggle-label {
    display: flex;
    align-items: center;
    gap: 14px;
    background: white;
    border: 1.5px solid #d8ccba;
    border-radius: 14px;
    padding: 14px 22px;
    cursor: pointer;
    transition: var(--transition);
    user-select: none;
    box-shadow: var(--shadow-card);
}

.vis-toggle-label:hover {
    border-color: var(--rattan-gold);
    box-shadow: 0 4px 16px rgba(176,134,78,0.2);
}

.vis-toggle-icon {
    font-size: 22px;
    line-height: 1;
}

.vis-toggle-text {
    font-size: 14px;
    font-weight: 700;
    color: var(--rattan-dark);
    letter-spacing: 0.1px;
}

.vis-toggle-sub {
    font-size: 11px;
    color: #aaa;
    font-weight: 400;
    display: block;
    margin-top: 1px;
}

/* The switch track */
.vis-toggle-switch {
    position: relative;
    width: 52px;
    height: 28px;
    flex-shrink: 0;
    margin-left: 4px;
}

.vis-toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.vis-toggle-track {
    position: absolute;
    inset: 0;
    background: #ddd5c8;
    border-radius: 28px;
    transition: background 0.3s ease;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.15);
}

.vis-toggle-thumb {
    position: absolute;
    width: 22px;
    height: 22px;
    top: 3px;
    left: 3px;
    background: white;
    border-radius: 50%;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 1px 6px rgba(0,0,0,0.22), 0 0 0 1px rgba(0,0,0,0.04);
}

.vis-toggle-switch input:checked ~ .vis-toggle-track {
    background: linear-gradient(135deg, #f5b400, #e08c00);
}

.vis-toggle-switch input:checked ~ .vis-toggle-thumb {
    transform: translateX(24px);
}

.vis-toggle-label:has(input:checked) {
    border-color: #f5b400;
    background: #fffbf0;
    box-shadow: 0 4px 16px rgba(245,180,0,0.18);
}

/* ---- Buttons ---- */

.vis-btn {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    padding: 14px 28px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 700;
    font-family: 'Open Sans', sans-serif;
    cursor: pointer;
    border: none;
    transition: var(--transition);
    text-decoration: none;
    white-space: nowrap;
}

.vis-btn-primary {
    background: linear-gradient(135deg, var(--rattan-dark), #2d4a44);
    color: white;
}

.vis-btn-primary:hover {
    background: linear-gradient(135deg, #2a2310, var(--rattan-dark));
    transform: translateY(-2px);
    box-shadow: 0 8px 22px rgba(33,52,48,0.3);
}

.vis-btn-generate {
    background: linear-gradient(135deg, var(--rattan-dark), #2d4a44);
    color: white;
    font-size: 16px;
    padding: 16px 40px;
}

.vis-btn-generate:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 28px rgba(33,52,48,0.35);
}

.vis-btn-secondary {
    background: var(--rattan-light);
    color: var(--rattan-dark);
    border: 1.5px solid #d8ccba;
}

.vis-btn-secondary:hover {
    background: #e8ddd0;
    border-color: var(--rattan-gold);
}

.vis-btn-buy {
    background: linear-gradient(135deg, var(--rattan-gold), var(--rattan-accent));
    color: white;
}

.vis-btn-buy:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(176,134,78,0.45);
}

/* ---- Loading ---- */

.vis-loading {
    display: none;
    flex-direction: column;
    align-items: center;
    padding: 48px 24px;
    gap: 18px;
    text-align: center;
}

.vis-loading.active {
    display: flex;
}

.vis-spinner {
    width: 52px;
    height: 52px;
    border: 4px solid #ede3d3;
    border-top-color: var(--rattan-gold);
    border-radius: 50%;
    animation: spin 0.85s linear infinite;
}

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

.vis-loading-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--rattan-dark);
}

.vis-loading-steps {
    display: flex;
    flex-direction: column;
    gap: 10px;
    text-align: left;
}

.vis-loading-step {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    color: #ccc;
    transition: var(--transition);
}

.vis-loading-step.active { color: var(--rattan-dark); font-weight: 600; }
.vis-loading-step.done   { color: #7ab87e; }

.vis-loading-step-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
    flex-shrink: 0;
}

/* ---- Error ---- */

.vis-error {
    display: none;
    align-items: center;
    gap: 12px;
    background: #fff5f5;
    border: 1px solid #fed7d7;
    border-radius: var(--radius-sm);
    padding: 16px 20px;
    color: #c53030;
    font-size: 13px;
    margin-bottom: 16px;
}

.vis-error.visible { display: flex; }

/* ---- Result ---- */

.vis-result {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.vis-result-img {
    width: 100%;
    border-radius: var(--radius-sm);
    display: block;
}

.vis-result-buy-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    background: var(--rattan-dark);
    color: white;
    padding: 16px 24px;
    border-radius: var(--radius-sm);
    flex-wrap: wrap;
}

.vis-result-buy-info {
    display: flex;
    align-items: center;
    gap: 14px;
    flex: 1;
    min-width: 0;
}

.vis-result-buy-img {
    width: 56px;
    height: 56px;
    object-fit: cover;
    border-radius: 8px;
    border: 2px solid rgba(255,255,255,0.2);
    flex-shrink: 0;
}

.vis-result-buy-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--rattan-gold);
    margin-bottom: 3px;
}

.vis-result-buy-name {
    font-size: 14px;
    font-weight: 700;
    color: white;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.vis-btn-buy-large {
    font-size: 15px;
    padding: 14px 32px;
    flex-shrink: 0;
}

.vis-result-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: center;
}

/* ---- Sticky Buy Bar ---- */

.vis-buy-bar {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    border-top: 2px solid var(--rattan-gold);
    padding: 14px 24px;
    z-index: 200;
    box-shadow: 0 -4px 20px rgba(33,52,48,0.12);
}

.vis-buy-bar.visible { display: flex; }

.vis-buy-bar-inner {
    max-width: 1100px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 16px;
    width: 100%;
}

.vis-buy-bar-img {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: 8px;
    flex-shrink: 0;
    border: 2px solid #e0d4c0;
}

.vis-buy-bar-info { flex: 1; min-width: 0; }

.vis-buy-bar-name {
    font-size: 14px;
    font-weight: 700;
    color: var(--rattan-dark);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.vis-buy-bar-sub { font-size: 11px; color: #aaa; }

.vis-buy-bar-actions { display: flex; gap: 10px; flex-shrink: 0; }

/* ---- Print ---- */

@media print {
    .vis-hero, .vis-steps-wrap > *:not(#stepGenerate),
    .vis-step-header, .vis-selection-summary, .vis-generate-wrap,
    .vis-result-actions, .vis-buy-bar,
    .topNavContainer, .headerBar, .footer, .copyright { display: none !important; }

    .vis-result-img { width: 100%; border-radius: 0; }
    .vis-print-product-name { display: block !important; font-size: 18px; font-weight: bold; text-align: center; padding: 12px; }
}

.vis-print-product-name { display: none; }

/* ---- Responsive ---- */

@media (max-width: 900px) {
    .vis-products-grid { grid-template-columns: repeat(3, 1fr); }
    .vis-hero h1 { font-size: 34px; }
}

@media (max-width: 600px) {
    .vis-products-grid { grid-template-columns: repeat(2, 1fr); }
    .vis-step-body { padding: 20px 16px; }
    .vis-selection-summary { flex-direction: column; }
    .vis-summary-plus { transform: rotate(90deg); }
    .vis-buy-bar-inner { flex-wrap: wrap; }
    .vis-hero h1 { font-size: 28px; }
}
