/* ============================================
   RESET & BASE
   ============================================ */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --primary: #4a7cff;
    --primary-dark: #3b6ce6;
    --primary-light: #eef3ff;
    --text: #1a1d23;
    --text-muted: #6b7280;
    --text-light: #9ca3af;
    --bg: #f5f7fa;
    --white: #ffffff;
    --border: #e5e7eb;
    --border-light: #f3f4f6;
    --success: #10b981;
    --success-bg: #d1fae5;
    --danger: #ef4444;
    --radius: 12px;
    --radius-lg: 16px;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
    --shadow: 0 2px 12px rgba(0,0,0,0.06);
    --transition: all 0.2s ease;
}

html, body { height: 100%; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
    overflow: hidden;
}

button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, select { font-family: inherit; }
a { text-decoration: none; color: inherit; }

/* ============================================
   HOME PAGE (State 1)
   ============================================ */
.home-page {
    height: 100vh;
    overflow-y: auto;
    background: var(--bg);
    padding: 2rem 1rem;
}
.home-page::-webkit-scrollbar { width: 8px; }
.home-page::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 4px; }

.home-container {
    max-width: 900px;
    margin: 0 auto;
    background: var(--white);
    padding: 2.5rem 2rem;
    border-radius: 24px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.08);
}

.home-header { text-align: center; margin-bottom: 1.5rem; }
.home-title {
    font-size: 2.25rem;
    font-weight: 800;
    margin-bottom: 0.75rem;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, #4a7cff, #8b5cf6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.home-subtitle {
    color: var(--text-muted);
    font-size: 1rem;
    max-width: 620px;
    margin: 0 auto;
    line-height: 1.6;
}

.feature-badges {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 2rem;
}
.badge {
    padding: 0.35rem 0.85rem;
    background: var(--primary-light);
    color: var(--primary);
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
}

.upload-launcher {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 3.5rem 1.5rem;
    background: linear-gradient(135deg, #f8fafc 0%, #eff6ff 100%);
    border: 2px dashed #cbd5e1;
    border-radius: 24px;
    cursor: pointer;
    transition: var(--transition);
    margin: 1.5rem 0 2rem;
    min-height: 340px;
}
.upload-launcher:hover {
    border-color: var(--primary);
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
    transform: translateY(-2px);
    box-shadow: 0 20px 40px rgba(74, 124, 255, 0.15);
}
.upload-launcher.dragover {
    border-color: var(--primary);
    background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
    transform: scale(1.02);
}
.upload-launcher-icon {
    width: 90px;
    height: 90px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #4a7cff, #8b5cf6);
    border-radius: 22px;
    margin-bottom: 1.25rem;
    box-shadow: 0 12px 32px rgba(74, 124, 255, 0.35);
    animation: floatIcon 3s ease-in-out infinite;
}
@keyframes floatIcon {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}
.upload-launcher-icon svg {
    width: 42px;
    height: 42px;
    color: white;
    stroke-width: 2.2;
}
.upload-launcher h2 {
    font-size: 1.65rem;
    font-weight: 800;
    color: var(--text);
    margin-bottom: 0.5rem;
}
.upload-launcher p {
    color: var(--text-muted);
    font-size: 1rem;
    margin-bottom: 1.75rem;
    max-width: 420px;
}
.upload-btn-big {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    padding: 1rem 2.5rem;
    background: linear-gradient(135deg, #4a7cff, #8b5cf6);
    color: white;
    border-radius: 14px;
    font-size: 1.05rem;
    font-weight: 700;
    transition: var(--transition);
    box-shadow: 0 12px 32px rgba(74, 124, 255, 0.35);
}
.upload-btn-big:hover {
    transform: translateY(-3px);
    box-shadow: 0 18px 44px rgba(74, 124, 255, 0.45);
}
.upload-btn-big .icon { font-size: 1.3rem; }
.formats {
    display: inline-block;
    padding: 0.35rem 1rem;
    background: white;
    border: 1px solid var(--border);
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-top: 1rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.privacy-note {
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-light);
    margin-bottom: 2rem;
}

.seo-section {
    margin-top: 2.5rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border);
}
.seo-title {
    font-size: 1.35rem;
    font-weight: 700;
    margin-bottom: 1rem;
}
.seo-steps, .seo-features {
    padding-left: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}
.seo-steps li, .seo-features li {
    color: var(--text-muted);
    font-size: 0.95rem;
    line-height: 1.6;
}
.seo-steps li strong, .seo-features li strong { color: var(--text); }

.faq-item {
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 0.9rem 1.25rem;
    margin-bottom: 0.6rem;
}
.faq-item[open] { border-color: var(--primary); }
.faq-item summary {
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    list-style: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
    content: '+';
    font-size: 1.3rem;
    color: var(--primary);
    font-weight: 300;
    transition: var(--transition);
}
.faq-item[open] summary::after { transform: rotate(45deg); }
.faq-item p {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-top: 0.6rem;
    padding-top: 0.6rem;
    border-top: 1px solid var(--border);
}

.home-footer {
    margin-top: 2.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
    text-align: center;
}
.home-footer nav {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
}
.home-footer nav a:hover { color: var(--primary); }
.footer-copy { font-size: 0.8rem; color: #94a3b8; }

/* ============================================
   EDITOR PAGE (State 2)
   ============================================ */
.app-layout {
    display: grid;
    grid-template-columns: 1fr 340px;
    height: 100vh;
    overflow: hidden;
}

.sidebar {
    background: var(--white);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
}
.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 3px; }

.top-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-light);
    position: sticky;
    top: 0;
    background: var(--white);
    z-index: 10;
}

.toolbar-icon-btn {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--white);
    color: var(--text);
    transition: var(--transition);
    flex-shrink: 0;
}
.toolbar-icon-btn:hover {
    background: var(--primary-light);
    border-color: var(--primary);
    color: var(--primary);
}
.toolbar-icon-btn svg { width: 20px; height: 20px; stroke-width: 2; }
.toolbar-icon-btn.primary {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}
.toolbar-icon-btn.primary:hover {
    background: var(--primary-dark);
    color: white;
}
.toolbar-spacer { flex: 1; }

.max-file-info {
    padding: 10px 20px 16px;
    font-size: 12px;
    color: var(--text-light);
    border-bottom: 1px solid var(--border-light);
}

.sidebar-section {
    padding: 20px;
    border-bottom: 1px solid var(--border-light);
}
.section-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.section-toggle {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition);
    border-radius: 6px;
}
.section-toggle svg { width: 16px; height: 16px; transition: transform 0.2s; }
.section-toggle.collapsed svg { transform: rotate(180deg); }

.tabs {
    display: flex;
    background: var(--bg);
    border-radius: 10px;
    padding: 4px;
    margin-bottom: 20px;
}
.tab-btn {
    flex: 1;
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    transition: var(--transition);
    white-space: nowrap;
}
.tab-btn.active {
    background: var(--white);
    color: var(--text);
    box-shadow: 0 2px 6px rgba(0,0,0,0.06);
}

.input-row {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: 10px;
    align-items: end;
    margin-bottom: 16px;
}
.input-group { display: flex; flex-direction: column; gap: 6px; }
.input-label { font-size: 12px; font-weight: 600; color: var(--text); }
.input-wrapper {
    display: flex;
    align-items: center;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--white);
    transition: var(--transition);
}
.input-wrapper:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(74, 124, 255, 0.1);
}
.input-wrapper input {
    flex: 1;
    width: 100%;
    padding: 11px 12px;
    border: none;
    background: transparent;
    font-size: 14px;
    color: var(--text);
    outline: none;
    min-width: 0;
}
.input-wrapper input::placeholder { color: var(--text-light); }

.unit-select {
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 11px 10px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    background: var(--white);
    cursor: pointer;
    outline: none;
}

.checkbox-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 0;
    margin-bottom: 4px;
}
.checkbox-row input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
    cursor: pointer;
}
.checkbox-row label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
    cursor: pointer;
    user-select: none;
}

.full-input-group { margin-bottom: 16px; }
.full-input-group .input-label { display: block; margin-bottom: 6px; }
.full-input-group .input-label .hint {
    font-weight: 400;
    color: var(--text-light);
    font-size: 11px;
}
.combined-input {
    display: flex;
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
    background: var(--white);
    transition: var(--transition);
}
.combined-input:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(74, 124, 255, 0.1);
}
.combined-input input {
    flex: 1;
    padding: 11px 12px;
    border: none;
    outline: none;
    font-size: 14px;
    background: transparent;
    min-width: 0;
}
.combined-input select {
    border: none;
    border-left: 1px solid var(--border);
    padding: 0 12px;
    background: var(--white);
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    cursor: pointer;
    outline: none;
}
.help-text {
    font-size: 11px;
    color: var(--text-light);
    margin-top: 6px;
    line-height: 1.5;
}
.select-full {
    width: 100%;
    padding: 11px 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
    background: var(--white);
    cursor: pointer;
    outline: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='2 4 6 8 10 4'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 36px;
}

.export-btn-wrapper {
    padding: 20px;
    border-top: 1px solid var(--border-light);
    background: var(--white);
    position: sticky;
    bottom: 0;
    margin-top: auto;
}
.export-btn {
    width: 100%;
    padding: 16px 24px;
    background: var(--primary);
    color: white;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: var(--transition);
    box-shadow: 0 4px 14px rgba(74, 124, 255, 0.35);
    margin-bottom: 12px;
}
.export-btn:hover:not(:disabled) {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(74, 124, 255, 0.45);
}
.export-btn:disabled { opacity: 0.5; cursor: not-allowed; box-shadow: none; }
.export-btn svg { width: 20px; height: 20px; }

.main-content {
    overflow-y: auto;
    background: var(--bg);
    display: flex;
    flex-direction: column;
    height: 100vh;
}
.main-content::-webkit-scrollbar { width: 8px; }
.main-content::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 4px; }

.ad-banner {
    background: var(--white);
    border-bottom: 1px solid var(--border);
    padding: 12px 20px;
    min-height: 90px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}
.ad-banner.bottom {
    border-bottom: none;
    border-top: 1px solid var(--border);
    margin-top: auto;
}
.ad-placeholder { color: var(--text-light); font-size: 12px; text-align: center; }
.ad-label {
    position: absolute;
    top: 4px;
    right: 8px;
    font-size: 10px;
    color: var(--text-light);
    font-weight: 500;
}

.image-grid {
    padding: 24px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
    align-content: start;
}

.image-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border-light);
}
.image-card:hover {
    box-shadow: var(--shadow);
    transform: translateY(-2px);
}
.card-image-wrap {
    position: relative;
    background: #f0f2f7;
    aspect-ratio: 1 / 1;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    cursor: pointer;
}
.card-image-wrap img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    display: block;
}
.card-toolbar {
    position: absolute;
    top: 10px;
    right: 10px;
    display: flex;
    gap: 4px;
    z-index: 2;
}
.card-tool {
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 50%;
    color: var(--text);
    transition: var(--transition);
    backdrop-filter: blur(8px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
.card-tool:hover { background: white; transform: scale(1.1); }
.card-tool svg { width: 16px; height: 16px; stroke-width: 2; }
.card-tool.danger:hover { background: var(--danger); color: white; }

.card-footer {
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.card-filename {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.card-dims {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    flex-wrap: wrap;
}
.dim-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 8px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 11px;
    background: #e5e7eb;
    color: var(--text);
    white-space: nowrap;
}
.dim-badge.new { background: var(--success-bg); color: #047857; }
.dim-arrow { color: var(--text-light); font-weight: 700; font-size: 11px; }
.size-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    background: #f3f4f6;
    color: var(--text-muted);
}
.size-badge.new { background: var(--success-bg); color: #047857; }

.card-processing {
    position: absolute;
    inset: 0;
    background: rgba(255,255,255,0.85);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    z-index: 5;
    font-size: 12px;
    font-weight: 600;
    color: var(--primary);
}
.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--primary-light);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================
   🖼️ IMAGE MODAL (BOX STYLE)
   ============================================ */
.image-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.75);
    backdrop-filter: blur(8px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn 0.2s ease;
}
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.image-modal {
    background: #0f172a;
    border-radius: 20px;
    width: 100%;
    max-width: 900px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
    animation: scaleIn 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid rgba(255, 255, 255, 0.08);
}
@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.92); }
    to { opacity: 1; transform: scale(1); }
}

.image-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 18px;
    background: rgba(255, 255, 255, 0.04);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    flex-shrink: 0;
    flex-wrap: wrap;
    gap: 10px;
}
.image-modal-title {
    color: white;
    font-size: 14px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 12px;
    overflow: hidden;
    max-width: 40%;
}
.image-modal-title .name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.image-modal-counter {
    display: inline-flex;
    padding: 3px 10px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    flex-shrink: 0;
}
.image-modal-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.modal-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 16px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    color: white;
    transition: var(--transition);
    white-space: nowrap;
}
.modal-btn svg { width: 16px; height: 16px; }
.modal-btn-crop { background: linear-gradient(135deg, #4a7cff, #8b5cf6); }
.modal-btn-crop:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(74, 124, 255, 0.5); }
.modal-btn-crop.active { background: linear-gradient(135deg, #f59e0b, #f97316); }
.modal-btn-apply { background: linear-gradient(135deg, #10b981, #22c55e); }
.modal-btn-apply:hover { transform: translateY(-1px); }
.modal-btn-reset {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
}
.modal-btn-reset:hover { background: rgba(255, 255, 255, 0.2); }
.modal-btn-delete { background: rgba(239, 68, 68, 0.9); }
.modal-btn-delete:hover { background: #dc2626; }
.modal-btn-close {
    width: 38px;
    height: 38px;
    padding: 0;
    justify-content: center;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    font-size: 18px;
}
.modal-btn-close:hover {
    background: rgba(239, 68, 68, 0.9);
    transform: rotate(90deg);
}

.image-modal-body {
    flex: 1;
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    overflow: hidden;
    position: relative;
    background: #0a0f1e;
}
.image-modal-body img {
    max-width: 100%;
    max-height: 100%;
    display: block;
    border-radius: 6px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.image-modal-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.12);
    color: white;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    font-size: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    backdrop-filter: blur(10px);
    z-index: 10;
}
.image-modal-nav:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-50%) scale(1.1);
}
.image-modal-nav.prev { left: 12px; }
.image-modal-nav.next { right: 12px; }

.modal-instructions {
    position: absolute;
    bottom: 14px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.75);
    color: white;
    padding: 7px 16px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    backdrop-filter: blur(10px);
    white-space: nowrap;
    pointer-events: none;
}

/* Crop mode banner */
.crop-mode-banner {
    position: absolute;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #f59e0b, #f97316);
    color: white;
    padding: 7px 18px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 6px 24px rgba(245, 158, 11, 0.5);
    z-index: 100;
    animation: slideDownBanner 0.3s ease;
    white-space: nowrap;
    pointer-events: none;
}
@keyframes slideDownBanner {
    from { opacity: 0; transform: translateX(-50%) translateY(-20px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}
.crop-mode-banner .pulse-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: white;
    animation: pulseDot 1.2s ease-in-out infinite;
}
@keyframes pulseDot {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(1.4); }
}

.crop-instructions {
    position: absolute;
    bottom: 14px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.85);
    color: white;
    padding: 8px 18px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    backdrop-filter: blur(10px);
    white-space: nowrap;
    z-index: 100;
    display: flex;
    align-items: center;
    gap: 12px;
    animation: slideDownBanner 0.3s ease;
    pointer-events: none;
}
.crop-instructions .key {
    display: inline-flex;
    align-items: center;
    padding: 2px 7px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 4px;
    font-size: 10px;
    font-weight: 700;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.crop-aspect-toolbar {
    position: absolute;
    top: 12px;
    left: 12px;
    display: flex;
    gap: 5px;
    background: rgba(15, 23, 42, 0.9);
    padding: 5px;
    border-radius: 10px;
    backdrop-filter: blur(10px);
    z-index: 100;
    animation: slideDownBanner 0.3s ease;
    flex-wrap: wrap;
    max-width: calc(100% - 24px);
}
.crop-aspect-btn {
    padding: 6px 11px;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border-radius: 7px;
    font-size: 11px;
    font-weight: 700;
    transition: all 0.2s;
    border: 1px solid transparent;
    white-space: nowrap;
}
.crop-aspect-btn:hover { background: rgba(255, 255, 255, 0.2); }
.crop-aspect-btn.active {
    background: #4a7cff;
    border-color: #4a7cff;
    box-shadow: 0 4px 12px rgba(74, 124, 255, 0.5);
}

.crop-zoom-toolbar {
    position: absolute;
    bottom: 14px;
    right: 14px;
    display: flex;
    gap: 5px;
    background: rgba(15, 23, 42, 0.9);
    padding: 5px;
    border-radius: 10px;
    backdrop-filter: blur(10px);
    z-index: 100;
    animation: slideDownBanner 0.3s ease;
}
.crop-zoom-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 700;
    transition: all 0.2s;
}
.crop-zoom-btn:hover { background: rgba(255, 255, 255, 0.25); transform: scale(1.08); }
.crop-zoom-btn:active { transform: scale(0.95); }

/* Cropper.js overrides */
.cropper-modal {
    background: rgba(0, 0, 0, 0.75) !important;
    opacity: 1 !important;
}
.cropper-view-box {
    outline: 2px solid #4a7cff;
    outline-color: #4a7cff;
    box-shadow: 0 0 0 1px rgba(74, 124, 255, 0.3),
                0 0 30px rgba(74, 124, 255, 0.4);
}
.cropper-line { background-color: rgba(74, 124, 255, 0.5); }
.cropper-dashed { border-color: rgba(255, 255, 255, 0.4); }
.cropper-point {
    background-color: #4a7cff;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 2px solid white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
    transition: transform 0.15s;
}
.cropper-point:hover { transform: scale(1.3); background-color: #3b6ce6; }
.cropper-point.point-nw,
.cropper-point.point-ne,
.cropper-point.point-sw,
.cropper-point.point-se {
    width: 14px;
    height: 14px;
    border-radius: 3px;
    background-color: #4a7cff;
    border: 2px solid white;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}
.cropper-point.point-n,
.cropper-point.point-s,
.cropper-point.point-e,
.cropper-point.point-w {
    background-color: #4a7cff;
    border: 1.5px solid white;
    border-radius: 3px;
}

/* ============================================
   RESULTS MODAL
   ============================================ */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.75);
    backdrop-filter: blur(4px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.modal {
    background: white;
    border-radius: 20px;
    padding: 32px;
    max-width: 480px;
    width: 100%;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    animation: scaleIn 0.3s ease;
}
.modal h2 {
    font-size: 22px;
    font-weight: 800;
    margin-bottom: 20px;
    text-align: center;
}
.result-stats {
    display: flex;
    justify-content: space-around;
    padding: 20px 0;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    margin-bottom: 24px;
}
.stat-box { text-align: center; }
.stat-box .label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.05em;
}
.stat-box .value {
    font-size: 20px;
    font-weight: 800;
    color: var(--text);
    margin-top: 4px;
}
.stat-box .value.success { color: var(--success); }
.modal-actions { display: flex; gap: 12px; }
.modal-actions .btn {
    flex: 1;
    padding: 12px 20px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 700;
    transition: var(--transition);
}
.btn-secondary { background: #e5e7eb; color: var(--text); }
.btn-secondary:hover { background: #d1d5db; }
.btn-success { background: var(--success); color: white; }
.btn-success:hover { background: #059669; }

/* ============================================
   TOAST
   ============================================ */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}
.toast {
    padding: 12px 20px;
    border-radius: 10px;
    color: white;
    font-weight: 600;
    font-size: 13px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    animation: slideDown 0.3s ease;
    min-width: 220px;
    transition: var(--transition);
}
.toast-success { background: rgba(16, 185, 129, 0.96); }
.toast-error { background: rgba(239, 68, 68, 0.96); }
.toast-info { background: rgba(74, 124, 255, 0.96); }
@keyframes slideDown {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 900px) {
    .app-layout {
        grid-template-columns: 1fr;
        height: auto;
        overflow: visible;
    }
    body { overflow: auto; }
    .sidebar {
        height: auto;
        max-height: none;
        border-right: none;
        border-bottom: 1px solid var(--border);
        position: relative;
    }
    .main-content { height: auto; min-height: 60vh; }
    .image-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        padding: 16px;
        gap: 12px;
    }
    .image-modal {
        max-width: 95vw;
        max-height: 92vh;
        border-radius: 16px;
    }
}

@media (max-width: 600px) {
    .home-page { padding: 1rem; }
    .home-container { padding: 1.5rem 1.25rem; border-radius: 20px; }
    .home-title { font-size: 1.6rem; }
    .home-subtitle { font-size: 0.9rem; }
    .upload-launcher { padding: 2.5rem 1rem; min-height: 280px; }
    .upload-launcher-icon { width: 70px; height: 70px; border-radius: 18px; }
    .upload-launcher-icon svg { width: 34px; height: 34px; }
    .upload-launcher h2 { font-size: 1.3rem; }
    .upload-launcher p { font-size: 0.9rem; }
    .upload-btn-big {
        padding: 0.9rem 1.75rem;
        font-size: 1rem;
        width: 100%;
        max-width: 280px;
    }
    .seo-title { font-size: 1.1rem; }
    .seo-steps li, .seo-features li { font-size: 0.85rem; }
    .faq-item { padding: 0.75rem 1rem; }
    .faq-item summary { font-size: 0.85rem; }
    .faq-item p { font-size: 0.8rem; }

    .top-toolbar { padding: 12px 16px; gap: 6px; }
    .toolbar-icon-btn { width: 42px; height: 42px; }
    .toolbar-icon-btn svg { width: 18px; height: 18px; }
    .sidebar-section { padding: 16px; }
    .section-title { font-size: 16px; margin-bottom: 12px; }
    .tabs { margin-bottom: 16px; }
    .tab-btn { padding: 8px 10px; font-size: 12px; }
    .image-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        padding: 12px;
        gap: 10px;
    }
    .card-filename { font-size: 12px; }
    .dim-badge, .size-badge { font-size: 10px; padding: 2px 6px; }
    .card-tool { width: 28px; height: 28px; }
    .card-tool svg { width: 14px; height: 14px; }

    /* Modal mobile */
    .image-modal-overlay { padding: 10px; }
    .image-modal {
        max-width: 100%;
        max-height: 95vh;
        border-radius: 14px;
    }
    .image-modal-header { padding: 10px 12px; }
    .image-modal-title { font-size: 12px; max-width: 40%; }
    .modal-btn { padding: 7px 10px; font-size: 11px; }
    .modal-btn svg { width: 14px; height: 14px; }
    .modal-btn .btn-text { display: none; }
    .modal-btn-close { width: 32px; height: 32px; font-size: 15px; }
    .image-modal-body { padding: 10px; }
    .image-modal-nav { width: 36px; height: 36px; font-size: 18px; }
    .image-modal-nav.prev { left: 8px; }
    .image-modal-nav.next { right: 8px; }
    .modal-instructions { font-size: 10px; padding: 5px 12px; bottom: 10px; }

    .crop-mode-banner { font-size: 10px; padding: 5px 12px; top: 8px; }
    .crop-instructions { font-size: 10px; padding: 6px 12px; bottom: 10px; gap: 6px; }
    .crop-instructions .key { font-size: 9px; padding: 1px 5px; }
    .crop-aspect-toolbar { top: 8px; left: 8px; gap: 3px; padding: 4px; }
    .crop-aspect-btn { padding: 4px 8px; font-size: 10px; }
    .crop-zoom-toolbar { bottom: 10px; right: 10px; gap: 3px; padding: 4px; }
    .crop-zoom-btn { width: 32px; height: 32px; font-size: 13px; }

    .export-btn-wrapper { padding: 16px; }
    .export-btn { padding: 14px 20px; font-size: 15px; margin-bottom: 2px; }

    .toast-container { top: 10px; right: 10px; left: 10px; }
    .toast { min-width: auto; font-size: 12px; padding: 10px 14px; }

    .modal { padding: 24px 20px; }
    .modal h2 { font-size: 18px; }
    .stat-box .value { font-size: 16px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

button:focus-visible, input:focus-visible, select:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}
/* ============================================
   🌐 PROFESSIONAL MULTI-COLUMN FOOTER
   ============================================ */
.site-footer {
    margin-top: 3rem;
    padding-top: 2.5rem;
    border-top: 1px solid var(--border);
    background: #ffffff;
}

.footer-top {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 2rem;
    padding-bottom: 2rem;
}

.footer-col {
    display: flex;
    flex-direction: column;
}

.footer-heading {
    font-size: 12px;
    font-weight: 700;
    color: var(--text);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 1rem;
}

.footer-links {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.footer-links a {
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 500;
    transition: var(--transition);
    display: inline-block;
}

.footer-links a:hover {
    color: var(--primary);
    transform: translateX(2px);
}

/* Bottom bar */
.footer-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 0;
    border-top: 1px solid var(--border);
    gap: 1rem;
    flex-wrap: wrap;
}

.footer-copy {
    font-size: 13px;
    color: var(--text-light);
    margin: 0;
}

.footer-socials {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.footer-socials a {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    color: var(--text-muted);
    background: transparent;
    transition: var(--transition);
}

.footer-socials a:hover {
    background: var(--primary-light);
    color: var(--primary);
    transform: translateY(-2px);
}

.footer-socials svg {
    width: 18px;
    height: 18px;
}

/* Tablet */
@media (max-width: 768px) {
    .footer-top {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
    }
}

/* Mobile */
@media (max-width: 480px) {
    .footer-top {
        grid-template-columns: 1fr;
        gap: 1.5rem;
        text-align: center;
    }
    .footer-links {
        align-items: center;
    }
    .footer-bottom {
        flex-direction: column;
        text-align: center;
        justify-content: center;
    }
    .footer-links a:hover {
        transform: none;
    }
}
/* ============================================
   🧭 NAVBAR
   ============================================ */
.navbar {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: var(--white);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.navbar-container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 68px;
    gap: 2rem;
}

/* Logo */
.navbar-logo {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-weight: 800;
    font-size: 1.15rem;
    color: var(--text);
    flex-shrink: 0;
    transition: var(--transition);
}
.navbar-logo:hover {
    color: var(--primary);
}
.logo-icon {
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(74, 124, 255, 0.3);
    flex-shrink: 0;
}
.logo-icon svg {
    width: 18px;
    height: 18px;
    margin-left: 2px;
}
.logo-text {
    background: linear-gradient(135deg, #25223f, #151058);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Nav Links */
.navbar-links {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    list-style: none;
    margin: 0;
    padding: 0;
}

.nav-link {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.5rem 0.9rem;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-muted);
    transition: var(--transition);
    white-space: nowrap;
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
}
.nav-link:hover {
    background: var(--primary-light);
    color: var(--primary);
}
.nav-link.active {
    color: var(--primary);
    background: var(--primary-light);
}

/* Dropdown */
.nav-dropdown {
    position: relative;
}

.dropdown-toggle .chevron {
    width: 14px;
    height: 14px;
    transition: transform 0.2s;
    stroke: currentColor;
}
.dropdown-toggle.open .chevron {
    transform: rotate(180deg);
}

.dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    min-width: 200px;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    padding: 0.5rem;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 100;
}
.dropdown-menu.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-item {
    display: block;
    padding: 0.6rem 0.9rem;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-muted);
    transition: var(--transition);
}
.dropdown-item:hover {
    background: var(--primary-light);
    color: var(--primary);
}

/* Mobile toggle */
.navbar-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    border-radius: 8px;
    transition: var(--transition);
}
.navbar-toggle:hover {
    background: var(--bg);
}
.navbar-toggle span {
    width: 22px;
    height: 2.5px;
    background: var(--text);
    border-radius: 999px;
    transition: var(--transition);
}
.navbar-toggle.open span:nth-child(1) {
    transform: rotate(45deg) translate(6px, 6px);
}
.navbar-toggle.open span:nth-child(2) {
    opacity: 0;
}
.navbar-toggle.open span:nth-child(3) {
    transform: rotate(-45deg) translate(6px, -6px);
}

/* ============================================
   NAVBAR RESPONSIVE
   ============================================ */
@media (max-width: 900px) {
    .navbar-container {
        padding: 0 1rem;
        height: 60px;
    }
    .navbar-toggle {
        display: flex;
    }
    .navbar-links {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: white;
        flex-direction: column;
        align-items: stretch;
        padding: 1rem;
        gap: 0.25rem;
        border-bottom: 1px solid var(--border);
        box-shadow: 0 8px 24px rgba(0,0,0,0.08);
        max-height: 0;
        overflow: hidden;
        opacity: 0;
        transition: all 0.3s ease;
    }
    .navbar-links.open {
        max-height: 500px;
        opacity: 1;
        padding: 1rem;
    }
    .nav-link {
        width: 100%;
        justify-content: space-between;
        padding: 0.75rem 1rem;
        font-size: 1rem;
    }
    .nav-dropdown {
        width: 100%;
    }
    .dropdown-toggle {
        width: 100%;
        justify-content: space-between;
    }
    .dropdown-menu {
        position: static;
        opacity: 1;
        visibility: visible;
        transform: none;
        box-shadow: none;
        border: none;
        background: var(--bg);
        padding: 0.25rem 0.5rem;
        margin-top: 0.25rem;
        max-height: 0;
        overflow: hidden;
        padding-top: 0;
        padding-bottom: 0;
    }
    .dropdown-menu.open {
        max-height: 300px;
        padding: 0.5rem;
    }
    .dropdown-item {
        padding: 0.6rem 0.75rem;
    }
}

@media (max-width: 600px) {
    .logo-text {
        font-size: 1rem;
    }
    .logo-icon {
        width: 30px;
        height: 30px;
    }
    .logo-icon svg {
        width: 16px;
        height: 16px;
    }
}
/* ============================================
   📱 FOOTER — TABLET (≤768px)
   ============================================ */
@media (max-width: 768px) {
    .site-footer {
        padding: 2.5rem 1.25rem 1.25rem;
        margin-top: 1.5rem;
    }

    .footer-top {
        grid-template-columns: repeat(2, 1fr);
        gap: 2rem 1.5rem;
        padding-bottom: 2rem;
    }

    .footer-heading {
        font-size: 11px;
        margin-bottom: 1rem;
    }

    .footer-links {
        gap: 0.6rem;
    }

    .footer-links a {
        font-size: 14px;
    }

    .footer-bottom {
        padding-top: 1.25rem;
    }
}

/* ============================================
   📱 FOOTER — MOBILE (≤600px)
   ============================================ */
@media (max-width: 600px) {
    .site-footer {
        padding: 2rem 1rem 1rem;
        margin-top: 1rem;
        border-radius: 0;
    }

    .footer-inner {
        max-width: 100%;
    }

    /* Stack all columns vertically */
    .footer-top {
        grid-template-columns: 1fr;
        gap: 1.75rem;
        padding-bottom: 1.75rem;
        text-align: center;
    }

    .footer-col {
        align-items: center;
        padding-bottom: 1.5rem;
        border-bottom: 1px solid var(--border-light);
    }

    .footer-col:last-child {
        border-bottom: none;
        padding-bottom: 0;
    }

    .footer-heading {
        font-size: 12px;
        letter-spacing: 0.1em;
        margin-bottom: 0.9rem;
        color: var(--text);
    }

    .footer-links {
        align-items: center;
        gap: 0.7rem;
    }

    .footer-links a {
        font-size: 14px;
        padding: 0.4rem 0;
        display: inline-block;
        min-height: 32px;
        line-height: 24px;
    }

    /* Bigger touch targets */
    .footer-links a:active {
        color: var(--primary);
        transform: scale(0.96);
    }

    /* Bottom section */
    .footer-bottom {
        flex-direction: column;
        text-align: center;
        gap: 1rem;
        padding-top: 1.5rem;
    }

    .footer-copy {
        font-size: 12px;
        line-height: 1.5;
        order: 2;
    }

    /* Social icons */
    .footer-socials {
        order: 1;
        justify-content: center;
        gap: 0.5rem;
        width: 100%;
    }

    .footer-socials a {
        width: 42px;
        height: 42px;
        border-radius: 10px;
        background: var(--bg);
    }

    .footer-socials svg {
        width: 20px;
        height: 20px;
    }

    .footer-socials a:active {
        background: var(--primary);
        color: white;
        transform: scale(0.92);
    }
}

/* ============================================
   📱 FOOTER — SMALL MOBILE (≤400px)
   ============================================ */
@media (max-width: 400px) {
    .site-footer {
        padding: 1.75rem 0.85rem 0.85rem;
    }

    .footer-top {
        gap: 1.5rem;
    }

    .footer-heading {
        font-size: 11px;
        margin-bottom: 0.75rem;
    }

    .footer-links {
        gap: 0.6rem;
    }

    .footer-links a {
        font-size: 13px;
    }

    .footer-col {
        padding-bottom: 1.25rem;
    }

    .footer-socials a {
        width: 38px;
        height: 38px;
    }

    .footer-socials svg {
        width: 18px;
        height: 18px;
    }

    .footer-copy {
        font-size: 11px;
    }
}
/* Accordion footer — mobile only */
@media (max-width: 600px) {
    .footer-heading {
        display: flex;
        align-items: center;
        justify-content: space-between;
        cursor: pointer;
        padding: 0.75rem 0;
        margin-bottom: 0;
        border-bottom: 1px solid var(--border);
        width: 100%;
        user-select: none;
    }

    .footer-heading::after {
        content: '+';
        font-size: 1.3rem;
        font-weight: 300;
        color: var(--primary);
        transition: transform 0.3s ease;
    }

    .footer-heading.open::after {
        transform: rotate(45deg);
    }

    .footer-links {
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease, padding 0.3s ease;
        padding: 0;
        gap: 0;
    }

    .footer-col.open .footer-links {
        max-height: 400px;
        padding: 0.75rem 0 1rem;
        gap: 0.75rem;
    }

    /* Remove border from column since we have heading border */
    .footer-col {
        border-bottom: none;
        padding-bottom: 0;
        align-items: stretch;
    }

    .footer-top {
        gap: 0;
    }
}