:root {
    --primary: #4a6cf7;
    --text: #333;
    --bg-editor: #eef0f5;
    --border: #e0e0e0;
}

.app-container {
    max-width: 100%;
    margin: 0 auto 20px; 
    font-family: 'Segoe UI', Roboto, sans-serif;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.1);
    overflow: hidden;
    position: relative;
    border: 1px solid #eee;
}

/* --- LANDING VIEW --- */
.landing-view {
    display: flex;
    flex-wrap: wrap;
    min-height: 550px;
}

.landing-left {
    flex: 1;
    background: #f0f3ff;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    min-width: 350px;
}

.demo-image-box {
    position: relative;
    width: 100%;
    max-width: 450px;
    height: 450px;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 15px 30px rgba(0,0,0,0.1);
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
}
.demo-img { width: 100%; height: 100%; object-fit: contain; display: block; }

.scan-line {
    position: absolute; top: 0; left: 0; width: 100%; height: 4px;
    background: #4a6cf7;
    box-shadow: 0 0 15px #4a6cf7;
    animation: scanMove 2.5s infinite linear;
    z-index: 2;
}
@keyframes scanMove { 0% { top: 0; } 50% { top: 100%; } 100% { top: 0; } }

.landing-right {
    flex: 1;
    padding: 30px 50px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #fff;
    min-width: 350px;
}

.upload-box {
    border: 2px dashed #aabfe3;
    border-radius: 16px;
    padding: 40px 30px;
    text-align: center;
    width: 100%;
    max-width: 500px;
    transition: 0.3s;
    background: #f9fbff;
    cursor: pointer;
    display: block;
}
.upload-box:hover { border-color: var(--primary); background: #f0f7ff; transform: scale(1.01); }

.btn-upload-style {
    background: linear-gradient(90deg, #4a6cf7, #2a4bc8);
    color: white;
    padding: 15px 50px;
    border-radius: 50px;
    font-size: 18px;
    font-weight: bold;
    box-shadow: 0 5px 15px rgba(74, 108, 247, 0.4);
    margin-top: 25px;
    display: inline-block;
}

.auto-dl-wrapper {
    margin-top: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 14px;
    color: #555;
    background: #fff;
    padding: 8px 15px;
    border-radius: 20px;
    border: 1px solid #eee;
}
.auto-dl-wrapper input { width: 16px; height: 16px; cursor: pointer; accent-color: var(--primary); }

/* --- EDITOR VIEW --- */
.editor-view {
    display: none; 
    height: auto; 
    min-height: 600px;
    width: 100%;
    background: #fff;
}

.editor-canvas-area {
    width: 100%;
    min-height: 600px; 
    background-color: var(--bg-editor); 
    display: flex;
    flex-direction: column; 
    align-items: center;
    justify-content: center;
    padding: 40px;
    position: relative; /* Added for overlay positioning */
}

.result-image-container {
    position: relative;
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 70vh;
    background-image: linear-gradient(45deg, #e0e0e0 25%, transparent 25%), linear-gradient(-45deg, #e0e0e0 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #e0e0e0 75%), linear-gradient(-45deg, transparent 75%, #e0e0e0 75%);
    background-size: 20px 20px;
    background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
    background-color: #fff;
    box-shadow: 0 20px 50px rgba(0,0,0,0.15);
    border-radius: 4px;
    overflow: hidden;
    display: flex; 
}

.result-image { 
    display: block;
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 70vh; 
    position: relative;
    z-index: 2;
    image-rendering: auto; 
    transform: translateZ(0); 
}

.blur-bg-layer {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    object-fit: cover;
    filter: blur(10px);
    z-index: 1;
    display: none;
    transform: scale(1.05); 
}

/* --- SCANNING OVERLAY --- */
.scan-overlay {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: 10;
    background: rgba(0,0,0,0.05);
    pointer-events: none;
}

.scan-beam {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 5px;
    background: #4a6cf7;
    box-shadow: 0 0 20px #4a6cf7, 0 0 10px white;
    animation: scanUpDown 2s infinite ease-in-out;
}

.scan-text {
    position: absolute;
    bottom: 20px; left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.7);
    color: white;
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: bold;
}
@keyframes scanUpDown { 0% { top: 0; } 50% { top: 100%; } 100% { top: 0; } }

/* --- TOOLBAR --- */
.bottom-toolbar {
    position: relative;
    margin-top: 25px;
    background: #fff;
    padding: 12px 20px;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    z-index: 50;
    width: auto;
    min-width: 680px; 
    max-width: 100%;
    flex-wrap: nowrap; 
    white-space: nowrap;
}

.toolbar-group {
    display: flex;
    gap: 10px;
    align-items: center;
}

.toolbar-divider {
    width: 1px;
    height: 30px;
    background: #eee;
}

.color-btn { width: 32px; height: 32px; border-radius: 50%; border: 2px solid #eee; cursor: pointer; transition: 0.2s; }
.color-btn:hover { transform: scale(1.1); border-color: #aaa; }
.color-btn.active { border-color: #333; transform: scale(1.1); box-shadow: 0 0 0 3px rgba(0,0,0,0.1); }
.color-btn.transparent { 
    background: url('data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI4IiBoZWlnaHQ9IjgiPgo8cmVjdCB3aWR0aD0iOCIgaGVpZ2h0PSI4IiBmaWxsPSIjZmZmIi8+CjxwYXRoIGQ9Ik0wIDBMMCA0TDQgNEw0IDBZMCA0TDQgNEw0IDhMMCA4WiIgZmlsbD0iI2NjYyIvPgo8L3N2Zz4=');
    border: 1px solid #ccc;
}

.icon-btn {
    background: none; border: none; font-size: 14px; font-weight: 600; 
    color: #555; cursor: pointer; padding: 8px 15px; border-radius: 8px; 
    transition: 0.2s; display: flex; align-items: center; gap: 6px;
    user-select: none; 
    -webkit-user-select: none;
}
.icon-btn:hover { background: #f0f0f0; color: var(--primary); }
#btn-compare:active { background: #e0e0e0; color: var(--primary); }

.download-pill-btn {
    background: var(--primary); color: white; border: none; 
    padding: 12px 25px; border-radius: 50px; font-weight: bold; 
    cursor: pointer; font-size: 15px; box-shadow: 0 4px 10px rgba(74, 108, 247, 0.3);
    white-space: nowrap;
}
.download-pill-btn:hover { background: #3354d1; transform: translateY(-1px); }

/* --- EDITOR DROP OVERLAY --- */
.editor-drop-overlay {
    display: none; /* Hidden by default */
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.95);
    z-index: 100; /* Above everything else */
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    border: 3px dashed var(--primary);
    backdrop-filter: blur(5px);
}

.editor-drop-overlay.active {
    display: flex;
    animation: fadeIn 0.2s ease-in-out;
}

.drop-content {
    text-align: center;
    color: var(--primary);
    pointer-events: none;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Mobile Responsive */
@media (max-width: 800px) {
    .landing-view { flex-direction: column-reverse; }
    .editor-canvas-area { padding: 20px; min-height: auto; }
    .bottom-toolbar { margin-top: 15px; min-width: 0; width: 100%; flex-wrap: wrap; justify-content: center; gap: 10px; }
    .toolbar-divider { display: none; }
    .toolbar-group { flex-wrap: wrap; justify-content: center; }
}