/* ============================================
   RESET & BASE
   ============================================ */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --primary: #4a7cff;
    --primary-dark: #3b6ce6;
    --primary-light: #eef3ff;
    --accent: #8b5cf6;
    --text: #1a1d23;
    --text-muted: #6b7280;
    --text-light: #9ca3af;
    --bg: #f5f7fa;
    --white: #ffffff;
    --border: #e5e7eb;
    --border-light: #f3f4f6;
    --success: #10b981;
    --success-bg: #d1fae5;
    --danger: #ef4444;
    --transition: all 0.2s ease;
    --navbar-h: 68px;
}

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; }

/* ============================================
   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);
    height: var(--navbar-h);
    flex-shrink: 0;
}
.navbar-container {
    max-width: 1280px; margin: 0 auto;
    padding: 0 1.5rem;
    display: flex; align-items: center;
    justify-content: space-between;
    height: 100%; gap: 2rem;
}
.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;
}
.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); }
.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: 220px;
    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); }
.navbar-toggle {
    display: none; flex-direction: column; gap: 5px;
    background: none; border: none;
    padding: 8px; cursor: pointer; border-radius: 8px;
}
.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); }

/* ============================================
   FOOTER
   ============================================ */
.site-footer {
    background: var(--white);
    border-top: 1px solid var(--border);
    padding: 3rem 1.5rem 1.5rem;
    margin-top: 2rem;
}
.footer-inner { max-width: 1280px; margin: 0 auto; }
.footer-top {
    display: grid; grid-template-columns: repeat(4, 1fr);
    gap: 2.5rem; padding-bottom: 2.5rem;
    border-bottom: 1px solid var(--border);
}
.footer-col { display: flex; flex-direction: column; }
.footer-heading {
    font-size: 11px; font-weight: 800;
    color: var(--text); text-transform: uppercase;
    letter-spacing: 0.08em; margin-bottom: 1.15rem;
}
.footer-links {
    list-style: none; padding: 0; margin: 0;
    display: flex; flex-direction: column; gap: 0.7rem;
}
.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); }
.footer-bottom {
    display: flex; justify-content: space-between;
    align-items: center; padding-top: 1.5rem;
    gap: 1rem; flex-wrap: wrap;
}
.footer-copy { font-size: 13px; color: var(--text-light); margin: 0; }
.footer-socials { display: flex; gap: 0.4rem; 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);
    transition: var(--transition);
}
.footer-socials a:hover {
    background: var(--primary-light); color: var(--primary);
    transform: translateY(-2px);
}
.footer-socials svg { width: 18px; height: 18px; }

/* ============================================
   HOME PAGE
   ============================================ */
.home-page {
    height: calc(100vh - var(--navbar-h));
    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 */
.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;
    color: white;
}
@keyframes floatIcon {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}
.upload-launcher-icon svg { width: 42px; height: 42px; }
.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);
}

/* ============================================
   EDITOR PAGE
   ============================================ */
.editor-wrap {
    display: flex; flex-direction: column;
    height: 100vh; overflow: hidden;
}
.editor-scroll {
    flex: 1; overflow-y: auto; overflow-x: hidden;
}
.app-layout {
    display: grid;
    grid-template-columns: 340px 1fr;
    min-height: calc(100vh - var(--navbar-h));
}
.sidebar {
    background: var(--white);
    border-right: 1px solid var(--border);
    display: flex; flex-direction: column;
    overflow-y: auto;
}
.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: 16px; font-weight: 700;
    color: var(--text); margin-bottom: 14px;
}

/* Page size presets */
.preset-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
}
.preset-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.75rem 0.5rem;
    background: var(--bg);
    border: 2px solid transparent;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 700;
    color: var(--text);
    transition: var(--transition);
    cursor: pointer;
    font-family: inherit;
    gap: 2px;
}
.preset-btn small {
    font-size: 10px;
    font-weight: 500;
    color: var(--text-light);
}
.preset-btn:hover {
    background: var(--primary-light);
    color: var(--primary);
}
.preset-btn.active {
    background: var(--primary-light);
    border-color: var(--primary);
    color: var(--primary);
}
.preset-btn.active small { color: var(--primary); }

/* Info box */
.info-box {
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1rem;
}
.info-row {
    display: flex; justify-content: space-between;
    font-size: 13px; margin-bottom: 0.5rem;
    gap: 8px;
}
.info-row:last-child { margin-bottom: 0; }
.info-row .label { color: var(--text-muted); flex-shrink: 0; }
.info-row .value {
    font-weight: 700; color: var(--text);
    text-align: right;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.info-row .value.success { color: var(--success); }

/* Action buttons */
.action-buttons {
    padding: 20px;
    display: flex; flex-direction: column;
    gap: 0.6rem;
    border-top: 1px solid var(--border-light);
    margin-top: auto;
    position: sticky;
    bottom: 0;
    background: var(--white);
}
.btn-full {
    width: 100%;
    padding: 14px 20px;
    border-radius: 12px;
    font-size: 15px; font-weight: 700;
    display: flex; align-items: center;
    justify-content: center; gap: 8px;
    transition: var(--transition);
    font-family: inherit;
    cursor: pointer;
}
.btn-apply {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 14px rgba(74, 124, 255, 0.35);
}
.btn-apply:hover:not(:disabled) {
    background: var(--primary-dark);
    transform: translateY(-1px);
}
.btn-apply:disabled { opacity: 0.5; cursor: not-allowed; box-shadow: none; }
.btn-download {
    background: var(--success);
    color: white;
    box-shadow: 0 4px 14px rgba(16, 185, 129, 0.35);
}
.btn-download:hover:not(:disabled) { background: #059669; transform: translateY(-1px); }
.btn-download:disabled { opacity: 0.5; cursor: not-allowed; box-shadow: none; }
.btn-outline {
    background: white; color: var(--text);
    border: 1px solid var(--border);
}
.btn-outline:hover {
    background: var(--bg);
    border-color: var(--primary);
    color: var(--primary);
}
.btn-full svg { width: 18px; height: 18px; }

/* Main content */
.main-content {
    background: var(--bg);
    display: flex; flex-direction: column;
    padding: 24px;
    gap: 16px;
    min-height: 100%;
}

/* Image grid */
.image-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
}
.image-card {
    background: var(--white);
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0,0,0,0.06);
    border: 1px solid var(--border-light);
    display: flex;
    flex-direction: column;
    transition: var(--transition);
    position: relative;
}
.image-card:hover {
    box-shadow: 0 8px 24px rgba(0,0,0,0.1);
    transform: translateY(-2px);
}
.image-card.dragging {
    opacity: 0.4;
}
.image-card.drag-over {
    border-color: var(--primary);
    transform: scale(1.03);
    box-shadow: 0 0 0 3px rgba(74, 124, 255, 0.2);
}
.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;
    pointer-events: none;
    user-select: none;
    -webkit-user-drag: none;
}
.card-toolbar {
    position: absolute;
    top: 8px; right: 8px;
    display: flex;
    gap: 4px;
    z-index: 2;
    opacity: 0;
    transition: var(--transition);
}
.image-card:hover .card-toolbar { opacity: 1; }
.card-tool {
    width: 32px; height: 32px;
    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);
    border: none;
    cursor: pointer;
}
.card-tool:hover { background: white; transform: scale(1.1); }
.card-tool svg { width: 15px; height: 15px; stroke-width: 2; }
.card-tool.danger:hover { background: var(--danger); color: white; }
.card-tool.crop-btn:hover { background: var(--primary); color: white; }

.card-index {
    position: absolute;
    top: 8px; left: 8px;
    background: rgba(74, 124, 255, 0.95);
    color: white;
    font-size: 11px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 6px;
    z-index: 2;
}

.card-footer {
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.card-filename {
    font-size: 12px;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin: 0;
}
.card-size {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 600;
}

/* Empty state */
.empty-state {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
    background: var(--white);
    border-radius: 16px;
    border: 1px solid var(--border-light);
}
.empty-icon {
    width: 80px; height: 80px;
    display: flex; align-items: center; justify-content: center;
    background: var(--primary-light);
    border-radius: 20px;
    margin-bottom: 20px;
    color: var(--primary);
}
.empty-icon svg { width: 40px; height: 40px; stroke-width: 1.5; }
.empty-state h2 {
    font-size: 20px; font-weight: 700;
    color: var(--text); margin-bottom: 8px;
}
.empty-state p {
    font-size: 14px;
    color: var(--text-muted);
    max-width: 400px;
    margin-bottom: 24px;
}
.upload-cta-btn {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 12px 24px;
    background: var(--primary);
    color: white;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    transition: var(--transition);
    box-shadow: 0 4px 14px rgba(74, 124, 255, 0.3);
    border: none;
    cursor: pointer;
    font-family: inherit;
}
.upload-cta-btn:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}
.upload-cta-btn svg { width: 18px; height: 18px; }

/* ============================================
   CROP MODAL (Box style)
   ============================================ */
.image-modal-overlay {
    position: fixed; inset: 0;
    background: rgba(15, 23, 42, 0.85);
    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;
}
.image-modal-title .name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 300px;
}
.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;
    border: none;
    cursor: pointer;
    font-family: inherit;
}
.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);
}

/* Crop overlay UI */
.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;
    pointer-events: none;
}
.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;
    white-space: nowrap;
    z-index: 100;
    display: flex;
    align-items: center;
    gap: 12px;
    pointer-events: none;
}
.crop-instructions .key {
    display: inline-flex;
    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);
}

/* Cropper.js overrides */
.cropper-modal {
    background: rgba(0, 0, 0, 0.75) !important;
    opacity: 1 !important;
}
.cropper-view-box {
    outline: 2px solid #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: 12px;
    height: 12px;
    border-radius: 3px;
    border: 2px solid white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}
.cropper-point:hover {
    transform: scale(1.3);
    background-color: #3b6ce6;
}

/* ============================================
   PROCESSING OVERLAY
   ============================================ */
.processing-overlay {
    position: fixed; inset: 0;
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(8px);
    z-index: 9998;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    color: white; padding: 2rem; text-align: center;
}
.processing-spinner {
    width: 60px; height: 60px;
    border: 4px solid rgba(255,255,255,0.15);
    border-top-color: #4a7cff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 1.5rem;
}
@keyframes spin { to { transform: rotate(360deg); } }
.processing-title {
    font-size: 1.25rem; font-weight: 700;
    margin-bottom: 0.5rem;
}
.processing-status {
    font-size: 0.9rem; opacity: 0.85;
    margin-bottom: 1.5rem;
    min-height: 1.4em;
}
.progress-track {
    width: 100%; max-width: 400px;
    height: 6px;
    background: rgba(255,255,255,0.15);
    border-radius: 999px; overflow: hidden;
}
.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #4a7cff, #8b5cf6);
    width: 0%;
    transition: width 0.3s ease;
    border-radius: 999px;
}

/* ============================================
   RESULT 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: 500px; 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);
    border: none;
    cursor: pointer;
    font-family: inherit;
}
.btn-secondary { background: #e5e7eb; color: var(--text); }
.btn-secondary:hover { background: #d1d5db; }

/* ============================================
   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;
    max-width: 400px;
}
.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) {
    .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: 0 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: 700px; 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; margin-top: 0.25rem;
        max-height: 0; overflow: hidden;
    }
    .dropdown-menu.open { max-height: 400px; padding: 0.5rem; }

    .app-layout { grid-template-columns: 1fr; }
    .sidebar { border-right: none; border-bottom: 1px solid var(--border); }
    .footer-top { grid-template-columns: repeat(2, 1fr); gap: 2rem 1.5rem; }
}

@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;
        justify-content: center;
    }
    .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: 15px; }
    .action-buttons { padding: 16px; }
    .btn-full { padding: 12px 16px; font-size: 14px; }

    .main-content { padding: 16px; gap: 12px; }
    .image-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 10px;
    }
    .card-filename { font-size: 11px; }
    .card-size { font-size: 10px; }
    .card-toolbar { opacity: 1; }
    .card-tool { width: 28px; height: 28px; }
    .card-tool svg { width: 13px; height: 13px; }

    .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; }
    .image-modal-title .name { max-width: 120px; }
    .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; }
    .crop-mode-banner { font-size: 10px; padding: 5px 12px; top: 8px; }
    .crop-instructions { font-size: 10px; padding: 6px 12px; bottom: 10px; gap: 6px; }

    .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; }

    .site-footer { padding: 2rem 1rem 1rem; }
    .footer-top {
        grid-template-columns: 1fr; gap: 1.75rem;
        text-align: center; padding-bottom: 1.75rem;
    }
    .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-links { align-items: center; gap: 0.7rem; }
    .footer-links a { padding: 0.4rem 0; min-height: 32px; line-height: 24px; }
    .footer-links a:hover { transform: none; }
    .footer-bottom {
        flex-direction: column; text-align: center;
        gap: 1rem; padding-top: 1.5rem;
    }
    .footer-copy { order: 2; font-size: 12px; }
    .footer-socials { order: 1; justify-content: center; width: 100%; }
    .footer-socials a { width: 42px; height: 42px; background: var(--bg); }
    .footer-socials svg { width: 20px; height: 20px; }
}

@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, a:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}
/* ============================================
   📊 PDF INFO SECTION (below preview)
   ============================================ */
.info-section-main {
    background: var(--white);
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
    border: 1px solid var(--border-light);
    margin-top: 16px;
}

.info-header {
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-light);
}

.info-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
}

.info-card {
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 14px;
    text-align: center;
    transition: var(--transition);
}

.info-card:hover {
    border-color: var(--primary);
    background: var(--primary-light);
}

.info-card-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.05em;
    margin-bottom: 6px;
}

.info-card-value {
    font-size: 18px;
    font-weight: 800;
    color: var(--text);
    word-break: break-word;
}

.info-card-value.success {
    color: var(--success);
}

/* Mobile */
@media (max-width: 600px) {
    .info-section-main { padding: 16px; margin-top: 12px; }
    .info-cards {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
    .info-card { padding: 10px 8px; }
    .info-card-label { font-size: 10px; margin-bottom: 4px; }
    .info-card-value { font-size: 15px; }
}

@media (max-width: 400px) {
    .info-cards { grid-template-columns: 1fr 1fr; }
}