/* ============================================
   LoveSwap PDF — Complete Design System
   Inspired by iLovePDF layout patterns
   Branded with LoveSwap PDF teal/blue identity
   ============================================ */

/* ── CSS Custom Properties ── */
:root {
    /* Brand Colors (from LoveSwap PDF logo) */
    --brand-primary: #1a7a6d;
    --brand-primary-light: #22a08f;
    --brand-primary-dark: #14615a;
    --brand-secondary: #1e3a5f;
    --brand-accent: #2ecc71;

    /* Backgrounds */
    --bg-body: #f8f6f5;
    --bg-hero: radial-gradient(circle at 80% -10%, rgba(253, 235, 232, 0.8) 0%, transparent 45%), radial-gradient(circle at 10% 80%, rgba(247, 234, 235, 0.6) 0%, transparent 40%);
    --bg-card: #ffffff;
    --bg-nav: #ffffff;
    --bg-footer: #2d3748;

    /* Text */
    --text-primary: #1a202c;
    --text-secondary: #4a5568;
    --text-muted: #a0aec0;
    --text-inverse: #ffffff;

    /* Borders */
    --border-light: #e8e0d8;
    --border-card: #ece5dd;

    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
    --shadow-lg: 0 8px 30px rgba(0,0,0,0.12);
    --shadow-card: 0 1px 4px rgba(0,0,0,0.04);
    --shadow-card-hover: 0 8px 25px rgba(0,0,0,0.1);

    /* Typography */
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-size-xs: 0.75rem;
    --font-size-sm: 0.8125rem;
    --font-size-base: 0.9375rem;
    --font-size-md: 1rem;
    --font-size-lg: 1.125rem;
    --font-size-xl: 1.5rem;
    --font-size-2xl: 2rem;
    --font-size-3xl: 2.5rem;
    --font-size-hero: 3rem;

    /* Spacing */
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.25rem;
    --space-6: 1.5rem;
    --space-8: 2rem;
    --space-10: 2.5rem;
    --space-12: 3rem;
    --space-16: 4rem;
    --space-20: 5rem;

    /* Borders */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 9999px;

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-base: 250ms ease;
    --transition-slow: 400ms ease;

    /* Nav */
    --nav-height: 64px;

    /* Tool Colors */
    --color-merge: #e8453c;
    --color-split: #f07c38;
    --color-compress: #48b2b7;
    --color-pdf-to-word: #2b579a;
    --color-pdf-to-ppt: #d04526;
    --color-pdf-to-excel: #217346;
    --color-pdf-to-jpg: #d4a843;
    --color-jpg-to-pdf: #d4a843;
    --color-word-to-pdf: #2b579a;
    --color-ppt-to-pdf: #d04526;
    --color-excel-to-pdf: #217346;
    --color-edit: #7b68ee;
    --color-rotate: #2196f3;
    --color-watermark: #8d6e63;
    --color-page-numbers: #4caf50;
    --color-protect: #607d8b;
    --color-unlock: #607d8b;
    --color-organize: #9c27b0;
    --color-remove-pages: #e8453c;
    --color-extract-pages: #f07c38;
    --color-crop: #00bcd4;
    --color-html-to-pdf: #e91e63;
    --color-sign: #3f51b5;
    --color-redact: #795548;
}

/* ── Reset & Base ── */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-family);
    color: var(--text-primary);
    background: var(--bg-body);
    line-height: 1.6;
    overflow-x: hidden;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

#app {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a {
    text-decoration: none;
    color: inherit;
}

img {
    max-width: 100%;
    height: auto;
}

button {
    cursor: pointer;
    border: none;
    background: none;
    font-family: inherit;
    font-size: inherit;
}

input, select, textarea {
    font-family: inherit;
    font-size: inherit;
}

/* ── Scrollbar Styling ── */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: #cbd5e0;
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: #a0aec0;
}

/* ============================================
   NAVIGATION
   ============================================ */
.nav {
    position: sticky;
    top: 0;
    z-index: 1000;
    height: calc(var(--nav-height) + env(safe-area-inset-top));
    background: var(--bg-nav);
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    padding: env(safe-area-inset-top) var(--space-6) 0 var(--space-2);
    box-shadow: var(--shadow-sm);
}

.nav__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
}

.nav__logo {
    display: flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
    z-index: 50;
}

.nav__logo-icon {
    width: 48px !important;
    height: 48px !important;
    object-fit: contain;
}

.nav__logo-text {
    font-size: 1.8rem;
    font-weight: 900;
    letter-spacing: -1px;
}

.nav__logo-text .love {
    color: #000000;
}

.nav__logo-text .swap,
.nav__logo-text .pdf-label {
    color: var(--brand-primary);
}

/* Logo styling cleaned up above */

.nav__links {
    display: flex;
    align-items: center;
    gap: var(--space-1);
    list-style: none;
}

.nav__link {
    padding: var(--space-2) var(--space-4);
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--text-primary);
    border-radius: var(--radius-sm);
    transition: var(--transition-fast);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    white-space: nowrap;
    position: relative;
}

.nav__link:hover {
    color: var(--brand-primary);
    background: rgba(26, 122, 109, 0.06);
}

.nav__link--dropdown {
    display: flex;
    align-items: center;
    gap: 4px;
}

.nav__link--dropdown::after {
    content: '';
    width: 0;
    height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 5px solid currentColor;
    transition: var(--transition-fast);
}

.nav__link--dropdown.active::after {
    transform: rotate(180deg);
}

.nav__right {
    display: flex;
    align-items: center;
    gap: var(--space-4);
}

.nav__hamburger {
    display: none;
    flex-direction: column;
    gap: 5px;
    padding: var(--space-2);
    cursor: pointer;
}

.nav__hamburger span {
    width: 24px;
    height: 2px;
    background: var(--text-primary);
    border-radius: 2px;
    transition: var(--transition-fast);
}

/* ── Dropdown Menus ── */
.dropdown {
    position: absolute;
    top: calc(var(--nav-height) - 4px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-light);
    padding: var(--space-8);
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--transition-fast), visibility var(--transition-fast), transform var(--transition-fast);
    transform: translateX(-50%) translateY(8px);
    z-index: 100;
}

.dropdown.show {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.dropdown--convert {
    width: 460px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-8);
}

.dropdown--all-tools {
    width: 1100px;
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: var(--space-4);
    left: auto;
    right: 0;
    transform: translateY(8px);
    padding: var(--space-6);
}

.dropdown--all-tools.show {
    transform: translateY(0);
}

.dropdown__section-title {
    font-size: var(--font-size-xs);
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 1px;
    margin-bottom: var(--space-4);
    padding-bottom: var(--space-2);
    border-bottom: 2px solid var(--border-light);
}

.dropdown__item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-sm);
    transition: var(--transition-fast);
    font-size: var(--font-size-sm);
    font-weight: 500;
    color: var(--text-primary);
    cursor: pointer;
}

.dropdown__item:hover {
    background: rgba(26, 122, 109, 0.06);
    color: var(--brand-primary);
}

.dropdown__item-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

/* ── Mobile Nav Overlay ── */
.mobile-nav-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 999;
}

.mobile-nav {
    display: none;
    position: fixed;
    top: 0;
    right: 0;
    width: 300px;
    height: 100%;
    background: var(--bg-card);
    z-index: 1001;
    padding: var(--space-8);
    overflow-y: auto;
    transform: translateX(100%);
    transition: transform var(--transition-base);
}

.mobile-nav.open {
    transform: translateX(0);
}

.mobile-nav__close {
    position: absolute;
    top: var(--space-4);
    right: var(--space-4);
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
}

.mobile-nav__section {
    margin-bottom: var(--space-6);
}

.mobile-nav__section-title {
    font-size: var(--font-size-xs);
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 1px;
    margin-bottom: var(--space-3);
}

.mobile-nav__link {
    display: block;
    padding: var(--space-3) 0;
    font-size: var(--font-size-base);
    font-weight: 500;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-light);
}

/* ============================================
   HOMEPAGE — HERO SECTION
   ============================================ */
.hero {
    background: var(--bg-hero);
    padding: var(--space-12) var(--space-8) var(--space-2);
    text-align: center;
}

.hero__title {
    font-size: 2.8rem;
    font-weight: 800;
    line-height: 1.15;
    color: #333333;
    max-width: 1000px;
    margin: 0 auto var(--space-4);
    letter-spacing: -0.5px;
}

.hero__subtitle {
    font-size: 1.25rem;
    color: #444444;
    max-width: 850px;
    margin: 0 auto var(--space-6);
    line-height: 1.5;
    font-weight: 400;
}

/* ── Category Filter Pills ── */
.filter-pills.filter-pills--mobile {
    display: none;
}

.filter-pills {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: var(--space-3);
    margin-bottom: var(--space-8);
    padding: 0 var(--space-4);
}

.filter-pill {
    padding: var(--space-3) var(--space-6);
    border-radius: var(--radius-full);
    font-size: var(--font-size-sm);
    font-weight: 600;
    border: 2px solid var(--border-light);
    background: var(--bg-card);
    color: var(--text-primary);
    transition: var(--transition-fast);
    cursor: pointer;
    white-space: nowrap;
}

.filter-pill:hover {
    border-color: var(--brand-primary);
    color: var(--brand-primary);
}

.filter-pill.active {
    background: var(--text-primary);
    color: var(--text-inverse);
    border-color: var(--text-primary);
}

/* ============================================
   TOOL CARDS GRID (Homepage)
   ============================================ */
.tools-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: var(--space-5);
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 var(--space-8) var(--space-16);
}

.tool-card {
    background: var(--bg-card);
    border: 1px solid rgba(0,0,0,0.06);
    border-radius: var(--radius-lg);
    padding: var(--space-6) var(--space-6);
    cursor: pointer;
    transition: transform var(--transition-base), box-shadow var(--transition-base), border-color var(--transition-base);
    position: relative;
    overflow: hidden;
    text-align: left;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    box-shadow: 0 4px 12px rgba(0,0,0,0.02);
}

.tool-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 25px rgba(0,0,0,0.06);
    border-color: transparent;
}

.tool-card__icon {
    margin-bottom: var(--space-4);
}

.tool-card__icon svg {
    width: 100%;
    height: 100%;
}

.tool-card__title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: var(--space-2);
}

.tool-card__desc {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

.tool-card__badge {
    position: absolute;
    top: var(--space-2);
    right: var(--space-2);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 9px;
    font-weight: 700;
    background: var(--brand-primary);
    color: white;
    text-transform: uppercase;
}

/* ============================================
   TOOL PAGE — Upload Phase
   ============================================ */
.tool-page {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.tool-header {
    padding: var(--space-16) var(--space-8);
    text-align: center;
    position: relative;
    overflow: hidden;
}

.tool-header::before {
    content: '';
    position: absolute;
    inset: 0;
    opacity: 0.07;
    background: radial-gradient(circle at 20% 80%, currentColor 0%, transparent 60%),
                radial-gradient(circle at 80% 20%, currentColor 0%, transparent 60%);
}

.tool-header__title {
    font-size: var(--font-size-3xl);
    font-weight: 900;
    color: var(--text-inverse);
    margin-bottom: var(--space-4);
    position: relative;
    z-index: 1;
}

.tool-header__desc {
    font-size: var(--font-size-lg);
    color: rgba(255,255,255,0.85);
    max-width: 550px;
    margin: 0 auto var(--space-10);
    line-height: 1.6;
    position: relative;
    z-index: 1;
}

/* ── Upload Area ── */
.upload-area {
    position: relative;
    z-index: 1;
    max-width: 400px;
    margin: 0 auto;
}

.upload-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-3);
    width: 100%;
    padding: var(--space-5) var(--space-10);
    border-radius: var(--radius-full);
    font-size: var(--font-size-lg);
    font-weight: 700;
    color: var(--text-inverse);
    cursor: pointer;
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    position: relative;
    overflow: hidden;
}

.upload-btn:hover {
    transform: scale(1.03);
    box-shadow: 0 6px 25px rgba(0,0,0,0.3);
}

.upload-btn:active {
    transform: scale(0.98);
}

.upload-btn svg {
    width: 24px;
    height: 24px;
    fill: currentColor;
}

.upload-btn input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
    font-size: 0;
}

.upload-hint {
    text-align: center;
    margin-top: var(--space-4);
    font-size: var(--font-size-sm);
    color: rgba(255,255,255,0.6);
}

/* ── Drag-Drop Overlay ── */
.drag-overlay {
    position: fixed;
    inset: 0;
    background: rgba(26, 122, 109, 0.9);
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: var(--space-6);
}

.drag-overlay.active {
    display: flex;
}

.drag-overlay__icon {
    width: 80px;
    height: 80px;
    background: rgba(255,255,255,0.2);
    border-radius: var(--radius-xl);
    display: flex;
    align-items: center;
    justify-content: center;
}

.drag-overlay__icon svg {
    width: 40px;
    height: 40px;
    fill: white;
}

.drag-overlay__text {
    font-size: var(--font-size-xl);
    font-weight: 700;
    color: white;
}

/* ============================================
   TOOL PAGE — Working Phase
   ============================================ */
.work-area {
    flex: 1;
    padding: var(--space-10) var(--space-8);
    max-width: 1100px;
    margin: 0 auto;
    width: 100%;
}

/* ── File List ── */
.file-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
    margin-bottom: var(--space-8);
}

.file-item {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    padding: var(--space-4) var(--space-5);
    background: var(--bg-card);
    border: 1px solid var(--border-card);
    border-radius: var(--radius-md);
    transition: box-shadow var(--transition-fast);
    cursor: grab;
}

.file-item:hover {
    box-shadow: var(--shadow-md);
}

.file-item.dragging {
    opacity: 0.5;
    box-shadow: var(--shadow-lg);
}

.file-item__thumbnail {
    width: 50px;
    height: 65px;
    background: #f0f0f0;
    border-radius: var(--radius-sm);
    overflow: hidden;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-light);
}

.file-item__thumbnail img,
.file-item__thumbnail canvas {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.file-item__info {
    flex: 1;
    min-width: 0;
}

.file-item__name {
    font-size: var(--font-size-base);
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-item__size {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
    margin-top: 2px;
}

.file-item__actions {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.file-item__btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    transition: var(--transition-fast);
}

.file-item__btn:hover {
    background: #fee2e2;
    color: #e53e3e;
}

.file-item__btn svg {
    width: 18px;
    height: 18px;
}

/* ── Add More Files Button ── */
.add-more-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-4);
    border: 2px dashed var(--border-light);
    border-radius: var(--radius-md);
    color: var(--text-muted);
    font-weight: 600;
    font-size: var(--font-size-sm);
    transition: var(--transition-fast);
    cursor: pointer;
    position: relative;
}

.add-more-btn:hover {
    border-color: var(--brand-primary);
    color: var(--brand-primary);
    background: rgba(26, 122, 109, 0.04);
}

.add-more-btn input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

.add-more-btn svg {
    width: 20px;
    height: 20px;
}

/* ── Options Panel ── */
.options-panel {
    background: var(--bg-card);
    border: 1px solid var(--border-card);
    border-radius: var(--radius-lg);
    padding: var(--space-8);
    margin-bottom: var(--space-8);
}

.options-panel__title {
    font-size: var(--font-size-md);
    font-weight: 700;
    margin-bottom: var(--space-6);
    color: var(--text-primary);
}

.option-group {
    margin-bottom: var(--space-6);
}

.option-group:last-child {
    margin-bottom: 0;
}

.option-group__label {
    display: block;
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: var(--space-3);
}

.option-radio-group {
    display: flex;
    gap: var(--space-3);
    flex-wrap: wrap;
}

.option-radio {
    position: relative;
}

.option-radio input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.option-radio label {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-3) var(--space-5);
    border: 2px solid var(--border-light);
    border-radius: var(--radius-md);
    font-size: var(--font-size-sm);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-fast);
    min-width: 100px;
    text-align: center;
}

.option-radio input:checked + label {
    border-color: var(--brand-primary);
    background: rgba(26, 122, 109, 0.08);
    color: var(--brand-primary);
}

.option-radio label:hover {
    border-color: var(--brand-primary);
}

.option-input {
    width: 100%;
    padding: var(--space-3) var(--space-4);
    border: 2px solid var(--border-light);
    border-radius: var(--radius-md);
    font-size: var(--font-size-base);
    transition: var(--transition-fast);
    outline: none;
    background: white;
}

.option-input:focus {
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 3px rgba(26, 122, 109, 0.1);
}

.option-select {
    width: 100%;
    padding: var(--space-3) var(--space-4);
    border: 2px solid var(--border-light);
    border-radius: var(--radius-md);
    font-size: var(--font-size-base);
    transition: var(--transition-fast);
    outline: none;
    background: white;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%234a5568' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

.option-select:focus {
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 3px rgba(26, 122, 109, 0.1);
}

.option-range {
    width: 100%;
    height: 6px;
    appearance: none;
    background: var(--border-light);
    border-radius: 3px;
    outline: none;
}

.option-range::-webkit-slider-thumb {
    appearance: none;
    width: 20px;
    height: 20px;
    background: var(--brand-primary);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

.option-checkbox {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    cursor: pointer;
    font-size: var(--font-size-sm);
    font-weight: 500;
}

.option-checkbox input[type="checkbox"] {
    width: 20px;
    height: 20px;
    accent-color: var(--brand-primary);
    cursor: pointer;
}

/* ── Action Button ── */
.action-bar {
    text-align: center;
    padding: var(--space-8) 0;
}

.action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-3);
    padding: var(--space-5) var(--space-16);
    border-radius: var(--radius-full);
    font-size: var(--font-size-lg);
    font-weight: 700;
    color: var(--text-inverse);
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    min-width: 280px;
}

.action-btn:hover {
    transform: scale(1.03);
    box-shadow: 0 6px 25px rgba(0,0,0,0.3);
}

.action-btn:active {
    transform: scale(0.98);
}

.action-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.action-btn svg {
    width: 22px;
    height: 22px;
    fill: currentColor;
}

/* ============================================
   TOOL PAGE — Processing Phase
   ============================================ */
.processing-overlay {
    position: fixed;
    inset: 0;
    background: rgba(255,255,255,0.95);
    backdrop-filter: blur(10px);
    z-index: 5000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-8);
}

.processing-spinner {
    width: 64px;
    height: 64px;
    border: 4px solid var(--border-light);
    border-top-color: var(--brand-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.processing-text {
    font-size: var(--font-size-xl);
    font-weight: 700;
    color: var(--text-primary);
}

.processing-subtext {
    font-size: var(--font-size-base);
    color: var(--text-secondary);
}

.progress-bar {
    width: 300px;
    height: 6px;
    background: var(--border-light);
    border-radius: 3px;
    overflow: hidden;
}

.progress-bar__fill {
    height: 100%;
    background: var(--brand-primary);
    border-radius: 3px;
    transition: width var(--transition-base);
    width: 0%;
}

/* ============================================
   TOOL PAGE — Download / Complete Phase
   ============================================ */
.download-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-16) var(--space-8);
    text-align: center;
}

.download-area__checkmark {
    width: 100px;
    height: 100px;
    background: var(--brand-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: var(--space-8);
    animation: scaleIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes scaleIn {
    from { transform: scale(0); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.download-area__checkmark svg {
    width: 50px;
    height: 50px;
    stroke: white;
    fill: none;
}

.download-area__title {
    font-size: var(--font-size-2xl);
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: var(--space-4);
}

.download-area__subtitle {
    font-size: var(--font-size-base);
    color: var(--text-secondary);
    margin-bottom: var(--space-10);
}

.download-btn {
    display: inline-flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-5) var(--space-12);
    background: var(--brand-primary);
    color: var(--text-inverse);
    border-radius: var(--radius-full);
    font-size: var(--font-size-lg);
    font-weight: 700;
    transition: var(--transition-fast);
    box-shadow: 0 4px 15px rgba(26, 122, 109, 0.3);
    margin-bottom: var(--space-6);
}

.download-btn:hover {
    transform: scale(1.03);
    box-shadow: 0 6px 25px rgba(26, 122, 109, 0.4);
}

.download-btn svg {
    width: 22px;
    height: 22px;
    fill: currentColor;
}

.download-actions {
    display: flex;
    gap: var(--space-4);
    align-items: center;
}

.download-action-btn {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-5);
    border: 2px solid var(--border-light);
    border-radius: var(--radius-full);
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--text-secondary);
    transition: var(--transition-fast);
}

.download-action-btn:hover {
    border-color: var(--brand-primary);
    color: var(--brand-primary);
}

.download-action-btn svg {
    width: 18px;
    height: 18px;
}

/* ============================================
   FOOTER
   ============================================ */
.footer {
    background: var(--bg-footer);
    color: rgba(255,255,255,0.7);
    padding: var(--space-16) var(--space-8) var(--space-8);
}

.footer__inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: var(--space-8);
    margin-bottom: var(--space-12);
}

.footer__tools {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-4);
    align-content: start;
    width: 100%;
}

.footer__brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-4);
}

.footer__logo-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: var(--space-2);
}

.nav__search-btn {
    margin-left: var(--space-3);
}

.footer__logo-icon {
    width: 72px;
    height: 72px;
    object-fit: contain;
}

.footer__logo-text {
    font-size: 2.2rem;
    font-weight: 900;
    letter-spacing: -1.5px;
    white-space: nowrap;
}

.footer__logo-text .love {
    color: #ffffff;
}

.footer__logo-text .swap,
.footer__logo-text .pdf-label {
    color: var(--brand-primary-light);
}

.footer__tagline {
    font-size: var(--font-size-sm);
    color: rgba(255,255,255,0.5);
    line-height: 1.6;
}

.footer__col-title {
    font-size: var(--font-size-sm);
    font-weight: 700;
    color: white;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: var(--space-5);
}

.footer__link {
    display: block;
    padding: var(--space-2) 0;
    font-size: var(--font-size-sm);
    color: rgba(255,255,255,0.6);
    transition: var(--transition-fast);
}

.footer__link:hover {
    color: white;
}

.footer__bottom {
    max-width: 1200px;
    margin: 0 auto;
    padding-top: var(--space-8);
    border-top: 1px solid rgba(255,255,255,0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: var(--font-size-xs);
    color: rgba(255,255,255,0.4);
}

/* ============================================
   PAGE THUMBNAIL GRID (for organize/rotate/remove)
   ============================================ */
.page-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: var(--space-5);
    margin-bottom: var(--space-8);
}

.page-thumb {
    position: relative;
    background: var(--bg-card);
    border: 2px solid var(--border-card);
    border-radius: var(--radius-md);
    padding: var(--space-3);
    cursor: pointer;
    transition: var(--transition-fast);
    user-select: none;
}

.page-thumb:hover {
    border-color: var(--brand-primary);
    box-shadow: var(--shadow-md);
}

.page-thumb.selected {
    border-color: var(--brand-primary);
    background: rgba(26, 122, 109, 0.05);
}

.page-thumb.dragging {
    opacity: 0.5;
    transform: rotate(3deg);
}

.page-thumb__canvas {
    width: 100%;
    aspect-ratio: 0.707;
    background: #f5f5f5;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    margin-bottom: var(--space-2);
}

.page-thumb__canvas canvas,
.page-thumb__canvas img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.page-thumb__number {
    text-align: center;
    font-size: var(--font-size-xs);
    font-weight: 600;
    color: var(--text-secondary);
}

.page-thumb__check {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--brand-primary);
    color: white;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
}

.page-thumb.selected .page-thumb__check {
    display: flex;
}

.page-thumb__rotate-btns {
    position: absolute;
    bottom: 32px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: var(--space-1);
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.page-thumb:hover .page-thumb__rotate-btns {
    opacity: 1;
}

.page-thumb__rotate-btn {
    width: 28px;
    height: 28px;
    background: rgba(0,0,0,0.7);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    transition: var(--transition-fast);
}

.page-thumb__rotate-btn:hover {
    background: var(--brand-primary);
}

.page-thumb__delete {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: rgba(220, 38, 38, 0.9);
    color: white;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: var(--transition-fast);
}

.page-thumb:hover .page-thumb__delete {
    display: flex;
}

/* ============================================
   EDIT PDF CANVAS
   ============================================ */
.edit-canvas-container {
    position: relative;
    background: transparent;
    border-radius: var(--radius-lg);
    overflow: hidden;
    margin-bottom: var(--space-6);
}

.edit-toolbar {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-4);
    background: var(--bg-card);
    border: 1px solid var(--border-card);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-4);
    flex-wrap: wrap;
}

.edit-toolbar__btn {
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-sm);
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--text-secondary);
    transition: var(--transition-fast);
    display: flex;
    align-items: center;
    gap: var(--space-1);
}

.edit-toolbar__btn:hover,
.edit-toolbar__btn.active {
    background: rgba(26, 122, 109, 0.1);
    color: var(--brand-primary);
}

.edit-toolbar__separator {
    width: 1px;
    height: 24px;
    background: var(--border-light);
    margin: 0 var(--space-2);
}

.edit-toolbar__color {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid var(--border-light);
    cursor: pointer;
    padding: 0;
    overflow: hidden;
}

.edit-toolbar__color input[type="color"] {
    width: 40px;
    height: 40px;
    margin: -6px;
    border: none;
    cursor: pointer;
}

/* ============================================
   TOAST NOTIFICATIONS
   ============================================ */
.toast-container {
    position: fixed;
    bottom: var(--space-8);
    right: var(--space-8);
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.toast {
    padding: var(--space-4) var(--space-6);
    border-radius: var(--radius-md);
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: white;
    box-shadow: var(--shadow-lg);
    animation: slideInRight 0.3s ease;
    display: flex;
    align-items: center;
    gap: var(--space-3);
    max-width: 400px;
}

@keyframes slideInRight {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

.toast--success { background: #38a169; }
.toast--error { background: #e53e3e; }
.toast--info { background: #3182ce; }
.toast--warning { background: #dd6b20; }

.toast__close {
    margin-left: auto;
    color: rgba(255,255,255,0.8);
    font-size: 18px;
    cursor: pointer;
}

/* ============================================
   CROP OVERLAY
   ============================================ */
.crop-container {
    position: relative;
    display: inline-block;
    margin: 0 auto;
}

.crop-box {
    position: absolute;
    border: 2px dashed var(--brand-primary);
    background: rgba(26, 122, 109, 0.1);
    cursor: move;
}

.crop-handle {
    position: absolute;
    width: 12px;
    height: 12px;
    background: var(--brand-primary);
    border: 2px solid white;
    border-radius: 50%;
}

.crop-handle--nw { top: -6px; left: -6px; cursor: nw-resize; }
.crop-handle--ne { top: -6px; right: -6px; cursor: ne-resize; }
.crop-handle--sw { bottom: -6px; left: -6px; cursor: sw-resize; }
.crop-handle--se { bottom: -6px; right: -6px; cursor: se-resize; }

/* ============================================
   WATERMARK PREVIEW
   ============================================ */
.watermark-preview {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f0f0f0;
    border-radius: var(--radius-lg);
    overflow: hidden;
    margin-bottom: var(--space-6);
    min-height: 400px;
}

.watermark-text-overlay {
    position: absolute;
    font-size: 3rem;
    font-weight: 700;
    color: rgba(0,0,0,0.15);
    transform: rotate(-30deg);
    pointer-events: none;
    white-space: nowrap;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 1200px) {
    .tools-grid {
        grid-template-columns: repeat(4, 1fr);
    }
    .dropdown--all-tools {
        width: 700px;
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 1024px) {
    .footer__logo-text {
        font-size: 1.8rem; /* Prevent overflow on mid-size screens */
    }
    .tools-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    .footer__inner {
        display: flex;
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: var(--space-8);
    }
    .footer__tools {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: var(--space-4);
        width: 100%;
    }
    .nav__links {
        display: none;
    }
    .nav__hamburger {
        display: flex;
    }
}

@media (max-width: 768px) {
    :root {
        --font-size-hero: 2rem;
        --font-size-3xl: 1.75rem;
        --font-size-2xl: 1.5rem;
    }

    body {
        padding-bottom: 70px; /* Space for bottom tab bar */
    }

    /* Logo flush left on mobile and shrink to prevent overlap */
    .nav {
        padding: env(safe-area-inset-top) var(--space-3) 0;
    }

    .nav__logo-text {
        font-size: 1.3rem; /* Shrink logo text on mobile to fit */
    }

    .nav__logo-icon {
        width: 36px !important;
        height: 36px !important;
    }

    .mobile-nav-overlay {
        display: block;
        pointer-events: none;
        opacity: 0;
        transition: opacity var(--transition-base);
    }

    .mobile-nav-overlay.show {
        pointer-events: auto;
        opacity: 1;
    }

    .mobile-nav {
        display: block;
    }

    /* ── iLovePDF-style 3-column grid ── */
    .tools-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: var(--space-3);
        padding: 0 var(--space-3) var(--space-6);
    }

    .tool-card {
        padding: var(--space-4) var(--space-2);
        text-align: center;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: flex-start;
        gap: var(--space-2);
        border-radius: var(--radius-lg);
        min-height: auto;
    }

    .tool-card__badge {
        top: 2px;
        right: 2px;
        padding: 0px 2px;
        font-size: 6px;
        border-radius: 2px;
        transform: scale(0.7);
        transform-origin: top right;
    }

    .tool-card__icon {
        margin-bottom: 0;
        width: 48px;
        height: 48px;
    }

    .tool-card__icon > div {
        width: 48px !important;
        height: 48px !important;
        border-radius: 12px !important;
    }

    .tool-card__icon svg {
        width: 48px;
        height: 48px;
    }

    .tool-card__title {
        font-size: 11px;
        font-weight: 600;
        margin-bottom: 0;
        line-height: 1.3;
        color: var(--text-primary);
    }

    /* Hide descriptions on mobile — icon + name only */
    .tool-card__desc {
        display: none;
    }

    /* Compact hero */
    .hero {
        padding: var(--space-4) var(--space-4) var(--space-2);
    }

    .hero__title {
        display: none; /* Hide big title on mobile */
    }

    .hero__subtitle {
        display: block !important;
        font-size: var(--font-size-sm);
        line-height: 1.5;
        color: var(--text-secondary);
        text-align: center;
        margin-bottom: var(--space-2);
        padding: 0 var(--space-2);
    }

    .filter-pills--desktop {
        display: none !important;
    }

    .filter-pills--mobile {
        display: flex !important;
        justify-content: center;
        gap: var(--space-3);
        margin-bottom: var(--space-4);
        padding: 0 var(--space-4);
        flex-wrap: nowrap;
    }

    .filter-pills--mobile .filter-pill {
        font-size: 12px;
        padding: var(--space-2) var(--space-3);
    }

    .tool-header {
        padding: var(--space-10) var(--space-4);
    }

    .work-area {
        padding: var(--space-6) var(--space-4);
    }

    /* Hide footer on mobile homepage (bottom tab replaces it) */
    .footer {
        display: none;
    }

    .tool-page ~ .footer {
        display: block;
    }

    .footer__inner {
        display: flex;
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: var(--space-8);
    }

    .footer__logo-text {
        font-size: 2.0rem; /* Increase size to match Android preference */
    }

    .footer__brand {
        grid-column: 1 / -1; /* Span full width */
    }

    .footer__tools {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: var(--space-4) var(--space-2);
        width: 100%;
    }

    .footer__bottom {
        flex-direction: column;
        gap: var(--space-4);
        text-align: center;
    }

    .page-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: var(--space-3);
    }

    .dropdown--convert,
    .dropdown--all-tools {
        position: fixed;
        inset: var(--nav-height) 0 0 0;
        width: 100%;
        border-radius: 0;
        overflow-y: auto;
        grid-template-columns: 1fr;
    }

    .options-panel {
        padding: var(--space-5);
    }

    .action-btn {
        min-width: 200px;
        padding: var(--space-4) var(--space-8);
    }

    .download-area {
        padding: var(--space-10) var(--space-4);
    }
}

@media (max-width: 480px) {
    .tools-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: var(--space-2);
        padding: 0 var(--space-2) var(--space-6);
    }

    .tool-card {
        padding: var(--space-3) var(--space-1);
    }

    .tool-card__icon {
        width: 42px;
        height: 42px;
    }

    .tool-card__icon > div {
        width: 42px !important;
        height: 42px !important;
        border-radius: 10px !important;
    }

    .tool-card__icon svg {
        width: 42px;
        height: 42px;
    }

    .tool-card__title {
        font-size: 10px;
    }

    .option-radio-group {
        flex-direction: column;
    }

    .edit-toolbar {
        overflow-x: auto;
        flex-wrap: nowrap;
    }
}

/* ============================================
   BOTTOM TAB BAR (Mobile App-Style)
   ============================================ */
.bottom-tab-bar {
    display: none; /* Hidden on desktop */
}

@media (max-width: 768px) {
    .bottom-tab-bar {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        height: 64px;
        background: #ffffff;
        border-top: 1px solid var(--border-light);
        z-index: 9000;
        align-items: center;
        justify-content: space-around;
        padding: 0 var(--space-2);
        box-shadow: 0 -2px 10px rgba(0,0,0,0.06);
    }

    @supports (padding-bottom: env(safe-area-inset-bottom)) {
        .bottom-tab-bar {
            padding-bottom: env(safe-area-inset-bottom);
            height: calc(64px + env(safe-area-inset-bottom));
        }
        body {
            padding-bottom: calc(70px + env(safe-area-inset-bottom));
        }
    }

    .bottom-tab {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 2px;
        background: none;
        border: none;
        padding: var(--space-1) var(--space-2);
        cursor: pointer;
        color: var(--text-muted);
        transition: var(--transition-fast);
        -webkit-tap-highlight-color: transparent;
        min-width: 56px;
    }

    .bottom-tab svg {
        width: 22px;
        height: 22px;
        stroke-width: 1.8;
    }

    .bottom-tab span {
        font-size: 10px;
        font-weight: 600;
        letter-spacing: 0.2px;
    }

    .bottom-tab--active {
        color: var(--brand-primary);
    }

    .bottom-tab--active svg {
        stroke-width: 2.2;
    }

    /* Center "Tools" tab with elevated icon */
    .bottom-tab--center .bottom-tab__icon-wrap {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 44px;
        height: 44px;
        border-radius: 50%;
        background: linear-gradient(135deg, var(--brand-primary), var(--brand-primary-light));
        color: white;
        margin-top: -16px;
        box-shadow: 0 4px 12px rgba(26, 122, 109, 0.35);
    }

    .bottom-tab--center .bottom-tab__icon-wrap svg {
        stroke: white;
        width: 20px;
        height: 20px;
    }

    .bottom-tab--center span {
        margin-top: 0;
    }
}

/* ============================================
   UTILITY CLASSES
   ============================================ */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

.text-center { text-align: center; }
.mt-4 { margin-top: var(--space-4); }
.mt-8 { margin-top: var(--space-8); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-8 { margin-bottom: var(--space-8); }

/* ── Safe area padding for mobile ── */
@supports (padding-top: env(safe-area-inset-top)) {
    .nav {
        padding-top: env(safe-area-inset-top);
        height: calc(var(--nav-height) + env(safe-area-inset-top));
    }
    .footer {
        padding-bottom: calc(var(--space-8) + env(safe-area-inset-bottom));
    }
}

/* ── Loading skeleton ── */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 37%, #f0f0f0 63%);
    background-size: 400% 100%;
    animation: shimmer 1.4s ease infinite;
    border-radius: var(--radius-sm);
}

@keyframes shimmer {
    0% { background-position: 100% 50%; }
    100% { background-position: 0 50%; }
}

/* ── Print styles ── */
@media print {
    .nav, .footer, .upload-area, .action-bar {
        display: none !important;
    }
}

/* ============================================
   SEARCH BUTTON & MODAL
   ============================================ */
.nav__search-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition-fast);
}

.nav__search-btn:hover {
    background: var(--bg-secondary);
    color: var(--brand-primary);
}

.search-modal {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: none;
    align-items: flex-start;
    justify-content: center;
    padding-top: 80px;
}

.search-modal.show {
    display: flex;
}

.search-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.search-modal__content {
    position: relative;
    width: 90%;
    max-width: 580px;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    animation: searchSlideIn 0.2s ease;
}

@keyframes searchSlideIn {
    from { opacity: 0; transform: translateY(-20px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.search-modal__header {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-4) var(--space-5);
    border-bottom: 1px solid var(--border-light);
}

.search-modal__input {
    flex: 1;
    border: none;
    outline: none;
    font-size: var(--font-size-base);
    font-family: var(--font-family);
    background: transparent;
    color: var(--text-primary);
}

.search-modal__input::placeholder {
    color: var(--text-muted);
}

.search-modal__close {
    width: 32px;
    height: 32px;
    border: none;
    background: var(--bg-secondary);
    border-radius: var(--radius-full);
    font-size: 18px;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-fast);
}

.search-modal__close:hover {
    background: var(--border-light);
    color: var(--text-primary);
}

.search-modal__results {
    max-height: 400px;
    overflow-y: auto;
    padding: var(--space-3);
}

.search-modal__hint {
    text-align: center;
    padding: var(--space-8);
    color: var(--text-muted);
    font-size: var(--font-size-sm);
}

.search-modal__result {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-md);
    text-decoration: none;
    color: var(--text-primary);
    transition: var(--transition-fast);
}

.search-modal__result:hover {
    background: var(--bg-secondary);
}

.search-modal__result-icon {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
}

.search-modal__result-icon > div {
    width: 44px !important;
    height: 44px !important;
    border-radius: 10px !important;
}

.search-modal__result-icon svg {
    width: 44px;
    height: 44px;
}

.search-modal__result-info {
    flex: 1;
    min-width: 0;
}

.search-modal__result-name {
    font-weight: 600;
    font-size: var(--font-size-sm);
    margin-bottom: 2px;
}

.search-modal__result-desc {
    font-size: 12px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

@media (max-width: 768px) {
    .search-modal {
        padding-top: 20px;
    }
    .search-modal__content {
        width: 95%;
    }
    .search-modal__results {
        max-height: 60vh;
    }
}

/* ============================================
   BACK BUTTON (Mobile Tool Pages)
   ============================================ */
.nav__back-btn {
    display: none;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: none;
    background: transparent;
    color: var(--text-primary);
    cursor: pointer;
    border-radius: var(--radius-full);
    transition: var(--transition-fast);
    flex-shrink: 0;
}

.nav__back-btn:hover {
    background: var(--bg-secondary);
}

/* Show back button on mobile when on a tool page */
@media (max-width: 768px) {
    .nav--tool-page .nav__back-btn {
        display: flex;
    }
}


/* Dropdowns for Edit Toolbar */
.edit-shapes-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: var(--space-2);
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    padding: var(--space-2);
    display: none;
    flex-direction: column;
    gap: var(--space-1);
    z-index: 100;
    min-width: 140px;
}
.edit-shapes-dropdown.show {
    display: flex;
}
.edit-shapes-dropdown__item {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-sm);
    font-size: var(--font-size-sm);
    color: var(--text-primary);
    cursor: pointer;
    background: transparent;
    border: none;
    text-align: left;
    width: 100%;
}
.edit-shapes-dropdown__item:hover, .edit-shapes-dropdown__item.active {
    background: rgba(26,122,109,0.1);
    color: var(--brand-primary);
}

.edit-color-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: var(--space-2);
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    padding: var(--space-3);
    display: none;
    flex-wrap: wrap;
    gap: var(--space-2);
    z-index: 100;
    width: 180px;
}
.edit-color-dropdown.show {
    display: flex;
}
.edit-color-swatch {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    transition: transform 0.2s;
}
.edit-color-swatch:hover {
    transform: scale(1.1);
}
.edit-color-swatch.active {
    box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--brand-primary);
}
.edit-toolbar__color {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    overflow: hidden;
    cursor: pointer;
    border: 1px solid var(--border-light);
}
.edit-toolbar__color input {
    width: 150%;
    height: 150%;
    margin: -25%;
    cursor: pointer;
}

/* Text Box Annotations */
.edit-text-box {
    position: absolute;
    min-width: 150px;
    background: rgba(255,255,255,0.9);
    border: 2px dashed var(--brand-primary);
    padding: var(--space-2);
    cursor: text;
    z-index: 50;
    pointer-events: auto;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    border-radius: var(--radius-sm);
}
.edit-text-box__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
    background: var(--brand-primary);
    color: white;
    padding: 2px 6px;
    border-radius: 2px;
    cursor: move;
}
.edit-text-box__drag-handle {
    font-size: 10px;
    font-weight: 600;
}
.edit-text-box__close {
    background: transparent;
    border: none;
    color: white;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
}
.edit-text-box__input {
    width: 100%;
    min-height: 40px;
    background: transparent;
    border: none;
    outline: none;
    resize: none;
    font-family: inherit;
    line-height: 1.2;
}
.edit-text-box__resize {
    position: absolute;
    bottom: -5px;
    right: -5px;
    width: 12px;
    height: 12px;
    background: var(--brand-primary);
    cursor: se-resize;
    border-radius: 50%;
}
