:root {
    --primary: #2563eb;
    --secondary: #1e40af;
    --success: #16a34a;
    --bg: #f1f5f9;
    --text: #334155;
    --white: #ffffff;
    --border: #cbd5e1;
}

body { font-family: 'Segoe UI', sans-serif; background: var(--bg); color: var(--text); margin: 0; }

/* Navbar */
.navbar { background: var(--white); padding: 1rem 2rem; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; box-shadow: 0 2px 4px rgba(0,0,0,0.05); }
.logo { font-weight: 700; font-size: 1.4rem; color: var(--primary); }
.nav-links button { background: none; border: none; padding: 0.6rem 1.2rem; cursor: pointer; font-size: 1rem; color: #64748b; font-weight: 500; transition: 0.2s; }
.nav-links button.active { color: var(--primary); border-bottom: 2px solid var(--primary); }

/* Privacy Banner */
.privacy-banner { background: linear-gradient(135deg, #16a34a 0%, #15803d 100%); color: white; padding: 1.5rem 2rem; box-shadow: 0 2px 8px rgba(0,0,0,0.1); }
.privacy-content { max-width: 1200px; margin: 0 auto; }
.privacy-content h3 { margin: 0 0 0.8rem 0; font-size: 1.3rem; display: flex; align-items: center; gap: 10px; }
.privacy-features { display: flex; gap: 2rem; flex-wrap: wrap; font-size: 0.95rem; }
.privacy-features span { display: flex; align-items: center; gap: 6px; }
.privacy-features i { color: #86efac; }

/* Use Cases */
.use-cases { background: white; padding: 2rem; max-width: 1200px; margin: 1.5rem auto; border-radius: 12px; box-shadow: 0 4px 6px rgba(0,0,0,0.05); }
.use-case-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 1.5rem; }
.use-case { text-align: center; padding: 1rem; }
.use-case i { font-size: 2.5rem; color: var(--primary); margin-bottom: 0.5rem; }
.use-case h4 { margin: 0.5rem 0; font-size: 1.1rem; color: var(--text); }
.use-case p { font-size: 0.9rem; color: #64748b; margin: 0; }

/* Layout */
.container { max-width: 1200px; margin: 2rem auto; padding: 0 1rem; }
.tool-section { display: none; animation: fadeIn 0.3s ease; }
.tool-section.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

.workspace { display: grid; grid-template-columns: 320px 1fr; gap: 2rem; background: var(--white); padding: 2rem; border-radius: 12px; box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1); }

/* Controls */
.input-panel { border-right: 1px solid var(--border); padding-right: 1.5rem; }
.upload-label { display: block; background: #e2e8f0; padding: 1rem; text-align: center; border-radius: 8px; cursor: pointer; border: 2px dashed #94a3b8; transition: 0.2s; }
.upload-label:hover { background: #cbd5e1; border-color: var(--primary); }
.upload-label.small { padding: 0.7rem; font-size: 0.9rem; margin-bottom: 0.8rem; }
input[type="file"] { display: none; }

.form-row { display: flex; gap: 10px; }
.form-group { margin-bottom: 1rem; width: 100%; }
.form-group label { display: block; font-size: 0.85rem; margin-bottom: 5px; font-weight: 600; color: #475569; }
.form-group input, .form-group select { width: 100%; padding: 8px; border: 1px solid var(--border); border-radius: 6px; box-sizing: border-box; }

.btn-group { display: flex; gap: 8px; margin-bottom: 1rem; flex-wrap: wrap; }
button { padding: 8px 12px; border-radius: 6px; border: 1px solid var(--border); background: var(--white); cursor: pointer; transition: 0.2s; font-size: 0.9rem; }
button:hover { background: #f8fafc; border-color: #94a3b8; }

.action-btn { background: var(--primary); color: white; border: none; width: 100%; font-weight: bold; padding: 12px; font-size: 1rem; margin-top: 10px; }
.action-btn:hover { background: var(--secondary); border: none; }
.download-btn { background: var(--success); color: white; border: none; padding: 10px 20px; font-weight: 600; }
.secondary-btn { background: #475569; color: white; border: none; padding: 10px 20px; }

/* Preview & Overlay */
.preview-panel { display: flex; flex-direction: column; align-items: center; }
.canvas-wrapper { position: relative; max-width: 100%; border: 1px solid var(--border); background: #e2e8f0; line-height: 0; }
img#imagePreview { max-width: 100%; max-height: 500px; display: block; }

/* Face Guide Overlay */
.overlay-grid { position: absolute; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; z-index: 10; display: grid; grid-template-columns: 1fr 1fr 1fr; grid-template-rows: 1fr 1fr 1fr; }
.overlay-grid .grid-line { background: rgba(255, 255, 255, 0.5); position: absolute; }
.overlay-grid .horizontal { width: 100%; height: 1px; left: 0; }
.overlay-grid .vertical { height: 100%; width: 1px; top: 0; }
.overlay-grid .horizontal:nth-child(1) { top: 33.33%; }
.overlay-grid .horizontal:nth-child(2) { top: 66.66%; }
.overlay-grid .vertical:nth-child(3) { left: 33.33%; }
.overlay-grid .vertical:nth-child(4) { left: 66.66%; }
.face-oval { position: absolute; top: 15%; left: 25%; width: 50%; height: 50%; border: 2px solid rgba(255, 215, 0, 0.8); border-radius: 50%; box-shadow: 0 0 0 1000px rgba(0,0,0,0.3); }

/* Validation List */
.validation-list { width: 100%; background: #f0fdf4; border: 1px solid #bbf7d0; padding: 10px; border-radius: 6px; margin: 10px 0; }
.v-item { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid #dcfce7; font-size: 0.9rem; align-items: center; }
.v-item:last-child { border-bottom: none; }
.v-item.success { color: #15803d; }
.v-item.error { color: #b91c1c; }
.v-item strong { font-weight: 600; color: #16a34a; }

/* Comparison Slider */
.compare-container { position: relative; width: 300px; height: 300px; overflow: hidden; border: 2px solid var(--primary); margin: 0 auto; cursor: col-resize; }
.comp-img { position: absolute; top: 0; left: 0; width: 100%; height: 100%; object-fit: contain; }
.resize-drag { position: absolute; top: 0; left: 0; width: 50%; height: 100%; overflow: hidden; border-right: 2px solid var(--white); background: white; z-index: 2; }
.handle { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 30px; height: 30px; background: rgba(255,255,255,0.8); border-radius: 50%; z-index: 3; pointer-events: none; border: 2px solid var(--primary); display: flex; align-items: center; justify-content: center; }
.handle::after { content: '↔'; color: var(--primary); font-weight: bold; }

/* Merger */
.merger-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; margin-top: 2rem; }
.slot { background: var(--white); padding: 1rem; border-radius: 8px; text-align: center; border: 1px solid var(--border); }
.slot canvas { max-width: 100%; box-shadow: 0 2px 5px rgba(0,0,0,0.1); margin-bottom: 1rem; }
.transform-controls { background: #f8fafc; padding: 0.8rem; border-radius: 6px; margin-top: 0.8rem; text-align: left; }
.transform-controls h4 { margin: 0 0 0.6rem 0; font-size: 0.95rem; color: var(--primary); text-align: center; }
.transform-controls label.control-label { display: flex; justify-content: space-between; font-size: 0.85rem; font-weight: 600; color: #475569; margin-bottom: 4px; }
.transform-controls input[type="range"] { width: 100%; margin-bottom: 0.6rem; }
.preview-transform-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; max-width: 600px; margin: 1rem auto; }
.center { text-align: center; margin-top: 20px; }
.result-img { max-width: 100%; border: 2px solid var(--primary); border-radius: 8px; box-shadow: 0 4px 10px rgba(0,0,0,0.15); margin: 10px 0; }
.slider-control { width: 300px; margin: 20px auto; text-align: center; }
.range-labels { display: flex; justify-content: space-between; font-size: 0.8rem; color: #64748b; margin-top: 5px; }

/* PDF Resizer */
.tool-description { text-align: center; color: #64748b; font-size: 0.95rem; margin: -0.5rem 0 1.5rem 0; }
.pdf-previews { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 1rem; margin-top: 1rem; }
.pdf-page-preview { border: 2px solid var(--border); border-radius: 8px; padding: 0.5rem; text-align: center; background: white; }
.pdf-page-preview canvas { width: 100%; border-radius: 4px; box-shadow: 0 2px 4px rgba(0,0,0,0.1); }
.pdf-page-preview .page-label { font-size: 0.85rem; color: #64748b; margin-top: 0.5rem; font-weight: 600; }
.pdf-pages-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 1rem; }


/* Interactive Canvas */
.interactive-canvas { cursor: grab; border: 2px solid var(--border); border-radius: 8px; background: #f8fafc; }
.interactive-canvas:active { cursor: grabbing; }
.interactive-canvas.has-image { background: white; }

/* Format Converter */
.format-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.8rem; margin: 1rem 0; }
.format-btn { display: flex; align-items: center; justify-content: center; gap: 0.5rem; padding: 1rem; background: #f8fafc; border: 2px solid var(--border); border-radius: 8px; cursor: pointer; font-weight: 600; transition: 0.2s; }
.format-btn:hover { background: var(--primary); color: white; border-color: var(--primary); }
.format-btn:disabled { opacity: 0.4; cursor: not-allowed; background: #e2e8f0; }
.format-btn:disabled:hover { background: #e2e8f0; color: inherit; border-color: var(--border); }
.format-btn i { font-size: 1.2rem; }

/* Loading Overlay */
.loading-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0, 0, 0, 0.7); z-index: 9999; display: flex; align-items: center; justify-content: center; }
.loading-spinner { text-align: center; color: white; }
.spinner { border: 4px solid rgba(255, 255, 255, 0.3); border-top: 4px solid white; border-radius: 50%; width: 50px; height: 50px; animation: spin 1s linear infinite; margin: 0 auto 1rem; }
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
.loading-spinner p { font-size: 1.1rem; font-weight: 600; }

/* Drag and Drop */
.upload-label.drag-over { background: #cbd5e1; border-color: var(--primary); border-style: solid; transform: scale(1.02); }
.upload-box { position: relative; }

/* Footer */
.footer { background: var(--white); border-top: 1px solid var(--border); padding: 2rem; margin-top: 3rem; }
.footer-content { max-width: 1200px; margin: 0 auto; text-align: center; }
.footer-links { display: flex; gap: 2rem; justify-content: center; margin-bottom: 1rem; flex-wrap: wrap; }
.footer-links a { color: var(--text); text-decoration: none; font-weight: 500; transition: 0.2s; }
.footer-links a:hover { color: var(--primary); }
.footer-social { display: flex; gap: 1rem; justify-content: center; margin-bottom: 1rem; }
.footer-social a { color: var(--text); font-size: 1.3rem; transition: 0.2s; }
.footer-social a:hover { color: var(--primary); transform: scale(1.1); }
.footer-copyright { color: #64748b; font-size: 0.9rem; }

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .workspace {
        grid-template-columns: 1fr; /* Stack vertically */
    }
    .input-panel {
        border-right: none;
        border-bottom: 1px solid var(--border);
        padding-bottom: 2rem;
        margin-bottom: 2rem;
        padding-right: 0;
    }
    .merger-grid, .preview-transform-grid {
        grid-template-columns: 1fr; /* Stack slots */
    }
    .navbar {
        padding: 1rem;
        flex-direction: column;
        gap: 1rem;
    }
    .nav-links {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
    }
    .privacy-features {
        flex-direction: column;
        gap: 0.5rem;
    }
    .use-case-grid {
        grid-template-columns: 1fr;
    }
    .footer-links {
        flex-direction: column;
        gap: 0.8rem;
    }
}

.hidden { display: none !important; }