/* ================================================
   FileKitPro — Common Styles v4 (inspired by modern SaaS)
   Updated: palette, buttons, cards, glass effects
   Retains: tool page layouts, thumbnails, pagination, modals,
            processing overlay, Tailwind replacements
   ================================================ */

/* ----- CSS Variables (updated palette) ----- */
:root {
    --color-brand: #4d65ff;
    --color-brand-hover: #3d55ef;
    --color-brand-light: #6b7dff;
    --color-brand-lightest: rgba(77, 101, 255, 0.08);
    
    /* New neutral palette */
    --background-gray-main: #f8f8f7;
    --background-menu-white: #ffffff;
    --text-primary: #1a1a2e;
    --text-secondary: #555770;
    --text-tertiary: #8888a0;
    --text-on-dark: #ffffff;
    --text-disabled: #9ca3af;
    --border-main: rgba(0, 0, 0, 0.08);
    --border-light: rgba(0, 0, 0, 0.05);
    --border-hover: rgba(0, 0, 0, 0.12);
    --fill-tsp-white-light: rgba(0, 0, 0, 0.04);
    --fill-tsp-white-main: rgba(0, 0, 0, 0.06);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.08);
    
    --Button-black: #1a1a2e;
    --text-onblack: #ffffff;
    --logo-color: #1a1a2e;

    /* Page specific variables (unchanged) */
    --thumb-selected-color: #4d65ff;
    --thumb-range-color: rgba(77, 101, 255, 0.5);
    --badge-bg: rgba(77, 101, 255, 0.08);
    --badge-color: var(--color-brand);
    --badge-border: rgba(77, 101, 255, 0.2);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    background: var(--background-gray-main);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.font-serif {
    font-family: 'Georgia', 'Times New Roman', serif;
}

/* Text baseline alignment (unchanged) */
:is(h1, h2, h3, h4, h5, h6, p, .u-text-style-) {
    display: flow-root;
    user-select: text;
}
:is(h1, h2, h3, h4, h5, h6, p, .u-text-style-)::before {
    content: "";
    display: table;
    margin-bottom: calc(-0.5lh + 0.36em);
    user-select: none;
}
:is(h1, h2, h3, h4, h5, h6, p, .u-text-style-)::after {
    content: "";
    display: table;
    margin-bottom: calc(-0.5lh + 0.41em);
    user-select: none;
}

/* ----- Site Header (modern, glass) ----- */
.site-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border-bottom: 1px solid var(--border-light);
    transition: border-color 0.3s;
}

/* ----- Brand Button (primary) ----- */
.btn-brand {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.5rem 1.25rem;
    border-radius: 9999px;      /* fully rounded */
    font-weight: 600;
    font-size: 0.875rem;
    background: var(--Button-black);
    color: var(--text-onblack);
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    box-shadow: var(--shadow-sm);
    white-space: nowrap;
}
.btn-brand:hover {
    background: #2a2a3e;        /* slightly lighter on hover */
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}
.btn-brand:active {
    transform: translateY(0);
    box-shadow: none;
}

/* ----- Upgrade Button (dark, matches brand scheme) ----- */
.btn-upgrade {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.55rem 1.3rem;
    border-radius: 0.75rem;
    font-weight: 600;
    font-size: 0.9rem;
    background: var(--Button-black, #1a1a2e);
    color: var(--text-onblack, #ffffff);
    border: none;
    cursor: pointer;
    transition: all 0.25s;
    text-decoration: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}
.btn-upgrade:hover {
    background: #2a2a3e;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
    transform: translateY(-1px);
}

/* ----- Pro Badge ----- */
.pro-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.3rem 0.8rem;
    border-radius: 9999px;
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    color: #1e1b4b;
    font-weight: 700;
    font-size: 0.8rem;
    letter-spacing: 0.02em;
}

/* ----- User Menu (avatar + dropdown) ----- */
.user-menu-wrapper {
    position: relative;
    display: inline-flex;
    align-items: center;
}
.user-avatar-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: 2px solid var(--border-main);
    background: #ffffff;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.25, 0.8, 0.25, 1);
    font-size: 1.25rem;
    position: relative;
    outline: none;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
}
.user-avatar-btn:hover {
    border-color: var(--border-hover);
    color: var(--color-brand);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.1);
    transform: translateY(-1px);
    background: #fafafd;
}
.user-avatar-btn:active {
    transform: translateY(0);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
}
.user-avatar-btn.dropdown-open {
    border-color: var(--color-brand);
    color: var(--color-brand);
    background: var(--color-brand-lightest);
    box-shadow: 0 2px 12px rgba(77, 101, 255, 0.18);
}
.user-avatar-initial {
    font-weight: 700;
    font-size: 1rem;
    letter-spacing: 0.02em;
    line-height: 1;
    text-transform: uppercase;
    user-select: none;
}
.user-dropdown {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    min-width: 280px;
    max-width: calc(100vw - 2rem);
    background: #ffffff;
    border: 1px solid var(--border-main);
    border-radius: 1rem;
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.06);
    padding: 0;
    z-index: 60;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px) scale(0.96);
    transition: all 0.22s cubic-bezier(0.25, 0.8, 0.25, 1.2);
    pointer-events: none;
    overflow: hidden;
}
.user-dropdown.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}
.user-dropdown::before {
    content: "";
    position: absolute;
    top: -7px;
    right: 18px;
    width: 14px;
    height: 14px;
    background: #ffffff;
    border-left: 1px solid var(--border-main);
    border-top: 1px solid var(--border-main);
    transform: rotate(45deg);
    border-radius: 2px 0 0 0;
}
.user-dropdown-header {
    padding: 1rem 1.2rem 0.75rem;
    border-bottom: 1px solid var(--border-main);
}
.user-dropdown-email {
    font-size: 0.85rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    word-break: break-all;
}
.user-dropdown-email i {
    color: var(--color-brand);
    font-size: 0.95rem;
    flex-shrink: 0;
}
.user-dropdown-subscription {
    padding: 0.75rem 1.2rem;
    border-bottom: 1px solid var(--border-main);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem;
}
.user-dropdown-subscription .pro-badge {
    font-size: 0.75rem;
    padding: 0.25rem 0.7rem;
}
.user-dropdown-subscription .pro-info {
    font-size: 0.7rem;
    color: #92400e;
    font-weight: 500;
    white-space: nowrap;
}
.user-dropdown-subscription .btn-upgrade-sm {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.4rem 1rem;
    border-radius: 0.6rem;
    font-weight: 600;
    font-size: 0.78rem;
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #fff;
    border: none;
    cursor: pointer;
    transition: all 0.25s;
    text-decoration: none;
    white-space: nowrap;
}
.user-dropdown-subscription .btn-upgrade-sm:hover {
    background: linear-gradient(135deg, #f59e0b, #b45309);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.12);
    transform: translateY(-1px);
}
.free-plan-label {
    font-size: 0.78rem;
    color: var(--text-tertiary);
    font-weight: 500;
}
.user-dropdown-actions {
    padding: 0.5rem 0.6rem;
}
.user-dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    width: 100%;
    padding: 0.65rem 0.8rem;
    border-radius: 0.6rem;
    border: none;
    background: transparent;
    color: var(--text-primary);
    font-size: 0.88rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    font-family: inherit;
    text-align: left;
    white-space: nowrap;
}
.user-dropdown-item:hover {
    background: #f5f5fa;
    color: var(--color-brand);
}
.user-dropdown-item i {
    font-size: 1rem;
    width: 1.2rem;
    text-align: center;
    flex-shrink: 0;
}
.user-dropdown-item.logout-item {
    color: #e0555a;
}
.user-dropdown-item.logout-item:hover {
    background: #fef2f2;
    color: #d14343;
}

/* ----- Glass Card (common base) ----- */
.glass-card {
    background: #ffffff;
    border: 1px solid var(--border-main);
    border-radius: 1.1rem;
    padding: 1.4rem;
    transition: all 0.35s cubic-bezier(0.25, 0.8, 0.25, 1);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
}
.glass-card:hover {
    transform: translateY(-2px);
    border-color: var(--border-hover);
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.08);
    background: #fafafd;
}

/* ----- Auth Modal (shared between all pages) ----- */
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 999;
    background: rgba(0,0,0,0.45);
    backdrop-filter: blur(6px);
    transition: opacity 0.25s;
}
.modal-card {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1000;
    width: 92%;
    max-width: 480px;
    max-height: 80vh;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.2);
    display: flex;
    flex-direction: column;
    animation: modalIn 0.25s ease;
    overflow: hidden;
}
@keyframes modalIn {
    from { opacity: 0; transform: translate(-50%, -48%); }
    to { opacity: 1; transform: translate(-50%, -50%); }
}
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 1.5rem 0.5rem;
    flex-shrink: 0;
}
.modal-title {
    font-size: 1.4rem;
    font-weight: 700;
    background: linear-gradient(135deg, #4d65ff, #6b7dff);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}
.modal-close-btn {
    background: none;
    border: none;
    font-size: 1.4rem;
    color: #888;
    cursor: pointer;
    transition: color 0.2s;
}
.modal-close-btn:hover { color: #222; }
.modal-body {
    padding: 1.5rem;
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}
.modal-body #auth-loader {
    margin: auto;
}
.modal-body #auth-iframe {
    width: 100%;
    height: 100%;
    border: none;
}

/* ----- Selection & Scrollbar ----- */
::selection {
    background: var(--color-brand);
    color: #fff;
}
::-webkit-scrollbar {
    width: 5px;
    height: 5px;
}
::-webkit-scrollbar-track {
    background: #f0f0f3;
}
::-webkit-scrollbar-thumb {
    background: #c5c5d5;
    border-radius: 8px;
}
::-webkit-scrollbar-thumb:hover {
    background: #a0a0b5;
}

/* ----- Footer Link ----- */
footer a {
    transition: color 0.25s;
}
footer a:hover {
    color: var(--color-brand);
}

/* =============================================
   Shared Tool Page Styles (convert, decrypt, etc.)
   ============================================= */

/* Upload zone */
.upload-zone {
    border: 2px dashed rgba(77, 101, 255, 0.35);
    border-radius: 1.5rem;
    cursor: pointer;
    transition: all 0.3s;
    background: #ffffff;
}
.upload-zone:hover, .upload-zone.drag-over {
    border-color: rgba(77, 101, 255, 0.6);
    background: rgba(77, 101, 255, 0.04);
    box-shadow: 0 0 24px -6px rgba(77, 101, 255, 0.12);
}
.upload-zone.has-files, .upload-zone.has-file {
    border-style: solid;
    border-color: rgba(16, 185, 129, 0.4);
    background: rgba(16, 185, 129, 0.02);
}

/* Primary button */
.btn-primary {
    background: var(--color-brand);
    color: #fff;
    border: none;
    padding: 0.75rem 2rem;
    border-radius: 3rem;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
    transition: all 0.25s;
}
.btn-primary:hover {
    background: var(--color-brand-hover);
    transform: translateY(-1px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
}
.btn-primary:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
    filter: grayscale(10%);
}

/* Outline button */
.btn-outline {
    background: transparent;
    color: var(--text-secondary);
    border: 1.5px solid rgba(77, 101, 255, 0.4);
    padding: 0.6rem 1.4rem;
    border-radius: 3rem;
    font-weight: 500;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.25s;
    white-space: nowrap;
}
.btn-outline:hover {
    border-color: var(--color-brand);
    color: var(--color-brand);
    background: var(--color-brand-lightest);
}
.btn-sm { padding: 0.4rem 1rem; font-size: 0.78rem; border-radius: 2rem; }
.btn-xs { padding: 0.3rem 0.7rem; font-size: 0.7rem; border-radius: 1.5rem; }

/* Danger buttons */
.btn-danger-outline {
    background: transparent;
    color: #e0555a;
    border: 1.5px solid rgba(224, 85, 90, 0.4);
    padding: 0.6rem 1.4rem;
    border-radius: 3rem;
    font-weight: 500;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.25s;
}
.btn-danger-outline:hover {
    border-color: #d14343;
    color: #d14343;
    background: rgba(224, 85, 90, 0.06);
}
.btn-danger-solid {
    background: linear-gradient(135deg, #e0555a, #d14343);
    color: #fff;
    border: none;
    padding: 0.65rem 1.5rem;
    border-radius: 3rem;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
    transition: all 0.25s;
}
.btn-danger-solid:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
}
.btn-danger-solid:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
    filter: grayscale(10%);
}

/* Form inputs & select */
input[type="text"], input[type="email"], input[type="password"], select {
    background: #ffffff;
    border: 1px solid var(--border-main);
    color: var(--text-primary);
    border-radius: 0.75rem;
    padding: 0.7rem 1rem;
    font-family: 'Inter', sans-serif;
    font-size: 0.9rem;
    width: 100%;
    outline: none;
    transition: all 0.2s;
}
input[type="text"]:focus, input[type="email"]:focus, input[type="password"]:focus, select:focus {
    border-color: var(--color-brand);
    box-shadow: 0 0 0 3px rgba(77, 101, 255, 0.15);
}
input[type="text"]::placeholder, input[type="email"]::placeholder, input[type="password"]::placeholder {
    color: #9ca3af;
}
select {
    appearance: none;
    -webkit-appearance: none;
    -moz-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='%234d65ff' d='M6 8.825a.5.5 0 0 1-.354-.146l-4-4a.5.5 0 0 1 .708-.708L6 7.617l3.646-3.646a.5.5 0 0 1 .708.708l-4 4A.5.5 0 0 1 6 8.825z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.85rem center;
    background-size: 12px 12px;
    padding-right: 2.5rem;
}
select option { background: #fff; color: var(--text-primary); }
select:disabled { opacity: 0.45; cursor: not-allowed; filter: grayscale(10%); }

/* File list item */
.file-list-item {
    background: var(--background-menu-white);
    border: 1px solid var(--border-main);
    border-radius: 0.85rem;
    transition: all 0.2s;
}
.file-list-item:hover {
    background: #fafafd;
    border-color: var(--border-hover);
}

/* Progress bar */
.progress-bar-track {
    height: 6px;
    background: var(--background-gray-main);
    border-radius: 10px;
    overflow: hidden;
}
.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--color-brand), var(--color-brand-light));
    border-radius: 10px;
    transition: width 0.3s;
}

/* Toast notification */
.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(120px);
    background: #ffffff;
    border: 1px solid var(--border-main);
    color: var(--text-primary);
    padding: 0.85rem 1.6rem;
    border-radius: 3rem;
    font-weight: 500;
    font-size: 0.9rem;
    z-index: 1000;
    transition: transform 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 12px 30px -8px rgba(0, 0, 0, 0.15);
    pointer-events: none;
}
.toast.show { transform: translateX(-50%) translateY(0); }
.toast.error { border-color: rgba(224, 85, 90, 0.5); background: #fff5f5; color: #b91c1c; }
.toast.success { border-color: rgba(16, 185, 129, 0.5); background: #f0fdf6; color: #065f46; }
.toast.warning { border-color: rgba(245, 158, 11, 0.5); background: #fffbeb; color: #92400e; }

/* Spinner */
.spinner {
    display: inline-block;
    width: 22px; height: 22px;
    border: 2.5px solid var(--border-main);
    border-top-color: var(--color-brand);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}
.spinner-sm { width: 16px; height: 16px; border-width: 2px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Utilities */
.hidden { display: none !important; }
.warning-banner {
    background: rgba(245, 158, 11, 0.06);
    border: 1px solid rgba(245, 158, 11, 0.3);
    border-radius: 0.75rem;
    padding: 0.6rem 1rem;
    color: #92400e;
    font-size: 0.8rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* =============================================
   NEW: Shared Tool Page Components
   (thumbnails, pagination, mode tabs, modals)
   ============================================= */

/* ----- Thumbnail grid ----- */
.thumb-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(55px, 1fr));
    gap: 0.75rem;
}
@media (min-width: 640px) {
    .thumb-grid {
        grid-template-columns: repeat(auto-fill, minmax(65px, 1fr));
        gap: 1rem;
    }
}
@media (min-width: 1024px) {
    .thumb-grid {
        grid-template-columns: repeat(auto-fill, minmax(73px, 1fr));
        gap: 1.1rem;
    }
}
.thumb-scroll-container {
    height: 41.25vh;
    overflow-y: auto;
}

/* ----- Page thumbnail card ----- */
.page-thumb {
    position: relative;
    border-radius: 0.75rem;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid var(--border-main);
    transition: all 0.2s ease;
    background: #f9f9fd;
    aspect-ratio: 3 / 4;
    display: flex;
    align-items: center;
    justify-content: center;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}
.page-thumb:hover {
    border-color: var(--color-brand);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}
.page-thumb canvas {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}
/* Selected state */
.page-thumb.selected {
    border-color: var(--thumb-selected-color, #4d65ff) !important;
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--thumb-selected-color, #4d65ff) 25%, transparent);
}
/* Range highlight */
.page-thumb.range-highlight {
    border-color: var(--thumb-range-color, rgba(77, 101, 255, 0.5));
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--thumb-range-color, rgba(77, 101, 255, 0.5)) 20%, transparent);
}

/* Page number badge */
.page-thumb .page-num {
    position: absolute;
    bottom: 6px;
    right: 8px;
    background: rgba(0, 0, 0, 0.8);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 3px 9px;
    border-radius: 20px;
    pointer-events: none;
    z-index: 10;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}

/* Keep / Delete marks */
.page-thumb .check-mark,
.page-thumb .keep-mark,
.page-thumb .delete-mark {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    opacity: 0;
    transform: scale(0.6);
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    pointer-events: none;
    z-index: 11;
}
.page-thumb.selected .check-mark,
.page-thumb.selected .delete-mark,
.page-thumb.kept-highlight .keep-mark {
    opacity: 1;
    transform: scale(1);
}

/* ----- Range group badge ----- */
.range-group-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    background: var(--badge-bg);
    color: var(--badge-color);
    border: 1px solid var(--badge-border);
}

/* ----- Pagination buttons ----- */
.pagination-btn {
    background: #ffffff;
    border: 1.5px solid var(--border-main);
    color: var(--text-secondary);
    padding: 0.5rem 1.1rem;
    border-radius: 2rem;
    font-weight: 500;
    font-size: 0.82rem;
    cursor: pointer;
    transition: all 0.25s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}
.pagination-btn:hover:not(:disabled) {
    border-color: var(--color-brand);
    color: var(--color-brand);
    background: var(--color-brand-lightest);
}
.pagination-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* ----- Mode tabs (base) ----- */
.mode-tab {
    padding: 0.6rem 1.25rem;
    border-radius: 2.5rem;
    font-weight: 500;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.25s ease;
    border: 1.5px solid transparent;
    background: var(--background-gray-main);
    color: var(--text-tertiary);
    white-space: nowrap;
    letter-spacing: 0.02em;
}
.mode-tab:hover:not(.active) {
    color: var(--text-secondary);
    border-color: var(--border-main);
    background: #ffffff;
}
.mode-tab.active {
    /* Page-specific overrides expected */
}

/* ----- Page preview modal (enlarged) ----- */
#pagePreviewModal {
    z-index: 90;
}
#pagePreviewModal .modal-content-wrapper {
    animation: modalIn 0.25s ease-out;
}
#previewCanvas {
    max-width: 100%;
    max-height: 70vh;
    object-fit: contain;
    border-radius: 0.75rem;
    box-shadow: 0 20px 50px -10px rgba(0, 0, 0, 0.15);
}

/* ----- Processing overlay (generic) ----- */
#processingOverlay .glass-card {
    background: #ffffff;
}

/* ----- Clear button inside range input ----- */
#clearRangesBtn {
    transition: all 0.2s ease;
    background: transparent;
    border: none;
    color: var(--text-tertiary);
    cursor: pointer;
}
#clearRangesBtn:hover {
    background: rgba(0, 0, 0, 0.05);
    color: var(--text-primary);
}

/* ----- Responsive Tweaks (common) ----- */
@media screen and (max-width: 767px) {
    .glass-card {
        padding: 1rem;
        border-radius: 0.9rem;
    }
    .upload-zone {
        padding: 1.5rem;
    }
    .user-avatar-btn {
        width: 38px;
        height: 38px;
        font-size: 1.1rem;
    }
    .user-dropdown {
        min-width: 250px;
        right: -10px;
    }
    .user-dropdown::before {
        right: 22px;
    }
}

@media screen and (max-width: 479px) {
    .user-dropdown {
        min-width: 220px;
        right: -20px;
        border-radius: 0.85rem;
    }
    .user-dropdown::before {
        right: 32px;
    }
    .user-dropdown-header {
        padding: 0.8rem 1rem 0.6rem;
    }
    .user-dropdown-subscription {
        padding: 0.6rem 1rem;
    }
    .user-dropdown-actions {
        padding: 0.35rem 0.4rem;
    }
    .user-dropdown-item {
        padding: 0.55rem 0.65rem;
        font-size: 0.82rem;
    }
}

/* =============================================
   TAILWIND REPLACEMENT UTILITIES
   (removes dependency on CDN)
   ============================================= */

/* ----- Container widths ----- */
.container-xl {
    width: 100%;
    max-width: 80rem;   /* 7xl */
    margin-left: auto;
    margin-right: auto;
    padding-left: 1.5rem;
    padding-right: 1.5rem;
}
.container-lg {
    width: 100%;
    max-width: 72rem;   /* 6xl */
    margin-left: auto;
    margin-right: auto;
    padding-left: 1.5rem;
    padding-right: 1.5rem;
}
.container-md {
    width: 100%;
    max-width: 48rem;   /* 3xl */
    margin-left: auto;
    margin-right: auto;
    padding-left: 1.5rem;
    padding-right: 1.5rem;
}
.max-w-2xl { max-width: 42rem; }   /* 672px */
.max-w-5xl { max-width: 64rem; }   /* 1024px */
.max-w-xs  { max-width: 20rem; }   /* 320px */
.max-w-sm  { max-width: 24rem; }   /* 384px */
.max-w-md  { max-width: 28rem; }   /* 448px */

/* ----- Flex & Grid helpers ----- */
.flex           { display: flex; }
.inline-flex    { display: inline-flex; }
.flex-wrap      { flex-wrap: wrap; }
.flex-col       { flex-direction: column; }
.flex-row       { flex-direction: row; }
.flex-grow      { flex-grow: 1; }
.flex-shrink-0  { flex-shrink: 0; }
.items-center   { align-items: center; }
.items-start    { align-items: flex-start; }
.items-end      { align-items: flex-end; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.justify-end    { justify-content: flex-end; }
.gap-2   { gap: 0.5rem; }
.gap-3   { gap: 0.75rem; }
.gap-4   { gap: 1rem; }
.gap-5   { gap: 1.25rem; }
.gap-6   { gap: 1.5rem; }

.grid           { display: grid; }
.grid-cols-1    { grid-template-columns: repeat(1, minmax(0, 1fr)); }

/* ----- Spacing (padding & margin) ----- */
.p-0  { padding: 0; }
.p-3  { padding: 0.75rem; }
.p-4  { padding: 1rem; }
.p-6  { padding: 1.5rem; }
.p-8  { padding: 2rem; }
.py-4 { padding-top: 1rem; padding-bottom: 1rem; }
.py-5 { padding-top: 1.25rem; padding-bottom: 1.25rem; }
.py-8 { padding-top: 2rem; padding-bottom: 2rem; }
.py-12{ padding-top: 3rem; padding-bottom: 3rem; }
.py-20{ padding-top: 5rem; padding-bottom: 5rem; }
.pt-12{ padding-top: 3rem; }
.pb-2 { padding-bottom: 0.5rem; }
.px-6 { padding-left: 1.5rem; padding-right: 1.5rem; }
.px-10{ padding-left: 2.5rem; padding-right: 2.5rem; }
.pl-2 { padding-left: 0.5rem; }

.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 0.75rem; }
.mt-4 { margin-top: 1rem; }
.mt-5 { margin-top: 1.25rem; }
.mt-6 { margin-top: 1.5rem; }
.mt-8 { margin-top: 2rem; }
.mt-auto { margin-top: auto; }
.mb-1\.5 { margin-bottom: 0.375rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 0.75rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-5 { margin-bottom: 1.25rem; }
.mb-6 { margin-bottom: 1.5rem; }
.mb-8 { margin-bottom: 2rem; }
.ml-1 { margin-left: 0.25rem; }
.ml-2 { margin-left: 0.5rem; }
.ml-4 { margin-left: 1rem; }
.ml-5 { margin-left: 1.25rem; }
.mr-1 { margin-right: 0.25rem; }
.mr-2 { margin-right: 0.5rem; }
.mr-3 { margin-right: 0.75rem; }
.mr-4 { margin-right: 1rem; }
.mx-auto { margin-left: auto; margin-right: auto; }
.mx-4 { margin-left: 1rem; margin-right: 1rem; }

.space-y-2 > * + * { margin-top: 0.5rem; }

/* ----- Typography ----- */
.text-center   { text-align: center; }
.text-left     { text-align: left; }
.text-xs       { font-size: 0.75rem; }
.text-sm       { font-size: 0.875rem; }
.text-base     { font-size: 1rem; }
.text-lg       { font-size: 1.125rem; }
.text-xl       { font-size: 1.25rem; }
.text-2xl      { font-size: 1.5rem; }
.text-3xl      { font-size: 1.875rem; }
.text-4xl      { font-size: 2.25rem; }
.font-light    { font-weight: 300; }
.font-normal   { font-weight: 400; }
.font-medium   { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold     { font-weight: 700; }
.font-extrabold { font-weight: 800; }
.tracking-tight { letter-spacing: -0.025em; }
.leading-tight  { line-height: 1.25; }

/* Text colors */
.text-white    { color: #ffffff; }
.text-gray-400 { color: #9ca3af; }
.text-gray-500 { color: #6b7280; }
.text-gray-600 { color: #4b5563; }
.text-gray-700 { color: #374151; }
.text-gray-800 { color: #1f2937; }
.text-indigo-500 { color: #6366f1; }
.text-indigo-600 { color: #4f46e5; }
.text-emerald-500 { color: #10b981; }
.text-emerald-600 { color: #059669; }
.text-rose-500   { color: #f43f5e; }
.text-rose-600   { color: #e11d48; }

/* ----- Backgrounds ----- */
.bg-black\/30 { background-color: rgba(0, 0, 0, 0.3); }
.bg-gray-50   { background-color: #f9fafb; }
.bg-gray-100  { background-color: #f3f4f6; }

/* ----- Borders & Radius ----- */
.rounded-2xl  { border-radius: 1rem; }
.rounded-full { border-radius: 9999px; }

/* ----- Width & Height ----- */
.w-full { width: 100%; }
.w-1    { width: 0.25rem; }
.w-6    { width: 1.5rem; }
.w-9    { width: 2.25rem; }
.w-10   { width: 2.5rem; }
.w-16   { width: 4rem; }
.w-20   { width: 5rem; }
.h-6    { height: 1.5rem; }
.h-8    { height: 2rem; }
.h-9    { height: 2.25rem; }
.h-16   { height: 4rem; }
.min-w-0 { min-width: 0; }
.min-w-100 { min-width: 100px; }

/* ----- Positioning & z-index ----- */
.relative { position: relative; }
.inset-0  { top: 0; right: 0; bottom: 0; left: 0; }
.z-10 { z-index: 10; }
.z-30 { z-index: 30; }
.z-40 { z-index: 40; }
.z-50 { z-index: 50; }
.z-70 { z-index: 70; }

/* ----- Overflow ----- */
.overflow-hidden { overflow: hidden; }
.overflow-y-auto { overflow-y: auto; }
.max-h-60 { max-height: 15rem; }  /* 240px */
.max-h-64 { max-height: 16rem; }  /* 256px */

/* ----- Visual effects ----- */
.rounded-xl   { border-radius: 0.75rem; }
.rounded-md   { border-radius: 0.375rem; }
.shadow-sm    { box-shadow: 0 1px 2px 0 rgba(0,0,0,0.05); }
.shadow       { box-shadow: 0 1px 3px 0 rgba(0,0,0,0.1), 0 1px 2px -1px rgba(0,0,0,0.1); }
.backdrop-blur-sm { backdrop-filter: blur(4px); }
.opacity-70   { opacity: 0.7; }

/* ----- Interactions ----- */
.cursor-pointer     { cursor: pointer; }
.cursor-not-allowed { cursor: not-allowed; }
.no-underline        { text-decoration: none; }
.truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.transition {
    transition: color 0.15s ease, background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
.transition-all { transition: all 0.15s ease; }

/* Hover states */
.hover\:text-indigo-600:hover { color: #4f46e5; }
.hover\:text-rose-500:hover { color: #f43f5e; }
.hover\:bg-gray-100:hover { background-color: #f3f4f6; }
.hover\:border-rose-400\/50:hover { border-color: rgba(251, 113, 133, 0.5); }

/* ----- Accessibility & misc ----- */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
.block { display: block; }
.whitespace-nowrap { white-space: nowrap; }

/* ----- Responsive overrides (mobile-first) ----- */
@media (min-width: 640px) {
    .sm\:gap-4 { gap: 1rem; }
}
@media (min-width: 768px) {
    .md\:flex-row { flex-direction: row; }
    .md\:text-3xl { font-size: 1.875rem; }
    .md\:text-6xl { font-size: 3.75rem; }
    .md\:text-lg   { font-size: 1.125rem; }
    .md\:p-10 { padding: 2.5rem; }
    .md\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* =============================================
   MISSING TAILWIND REPLACEMENTS
   (used by auth / decrypt / delete pages)
   ============================================= */

/* ----- Max widths ----- */
.max-w-6xl { max-width: 72rem; }   /* 1152px */
.max-w-7xl { max-width: 80rem; }   /* 1280px */

/* ----- Spacing (padding / margin / gap) ----- */
.p-2     { padding: 0.5rem; }
.p-5     { padding: 1.25rem; }
.p-10    { padding: 2.5rem; }
.pt-2    { padding-top: 0.5rem; }
.pr-10   { padding-right: 2.5rem; }

.mb-1    { margin-bottom: 0.25rem; }
.mt-1\.5 { margin-top: 0.375rem; }

.gap-1   { gap: 0.25rem; }

.space-y-4 > * + * { margin-top: 1rem; }

/* ----- Layout & position ----- */
.fixed         { position: fixed; }
.min-h-screen  { min-height: 100vh; }

/* ----- Background ----- */
.bg-white { background-color: #ffffff; }

/* ----- Borders ----- */
.border {
    border-width: 1px;
    border-style: solid;
}
.border-gray-200   { border-color: #e5e7eb; }
.border-indigo-400 { border-color: #818cf8; }

/* ----- Typography ----- */
.font-mono {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
                 "Liberation Mono", "Courier New", monospace;
}
.text-indigo-400 { color: #818cf8; }

/* ----- Shadows ----- */
.shadow-2xl {
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

/* ----- Focus rings ----- */
.focus\:outline-none:focus {
    outline: none;
}
.focus\:ring-2:focus {
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}
.focus\:ring-indigo-500\/20:focus {
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

/* ----- Hover states ----- */
.hover\:underline:hover {
    text-decoration: underline;
}
.hover\:text-indigo-500:hover {
    color: #6366f1;
}

/* ----- Responsive additions (md) ----- */
@media (min-width: 768px) {
    .md\:p-14 { padding: 3.5rem; }
}

/* =============================================
   TAILWIND REPLACEMENTS — BATCH 3
   (classes used by encrypt, rotate, extract,
    image2pdf, pdf_blank, organize, split,
    pdf2image, terms, privacy)
   ============================================= */

/* ----- Positioning ----- */
.absolute { position: absolute; }
.bottom-0 { bottom: 0; }
.left-0   { left: 0; }
.right-0  { right: 0; }
.right-2  { right: 0.5rem; }
.right-3  { right: 0.75rem; }
.top-1\/2 { top: 50%; }
.pointer-events-none { pointer-events: none; }

/* ----- Flex ----- */
.flex-1 { flex: 1 1 0%; }

/* ----- Grid (responsive) ----- */
.grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 640px) {
    .sm\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .sm\:grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (min-width: 768px) {
    .md\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .md\:grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (min-width: 1024px) {
    .lg\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .lg\:grid-cols-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
    .lg\:col-span-2  { grid-column: span 2 / span 2; }
}
@media (min-width: 1280px) {
    .xl\:grid-cols-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}

/* ----- Spacing (padding & margin) ----- */
.ml-auto { margin-left: auto; }
.mr-1\.5 { margin-right: 0.375rem; }
.mb-12 { margin-bottom: 3rem; }
.pb-8  { padding-bottom: 2rem; }
.pb-16 { padding-bottom: 4rem; }
.pt-10 { padding-top: 2.5rem; }
.px-4  { padding-left: 1rem; padding-right: 1rem; }
.py-2  { padding-top: 0.5rem; padding-bottom: 0.5rem; }
.py-3  { padding-top: 0.75rem; padding-bottom: 0.75rem; }
.py-6  { padding-top: 1.5rem; padding-bottom: 1.5rem; }
@media (min-width: 640px) {
    .sm\:p-10 { padding: 2.5rem; }
}

.space-y-3 > * + * { margin-top: 0.75rem; }
.space-y-6 > * + * { margin-top: 1.5rem; }

/* ----- Sizing ----- */
.h-20 { height: 5rem; }
.h-24 { height: 6rem; }
.max-h-\[70vh\] { max-height: 70vh; }
.max-w-4xl { max-width: 56rem; }   /* 896px */
.max-w-full { max-width: 100%; }
.min-w-\[120px\] { min-width: 120px; }
.min-w-\[200px\] { min-width: 200px; }

/* ----- Typography ----- */
.italic { font-style: italic; }
.leading-relaxed { line-height: 1.625; }
@media (min-width: 768px) {
    .md\:text-4xl { font-size: 2.25rem; }
}
.text-\[11px\]  { font-size: 11px; }
.text-amber-600   { color: #d97706; }
.text-red-500     { color: #ef4444; }
.text-white\/80  { color: rgba(255, 255, 255, 0.8); }
.tracking-wide   { letter-spacing: 0.025em; }
.tracking-wider  { letter-spacing: 0.05em; }
.uppercase { text-transform: uppercase; }

/* ----- Backgrounds ----- */
.bg-black\/40    { background-color: rgba(0, 0, 0, 0.4); }
.bg-black\/70    { background-color: rgba(0, 0, 0, 0.7); }
.bg-gradient-to-t { background-image: linear-gradient(to top, var(--tw-gradient-stops)); }
.bg-gray-50\/50 { background-color: rgba(249, 250, 251, 0.5); }
.from-white      { --tw-gradient-from: #fff; --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to, rgba(255, 255, 255, 0)); }
.from-\[\#f8f9fc\] { --tw-gradient-from: #f8f9fc; --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to, rgba(248, 249, 252, 0)); }
.to-transparent  { --tw-gradient-to: transparent; }

/* ----- Border radius ----- */
.rounded-lg { border-radius: 0.5rem; }

/* ----- Focus states ----- */
.focus\:border-indigo-400:focus { border-color: #818cf8; }
.focus\:ring-indigo-500\/30:focus {
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.3);
}

/* ----- Hover states ----- */
.hover\:bg-red-50:hover { background-color: #fef2f2; }
.hover\:text-gray-900:hover { color: #111827; }
.hover\:text-red-500:hover { color: #ef4444; }
.hover\:text-white:hover { color: #ffffff; }

/* ----- Misc ----- */
.object-contain { object-fit: contain; }
.overflow-auto { overflow: auto; }
.transition-colors { transition: color 0.15s ease, background-color 0.15s ease, border-color 0.15s ease; }
.z-\[85\] { z-index: 85; }