#app {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ─── HEADER ─────────────────────────────────────── */
.header {
    background: linear-gradient(219deg, #FB0E76 0%, #910694 100%);
    padding: 10px 24px !important;
/*     position: sticky; */
    top: 24px;
    z-index: 100;
    box-shadow: 0 2px 20px rgba(145, 6, 148, 0.35);
    grid-column: 1 / -1;
    border-radius: 16px;
}

.header-inner {
    width: 100%;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 20px;
    height: 64px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    flex-shrink: 0;
}

.logo-icon {
    width: 38px;
    height: 38px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.logo-text {
    font-size: 18px;
    font-weight: 800;
    color: #ffffff;
    letter-spacing: -0.4px;
}

.header-tagline {
    flex: 1;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.8);
    font-weight: 400;
}

.header-badge {
    background: rgba(255, 255, 255, 0.2);
    color: #ffffff;
    font-size: 11px;
    font-weight: 700;
    padding: 4px 10px !important;
    border-radius: 20px !important;
    border: 1px solid rgba(255, 255, 255, 0.35) !important;
    letter-spacing: 0.3px;
    text-transform: uppercase;
    flex-shrink: 0;
}

/* ─── MAIN CONTENT ───────────────────────────────── */
.main-content {
    flex: 1;
    max-width: 1280px;
    width: 100%;
    margin: 0 auto;
    padding: 32px 24px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    align-items: start;
}

/* ─── PANEL CARDS ────────────────────────────────── */
.panel-card {
    background: #ffffff !important;
    border-radius: 16px !important;
    padding: 24px !important;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06), 0 4px 16px rgba(0, 0, 0, 0.05);
    margin-bottom: 20px;
    border: 1px solid rgba(0, 0, 0, 0.05);
    transition: box-shadow 0.2s ease;
}

.panel-card:last-child {
    margin-bottom: 0;
}

.panel-card:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08), 0 8px 24px rgba(0, 0, 0, 0.07);
}

.card-title {
    font-size: 13px;
    font-weight: 700;
    color: #6b6b7b;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-bottom: 18px;
    display: flex;
    align-items: center;
    gap: 7px;
}

.card-title svg {
    color: #FB0E76;
    flex-shrink: 0;
}

/* ─── UPLOAD ZONE ────────────────────────────────── */
.upload-zone {
    border: 2px dashed #e0e0e8 !important;
    border-radius: 12px !important;
    padding: 60px 20px !important;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    background: #fafafa;
    position: relative;
}

.upload-zone:hover,
.upload-zone.dragover {
    border-color: #FB0E76 !important;
    background: #fff5f9 !important;
}

.upload-icon {
    color: #c0c0cc;
    margin-bottom: 14px;
    transition: color 0.2s;
}

.upload-zone:hover .upload-icon {
    color: #FB0E76;
}

.upload-title {
    font-size: 15px;
    font-weight: 600;
    color: #333344;
    margin-bottom: 6px;
}

.upload-sub {
    font-size: 12px;
    color: #9999aa;
    margin-bottom: 18px;
}

.upload-btn-wrap {
    display: flex;
    justify-content: center;
}

.upload-btn {
    background: linear-gradient(219deg, #FB0E76 0%, #910694 100%);
    color: #ffffff;
    font-size: 13px;
    font-weight: 600;
    padding: 9px 22px !important;
    border-radius: 8px !important;
    cursor: pointer;
    transition: opacity 0.2s, transform 0.15s;
    display: inline-block;
    user-select: none;
}

.upload-btn:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

/* ─── PREVIEW GRID ───────────────────────────────── */
.preview-grid {
    margin-top: 18px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 12px;
}

.preview-item {
    position: relative;
    border-radius: 10px !important;
    overflow: hidden;
    border: 2px solid transparent !important;
    cursor: pointer;
    transition: border-color 0.2s, transform 0.15s;
    background: #f0f0f5;
    aspect-ratio: 1;
}

.preview-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

.preview-item.selected {
    border-color: #FB0E76;
}

.preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.preview-item .ratio-badge {
    position: absolute;
    bottom: 6px;
    left: 6px;
    background: rgba(0, 0, 0, 0.65);
    color: #fff;
    font-size: 10px;
    font-weight: 600;
    padding: 2px 7px !important;
    border-radius: 5px;
    backdrop-filter: blur(4px);
}

.preview-item .delete-btn {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 22px;
    height: 22px;
    background: rgba(251, 14, 118, 0.9);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s;
    color: white;
    font-size: 13px;
    line-height: 1;
    font-weight: 700;
}

.preview-item:hover .delete-btn {
    opacity: 1;
}

.preview-item.selected::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(251, 14, 118, 0.08);
    pointer-events: none;
}

/* ─── TOGGLE ─────────────────────────────────────── */
.toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.toggle-label {
    font-size: 15px;
    font-weight: 600;
    color: #1a1a2e;
    margin-bottom: 3px;
}

.toggle-desc {
    font-size: 12px;
    color: #9999aa;
}

.toggle-switch {
    width: 50px;
    height: 28px;
    border-radius: 14px !important;
    background: #e0e0ea;
    position: relative;
    cursor: pointer;
    transition: background 0.25s;
    flex-shrink: 0;
}

.toggle-switch.on {
    background: linear-gradient(219deg, #FB0E76 0%, #910694 100%);
}

.toggle-knob {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #ffffff !important;
    transition: transform 0.25s;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}

.toggle-switch.on .toggle-knob {
    transform: translateX(22px);
}

/* ─── PRESETS GRID ───────────────────────────────── */
.presets-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.preset-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 14px 10px !important;
    border-radius: 12px !important;
    border: 2px solid #e8e8f0 !important;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s, transform 0.15s;
    font-size: 13px;
    font-weight: 600;
    color: #555566 !important;
    background: #fafafa !important;
    user-select: none;
}

.preset-btn:hover {
    border-color: #FB0E76;
    background: #fff5f9;
    color: #FB0E76;
    transform: translateY(-1px);
}

.preset-btn.active {
    border-color: #FB0E76 !important;
    background: linear-gradient(219deg, rgba(251, 14, 118, 0.08) 0%, rgba(145, 6, 148, 0.08) 100%) !important;
    color: #FB0E76;
}

.preset-icon {
    background: linear-gradient(219deg, #FB0E76 0%, #910694 100%);
    border-radius: 3px;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.preset-btn.active .preset-icon,
.preset-btn:hover .preset-icon {
    opacity: 1;
}

.preset-icon.square {
    width: 22px;
    height: 22px;
}

.preset-icon.landscape {
    width: 28px;
    height: 16px;
}

.preset-icon.portrait {
    width: 16px;
    height: 28px;
}

.preset-icon.portrait-sm {
    width: 18px;
    height: 22px;
}

.preset-icon.landscape-sm {
    width: 24px;
    height: 18px;
}

.preset-icon.landscape-xs {
    width: 26px;
    height: 17px;
}

/* ─── SLIDERS ────────────────────────────────────── */
.slider-group {
    margin-bottom: 22px;
}

.slider-group:last-child {
    margin-bottom: 0;
}

.slider-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.slider-label {
    font-size: 14px;
    font-weight: 600;
    color: #333344;
}

.slider-value {
    font-size: 13px;
    font-weight: 700;
    color: #FB0E76;
    background: rgba(251, 14, 118, 0.08);
    padding: 3px 10px !important;
    border-radius: 6px !important;
}

.slider-track-wrap {
    position: relative;
    padding: 4px 0;
}

.slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 6px;
    border-radius: 3px !important;
    background: #e8e8f0 !important;
    outline: none;
    cursor: pointer;
	padding:0px !important;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: linear-gradient(219deg, #FB0E76 0%, #910694 100%);
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(251, 14, 118, 0.4);
    transition: transform 0.15s;
}

.slider::-webkit-slider-thumb:hover {
    transform: scale(1.15);
}

.slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: linear-gradient(219deg, #FB0E76 0%, #910694 100%);
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 8px rgba(251, 14, 118, 0.4);
}

.slider-limits {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: #aaaabc;
    margin-top: 6px;
}

/* ─── COLOUR SECTION ─────────────────────────────── */
.color-section {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.fit-mode-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding-bottom: 14px;
    border-bottom: 1px solid #ededf2;
}

.fit-mode-label {
    font-size: 14px;
    font-weight: 600;
    color: #1a1a2e;
    margin-bottom: 3px;
}

.fit-mode-desc {
    font-size: 12px;
    color: #9999aa;
}

.color-swatches {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.swatch {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
    position: relative;
}

.swatch:hover {
    transform: scale(1.15);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.18);
}

.swatch.active::after {
    content: '';
    position: absolute;
    inset: -3px;
    border-radius: 11px;
    border: 2.5px solid #FB0E76;
}

.picker-swatch {
    background: conic-gradient(#ff0000, #ffff00, #00ff00, #00ffff, #0000ff, #ff00ff, #ff0000);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    overflow: hidden;
}

.picker-swatch svg {
    position: relative;
    z-index: 1;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.4));
    pointer-events: none;
}

.color-input-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.color-preview-box {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    border: 2px solid #e8e8f0;
    flex-shrink: 0;
    transition: background 0.2s;
}

.color-hex-input {
    flex: 1;
    border: 2px solid #e8e8f0;
    border-radius: 8px;
    padding: 9px 12px;
    font-size: 14px;
    font-family: 'Inter', monospace;
    font-weight: 500;
    color: #333344;
    outline: none;
    transition: border-color 0.2s;
}

.color-hex-input:focus {
    border-color: #FB0E76;
}

/* ─── PREVIEW SECTION (full width below) ────────── */
.preview-section {
    max-width: 1280px;
    width: 100%;
    margin: 0 auto;
    padding: 0 24px 32px;
}

.preview-section-inner {
    background: #ffffff;
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06), 0 4px 16px rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.preview-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
    gap: 16px;
    flex-wrap: wrap;
}

.preview-section-title {
    font-size: 14px;
    font-weight: 700;
    color: #6b6b7b;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.preview-section-title svg {
    color: #FB0E76;
}

.big-preview-wrap {
    background: #f5f5f8;
    border-radius: 12px;
    min-height: 360px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border: 1px solid #e8e8f0;
    padding: 24px;
}

.canvas-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    color: #c0c0cc;
    font-size: 14px;
    padding: 24px;
    text-align: center;
}

#outputCanvas {
    max-width: 100%;
    max-height: 520px;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.12);
}

.generate-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 13px 26px !important;
    background: linear-gradient(219deg, #FB0E76 0%, #910694 100%) !important;
    color: #ffffff;
    font-size: 15px;
    font-weight: 700;
    border-radius: 10px;
    cursor: pointer;
    transition: opacity 0.2s, transform 0.15s, box-shadow 0.2s;
    user-select: none;
    letter-spacing: 0.2px;
    box-shadow: 0 4px 18px rgba(251, 14, 118, 0.35);
}

.generate-btn:hover {
    opacity: 0.92;
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(251, 14, 118, 0.4);
}

.generate-btn:active {
    transform: translateY(0);
}

.generate-btn.loading {
    opacity: 0.7;
    pointer-events: none;
}

/* ─── FOOTER ─────────────────────────────────────── */
.footer {
    background: #ffffff;
    border-top: 1px solid #ededf2;
    padding: 16px 24px;
    margin-top: auto;
}

.footer-inner {
    max-width: 1280px;
    margin: 0 auto;
    text-align: center;
    font-size: 12px;
    color: #aaaabc;
}

/* ─── RESPONSIVE ─────────────────────────────────── */
@media (max-width: 900px) {
    .main-content {
        grid-template-columns: 1fr;
        padding: 20px 16px;
        gap: 0;
    }

    .preview-section {
        padding: 0 16px 20px;
    }

    .preview-section-header {
        flex-direction: column;
        align-items: stretch;
    }

    .generate-btn {
        width: 100%;
    }

    .header-tagline {
        display: none;
    }

    .header {
        margin-bottom: 20px;
        top: 20px;
    }
}

@media (max-width: 768px) {
	    .presets-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }
		.main-content {
			padding:0px !important;
	}
    .preset-btn {
        padding: 10px 6px;
        font-size: 12px;
    }

    .header-inner {
        gap: 12px;
    }

    .logo-text {
        font-size: 16px;
    }

    .panel-card {
        padding: 18px;
    }
}

/* ─── SLIDER FILL (JS-driven) ────────────────────── */
.slider {
    --pct: 37%;
    background: linear-gradient(to right,
            rgba(251, 14, 118, 0.5) 0%,
            rgba(251, 14, 118, 0.5) var(--pct),
            #e8e8f0 var(--pct),
            #e8e8f0 100%);
}