/* =================== MODERN RESET & BASE =================== */
:root {
    /* Modern Color Palette */
    --primary: #274c77;
    --primary-dark: #3a56d4;
    --primary-light: #4895ef;
    --secondary: #6096ba;
    --success: #4cc9f0;
    --warning: #f72585;
    --danger: #ef233c;
    --info: #6096ba;
    
    /* Neutral Colors */
    --dark: #1a1a2e;
    --dark-light: #2d3047;
    --gray-900: #2b2d42;
    --gray-800: #4a4e69;
    --gray-700: #8d99ae;
    --gray-600: #a2a8c2;
    --gray-500: #c1c6d9;
    --gray-400: #d8dbe7;
    --gray-300: #e9ecf1;
    --gray-200: #f1f3f9;
    --gray-100: #f8fafc;
    --white: #ffffff;
    
    /* Effects */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.12);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.16);
    --shadow-xl: 0 16px 48px rgba(0, 0, 0, 0.2);
    --border-radius-sm: 8px;
    --border-radius-md: 12px;
    --border-radius-lg: 16px;
    --border-radius-xl: 24px;
    --transition-fast: 0.15s ease;
    --transition-base: 0.3s ease;
    --transition-slow: 0.5s ease;
    
    /* Gradients */
    --gradient-primary: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    --gradient-dark: linear-gradient(135deg, var(--dark) 0%, var(--dark-light) 100%);
    --gradient-warning: linear-gradient(135deg, var(--warning) 0%, #ff4d8d 100%);
    --gradient-success: linear-gradient(135deg, var(--success) 0%, #4ae3e3 100%);
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    line-height: 1.6;
    color: var(--gray-900);
    background: linear-gradient(135deg, var(--gray-100) 0%, var(--gray-200) 100%);
    min-height: 100vh;
    overflow-x: hidden;
    padding-top: 70px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* =================== TYPOGRAPHY =================== */
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    line-height: 1.2;
    color: var(--dark);
    margin-bottom: 1rem;
}

h1 {
    font-size: 2.5rem;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

h2 {
    font-size: 2rem;
}

h3 {
    font-size: 1.5rem;
}

p {
    margin-bottom: 1rem;
    color: var(--gray-800);
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: var(--transition-fast);
}

a:hover {
    color: var(--primary-dark);
}

/* =================== UTILITY CLASSES =================== */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
}

@media (max-width: 768px) {
    .container {
        padding: 0 1rem;
    }
}

.text-center {
    text-align: center;
}

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }

.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }

/* =================== BUTTONS =================== */
.primary-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 0.875rem 2rem;
    background: var(--gradient-primary);
    color: var(--white);
    border: none;
    border-radius: var(--border-radius-md);
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    z-index: 1;
}

.primary-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: 0.5s;
    z-index: -1;
}

.primary-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.primary-btn:hover::before {
    left: 100%;
}

.primary-btn:active {
    transform: translateY(0);
}

.secondary-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 0.875rem 2rem;
    background: var(--white);
    color: var(--primary);
    border: 2px solid var(--primary);
    border-radius: var(--border-radius-md);
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.secondary-btn:hover {
    background: var(--primary);
    color: var(--white);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* =================== APP HEADER =================== */
.app-header {
    position: relative;
    padding: 10px;
}

.header-container22 {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 2rem;
}

.tool-title {
    display: block;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.5rem;
    margin: 0;
}

.tool-title i {
    color: var(--primary);
    font-size: 2rem;
}

.tool-subtitle {
    font-size: 0.875rem;
    color: var(--gray-700);
    margin: 0.25rem 0 0 0;
}

.user-stats {
    display: flex;
    gap: 1.5rem;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--gray-700);
}

.stat-item i {
    color: var(--success);
}

@media (max-width: 768px) {
    .header-container22 {
        flex-direction: column;
        text-align: center;
        gap: 1rem;
        padding: 0 1rem;
    }
    
    .user-stats {
        justify-content: center;
    }
}

/* =================== MAIN LAYOUT =================== */
.main-content {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 2rem;
    max-width: 1400px;
    margin: 2rem auto;
    padding: 0 2rem;
    min-height: calc(100vh - 300px);
}

@media (max-width: 1024px) {
    .main-content {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
}

@media (max-width: 768px) {
    .main-content {
        padding: 0 1rem;
        margin: 1rem auto;
    }
}

/* =================== UPLOAD ZONE =================== */
.upload-zone {
    background: var(--white);
    border-radius: var(--border-radius-lg);
    padding: 4rem 2rem;
    text-align: center;
    box-shadow: var(--shadow-md);
    border: 2px dashed var(--gray-300);
    transition: all 0.3s ease;
    margin-bottom: 2rem;
}

.upload-zone:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.upload-zone.drag-over {
    border-color: var(--primary);
    background: rgba(67, 97, 238, 0.05);
}

.upload-icon {
    font-size: 4rem;
    color: var(--primary);
    margin-bottom: 1.5rem;
    opacity: 0.9;
}

.upload-title {
    font-size: 2rem;
    margin-bottom: 1rem;
}

.upload-description {
    color: var(--gray-700);
    max-width: 600px;
    margin: 0 auto 2rem;
    font-size: 1.125rem;
}

.security-note {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
    padding: 0.5rem 1rem;
    border-radius: 50px;
    font-weight: 500;
    margin-top: 1rem;
}

.upload-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.file-input {
    display: none;
}

.upload-formats {
    display: flex;
    justify-content: center;
    gap: 2rem;
    flex-wrap: wrap;
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid var(--gray-200);
}

.format-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--gray-700);
    font-size: 0.875rem;
}

.format-item i {
    color: var(--success);
}

/* =================== VIEWER SECTION =================== */
.viewer-section {
    background: var(--white);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    display: none;
}

.viewer-header {
    background: var(--gray-100);
    padding: 1.5rem;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.document-info {
	padding: 15px;
    display: flex;
    align-items: center;
    gap: 1rem;
    flex: 1;
    min-width: 0;
}


.file-info-display {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex: 1;
    min-width: 0;
}

.file-info-display i {
    font-size: 2rem;
    color: var(--primary);
}

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

.file-name {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0 0 0.25rem 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-meta {
    font-size: 0.875rem;
    color: var(--gray-700);
    margin: 0;
}

.document-stats {
    display: flex;
    gap: 1rem;
}

.stat-badge {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--white);
    border: 1px solid var(--gray-300);
    border-radius: 50px;
    font-size: 0.875rem;
    color: var(--gray-800);
}

.stat-badge i {
    color: var(--primary);
}

.viewer-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.zoom-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--white);
    padding: 0.5rem;
    border-radius: var(--border-radius-md);
    border: 1px solid var(--gray-300);
}

.control-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--white);
    border: 1px solid var(--gray-300);
    border-radius: var(--border-radius-sm);
    color: var(--gray-800);
    cursor: pointer;
    transition: all 0.2s ease;
}

.control-btn:hover {
    background: var(--gray-100);
    border-color: var(--primary);
    color: var(--primary);
    transform: translateY(-1px);
}

.zoom-display {
    padding: 0 1rem;
    font-weight: 600;
    color: var(--dark);
    min-width: 80px;
    text-align: center;
}

.action-controls {
    display: flex;
    gap: 0.5rem;
}

.export-btn {
    padding: 0.75rem 1.5rem;
}

.export-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

/* =================== PROGRESS BAR =================== */
.progress-container {
    padding: 1rem 1.5rem;
    background: var(--gray-100);
    border-bottom: 1px solid var(--gray-200);
    display: none;
}

.progress-label {
    font-size: 0.875rem;
    color: var(--gray-700);
    margin-bottom: 0.5rem;
}

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

.progress-fill {
    height: 100%;
    background: var(--gradient-primary);
    width: 0%;
    transition: width 0.3s ease;
    border-radius: 3px;
}

/* =================== PDF VIEWER =================== */
.pdf-viewer {
    min-height: 600px;
    position: relative;
    background: var(--gray-100);
    display: flex;
    align-items: center;
    justify-content: center;
}

.viewer-placeholder {
    text-align: center;
    color: var(--gray-600);
    padding: 3rem;
}

.viewer-placeholder i {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.viewer-placeholder h3 {
    font-size: 1.5rem;
    color: var(--gray-700);
    margin-bottom: 0.5rem;
}

.viewer-content {
    width: 100%;
    height: 100%;
    padding: 2rem;
    overflow: auto;
}

.page-wrapper {
    margin: 0 auto 2rem;
    background: var(--white);
    box-shadow: var(--shadow-lg);
    border-radius: var(--border-radius-sm);
    overflow: hidden;
    position: relative;
}

.pdf-canvas {
    display: block;
    max-width: 100%;
    height: auto;
}

.overlay-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: auto;
    cursor: crosshair;
}

/* =================== PAGE NAVIGATION =================== */
.page-navigation {
    background: var(--white);
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--gray-200);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.nav-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: var(--white);
    border: 2px solid var(--gray-300);
    border-radius: var(--border-radius-md);
    color: var(--gray-800);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 120px;
}

.nav-btn:hover:not(:disabled) {
    background: var(--gray-100);
    border-color: var(--primary);
    color: var(--primary);
    transform: translateY(-1px);
}

.nav-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.page-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--dark);
}

.current-page {
    color: var(--primary);
    font-size: 1.5rem;
}

.page-separator {
    color: var(--gray-500);
}

.total-pages {
    color: var(--gray-700);
}

/* =================== TOOLS PANEL =================== */
.tools-panel {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

@media (max-width: 1024px) {
    .tools-panel {
        display: none;
    }
}

.tools-section {
    background: var(--white);
    border-radius: var(--border-radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-md);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.section-header h3 {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 0;
    font-size: 1.25rem;
}

.section-header i {
    color: var(--primary);
}

.info-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gray-100);
    border: none;
    border-radius: 50%;
    color: var(--gray-600);
    cursor: pointer;
    transition: all 0.2s ease;
}

.info-btn:hover {
    background: var(--primary);
    color: var(--white);
    transform: rotate(15deg);
}

/* =================== TOOLS GRID =================== */
.tools-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.tool-card {
    position: relative;
}

.tool-btn {
    width: 100%;
    padding: 1rem;
    background: var(--gray-100);
    border: 2px solid transparent;
    border-radius: var(--border-radius-md);
    color: var(--gray-800);
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    position: relative;
}

.tool-btn:hover {
    background: var(--white);
    border-color: var(--gray-300);
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

.tool-btn.active {
    background: var(--white);
    border-color: var(--primary);
    color: var(--primary);
    box-shadow: 0 4px 12px rgba(67, 97, 238, 0.15);
}

.tool-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--white);
    border-radius: var(--border-radius-sm);
    font-size: 1.25rem;
}

.tool-btn.active .tool-icon {
    background: var(--primary);
    color: var(--white);
}

.tool-label {
    font-weight: 600;
}

.tool-shortcut {
    position: absolute;
    top: 4px;
    right: 4px;
    font-size: 0.75rem;
    background: rgba(0, 0, 0, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
    color: var(--gray-700);
}

/* =================== TOOL INFO HOVER =================== */
.tool-info {
    position: absolute;
    top: 0;
    right: -10px;
    transform: translateX(100%);
    width: 250px;
    background: var(--dark);
    color: var(--white);
    padding: 1rem;
    border-radius: var(--border-radius-md);
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    pointer-events: none;
}

.tool-info::before {
    content: '';
    position: absolute;
    top: 12px;
    left: -8px;
    width: 16px;
    height: 16px;
    background: var(--dark);
    transform: rotate(45deg);
}

.tool-card:hover .tool-info {
    opacity: 1;
    visibility: visible;
}

.info-icon {
    position: absolute;
    top: 8px;
    right: 8px;
    font-size: 0.875rem;
    color: var(--gray-600);
    cursor: help;
}

.tool-card:hover .info-icon {
    color: var(--primary);
}

.tool-info-content {
    font-size: 0.875rem;
    line-height: 1.5;
}

.tool-info-content strong {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--white);
}

/* =================== TOOL PROPERTIES =================== */
.tool-properties {
    background: var(--gray-100);
    padding: 1.25rem;
    border-radius: var(--border-radius-md);
    margin-top: 1.5rem;
}

.property-group {
    margin-bottom: 1.25rem;
}

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

.property-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    color: var(--dark);
    margin-bottom: 0.75rem;
    font-size: 0.875rem;
}

.property-label i {
    color: var(--primary);
}

.size-value,
.opacity-value {
    margin-left: auto;
    font-weight: 700;
    color: var(--primary);
    font-size: 0.875rem;
}

.color-palette {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.color-swatch {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
    border: 3px solid transparent;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.color-swatch:hover {
    transform: scale(1.1);
    box-shadow: var(--shadow-sm);
}

.color-swatch.active {
    border-color: var(--white);
    box-shadow: 0 0 0 2px var(--primary), var(--shadow-sm);
    transform: scale(1.1);
}

.color-swatch.active::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: var(--white);
    font-weight: bold;
    font-size: 12px;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

.color-swatch.custom-color {
    background: linear-gradient(45deg, 
        #ff0000 0%, #ff9900 17%, #ffff00 33%, 
        #00ff00 50%, #0099ff 67%, #6600ff 83%, #ff0000 100%);
    display: flex;
    align-items: center;
    justify-content: center;
}

.color-swatch.custom-color i {
    color: var(--white);
    font-size: 0.875rem;
}

.color-swatch.custom-color input[type="color"] {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.size-slider,
.opacity-slider {
    width: 100%;
    height: 8px;
    -webkit-appearance: none;
    background: linear-gradient(to right, var(--gray-300), var(--primary));
    border-radius: 4px;
    outline: none;
}

.size-slider::-webkit-slider-thumb,
.opacity-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--white);
    cursor: pointer;
    border: 3px solid var(--primary);
    box-shadow: var(--shadow-sm);
    transition: all 0.2s ease;
}

.size-slider::-webkit-slider-thumb:hover,
.opacity-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    box-shadow: var(--shadow-md);
}

/* =================== THUMBNAILS SECTION =================== */
.thumbnails-section {
    background: var(--white);
    border-radius: var(--border-radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-md);
}

.toggle-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gray-100);
    border: none;
    border-radius: 50%;
    color: var(--gray-600);
    cursor: pointer;
    transition: all 0.2s ease;
}

.toggle-btn:hover {
    background: var(--primary);
    color: var(--white);
}

.thumbnails-container {
    max-height: 400px;
    overflow-y: auto;
    padding: 0.5rem;
    background: var(--gray-100);
    border-radius: var(--border-radius-md);
    border: 1px solid var(--gray-300);
    margin-top: 1rem;
}

.thumbnails-container::-webkit-scrollbar {
    width: 6px;
}

.thumbnails-container::-webkit-scrollbar-track {
    background: var(--gray-200);
    border-radius: 3px;
}

.thumbnails-container::-webkit-scrollbar-thumb {
    background: var(--gray-400);
    border-radius: 3px;
}

.thumbnails-container::-webkit-scrollbar-thumb:hover {
    background: var(--gray-500);
}

.empty-thumbnails {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--gray-600);
}

.empty-thumbnails i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.thumbnail-item {
    background: var(--white);
    border: 2px solid transparent;
    border-radius: var(--border-radius-sm);
    overflow: hidden;
    margin-bottom: 0.75rem;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-sm);
}

.thumbnail-item:hover {
    border-color: var(--gray-400);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.thumbnail-item.active {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.2), var(--shadow-md);
}

.thumbnail-image {
    width: 100%;
    height: auto;
    display: block;
}

.thumbnail-number {
    padding: 0.5rem;
    text-align: center;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--gray-700);
    background: var(--gray-100);
    border-top: 1px solid var(--gray-300);
}

/* =================== QUICK ACTIONS =================== */
.quick-actions {
    background: var(--white);
    border-radius: var(--border-radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-md);
}

.actions-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
    margin-top: 1rem;
}

.action-card {
    padding: 1rem;
    background: var(--gray-100);
    border: 2px solid transparent;
    border-radius: var(--border-radius-md);
    color: var(--gray-800);
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.action-card:hover {
    background: var(--white);
    border-color: var(--primary);
    color: var(--primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

.action-card i {
    font-size: 1.25rem;
}

/* =================== MOBILE TOOLS MODAL =================== */
.mobile-tools-modal {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--white);
    border-radius: var(--border-radius-lg) var(--border-radius-lg) 0 0;
    box-shadow: var(--shadow-xl);
    z-index: 1001;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    max-height: 80vh;
    overflow: hidden;
    display: none;
}

.mobile-tools-modal.active {
    transform: translateY(0);
    display: block;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid var(--gray-200);
    position: sticky;
    top: 0;
    background: var(--white);
    z-index: 1;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.25rem;
}

.modal-close {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gray-100);
    border: none;
    border-radius: 50%;
    color: var(--gray-600);
    cursor: pointer;
    transition: all 0.2s ease;
}

.modal-close:hover {
    background: var(--primary);
    color: var(--white);
    transform: rotate(90deg);
}

.modal-tools {
    padding: 1.5rem;
    overflow-y: auto;
    max-height: calc(80vh - 80px);
}

.modal-tools .tools-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

/* =================== MOBILE FAB =================== */
.mobile-fab {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 60px;
    height: 60px;
    background: var(--gradient-primary);
    color: var(--white);
    border: none;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.mobile-fab:hover {
    transform: scale(1.1) rotate(90deg);
    box-shadow: var(--shadow-xl);
}

@media (max-width: 1024px) {
    .mobile-fab {
        display: flex;
    }
}

@media (max-width: 768px) {
    .mobile-fab {
        bottom: 1.5rem;
        right: 1.5rem;
        width: 56px;
        height: 56px;
    }
}

/* =================== FEATURES BANNER =================== */
.features-banner {
    background: var(--white);
    padding: 4rem 0;
    margin-top: 4rem;
}

.features-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
}

@media (max-width: 768px) {
    .features-container {
        grid-template-columns: 1fr;
        gap: 1.5rem;
        padding: 0 1rem;
    }
}

.feature-item {
    text-align: center;
    padding: 2rem;
    background: var(--gray-100);
    border-radius: var(--border-radius-lg);
    transition: all 0.3s ease;
}

.feature-item:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-lg);
    background: var(--white);
}

.feature-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 1.5rem;
    background: var(--gradient-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: var(--white);
}

.feature-content h4 {
    font-size: 1.25rem;
    margin-bottom: 0.75rem;
}

.feature-content p {
    color: var(--gray-700);
    font-size: 0.95rem;
    margin: 0;
}

/* =================== FAQ SECTION =================== */
.faq-section {
    background: var(--gray-100);
    padding: 4rem 0;
}

.section-title {
    text-align: center;
    font-size: 2.5rem;
    margin-bottom: 3rem;
}

.faq-grid {
    max-width: 800px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.faq-item {
    background: var(--white);
    border-radius: var(--border-radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
}

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

.faq-question {
    width: 100%;
    padding: 1.5rem;
    background: var(--white);
    border: none;
    text-align: left;
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--dark);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s ease;
}

.faq-question:hover {
    background: var(--gray-100);
}

.faq-question i {
    transition: transform 0.3s ease;
    color: var(--primary);
}

.faq-question.active i {
    transform: rotate(180deg);
}

.faq-answer {
    padding: 0;
    max-height: 0;
    overflow: hidden;
    transition: all 0.3s ease;
}

.faq-answer.active {
    padding: 1.5rem;
    max-height: 500px;
    border-top: 1px solid var(--gray-200);
}

.faq-answer p {
    color: var(--gray-700);
    margin: 0;
    line-height: 1.7;
}

/* =================== CTA SECTION =================== */
.cta-section {
    background: var(--gradient-dark);
    color: var(--white);
    padding: 5rem 0;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.cta-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1440 320"><path fill="%23ffffff" fill-opacity="0.1" d="M0,96L48,112C96,128,192,160,288,160C384,160,480,128,576,112C672,96,768,96,864,112C960,128,1056,160,1152,160C1248,160,1344,128,1392,112L1440,96L1440,320L1392,320C1344,320,1248,320,1152,320C1056,320,960,320,864,320C768,320,672,320,576,320C480,320,384,320,288,320C192,320,96,320,48,320L0,320Z"></path></svg>');
    background-size: cover;
    background-position: center;
}

.cta-section .container {
    position: relative;
    z-index: 1;
}

.cta-section h2 {
    font-size: 3rem;
    color: var(--white);
    margin-bottom: 1rem;
}

.cta-section p {
    font-size: 1.25rem;
    color: rgba(255, 255, 255, 0.9);
    max-width: 600px;
    margin: 0 auto 2rem;
}

.cta-btn {
    margin: 2rem auto;
    font-size: 1.125rem;
    padding: 1rem 2.5rem;
}

.cta-stats {
    display: flex;
    justify-content: center;
    gap: 3rem;
    margin-top: 3rem;
    flex-wrap: wrap;
}

.stat {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.stat-number {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--white);
    line-height: 1;
}

.stat-label {
    font-size: 0.875rem;
    color: rgba(255, 255, 255, 0.8);
    margin-top: 0.5rem;
}

@media (max-width: 768px) {
    .cta-section {
        padding: 3rem 0;
    }
    
    .cta-section h2 {
        font-size: 2rem;
    }
    
    .cta-stats {
        gap: 1.5rem;
    }
    
    .stat-number {
        font-size: 2rem;
    }
}

/* =================== FOOTER =================== */
.tool-footer {
    background: var(--dark);
    color: var(--white);
    padding: 4rem 0 2rem;
}

.footer-content {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 4rem;
    margin-bottom: 3rem;
}

@media (max-width: 768px) {
    .footer-content {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
}

.footer-brand h3 {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--white);
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

.footer-brand h3 i {
    color: var(--primary-light);
}

.footer-brand p {
    color: rgba(255, 255, 255, 0.7);
    margin: 0;
}

.footer-links {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 2rem;
}

@media (max-width: 480px) {
    .footer-links {
        grid-template-columns: 1fr;
    }
}

.link-group h4 {
    color: var(--white);
    font-size: 1.125rem;
    margin-bottom: 1rem;
}

.link-group a {
    display: block;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 0.5rem;
    transition: all 0.2s ease;
}

.link-group a:hover {
    color: var(--white);
    padding-left: 0.5rem;
}

.footer-bottom {
    text-align: center;
    padding-top: 2rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.875rem;
}

/* =================== TOOLTIP =================== */
.tooltip {
    position: relative;
}

.tooltip::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    padding: 0.5rem 0.75rem;
    background: var(--dark);
    color: var(--white);
    border-radius: var(--border-radius-sm);
    font-size: 0.75rem;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    pointer-events: none;
    z-index: 1000;
    margin-bottom: 8px;
}

.tooltip::before {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border-width: 4px;
    border-style: solid;
    border-color: var(--dark) transparent transparent transparent;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    margin-bottom: 4px;
}

.tooltip:hover::after,
.tooltip:hover::before {
    opacity: 1;
    visibility: visible;
}

/* =================== LOADER =================== */
.global-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    backdrop-filter: blur(10px);
    transition: opacity 0.3s ease;
}

.global-loader.hidden {
    opacity: 0;
    visibility: hidden;
}

.loader-content {
    text-align: center;
}

.loader-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid var(--gray-300);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1.5rem;
}

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

.loader-text {
    font-size: 1.125rem;
    color: var(--gray-700);
    font-weight: 500;
}

/* =================== RESPONSIVE ADJUSTMENTS =================== */
@media (max-width: 1024px) {
    .viewer-header {
        flex-direction: column;
        align-items: stretch;
    }
    
    .document-info {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .document-stats {
        width: 100%;
        justify-content: flex-start;
    }
    
    .viewer-controls {
        width: 100%;
        justify-content: space-between;
    }
}

@media (max-width: 768px) {
    h1 {
        font-size: 2rem;
    }
    
    h2 {
        font-size: 1.5rem;
    }
    
    .upload-zone {
        padding: 2rem 1rem;
    }
    
    .upload-title {
        font-size: 1.5rem;
    }
    
    .upload-actions {
        flex-direction: column;
    }
    
    .upload-actions button {
        width: 100%;
    }
    
    .viewer-header {
        padding: 1rem;
    }
    
    .viewer-controls {
        flex-direction: column;
        gap: 1rem;
    }
    
    .zoom-controls {
        width: 100%;
        justify-content: center;
    }
    
    .action-controls {
        width: 100%;
        justify-content: center;
    }
    
    .page-navigation {
        flex-direction: column;
        gap: 1rem;
    }
    
    .nav-btn {
        width: 100%;
        justify-content: center;
    }
    
    .page-info {
        order: -1;
    }
    
    .modal-tools .tools-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) { 
    .modal-tools .tools-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* =================== ANNOTATION STYLES =================== */
.sticky-note {
    position: absolute;
    background: linear-gradient(135deg, #fff9c4 0%, #fff59d 100%);
    border: 2px solid #ffd54f;
    border-radius: 12px;
    padding: 1rem;
    min-width: 180px;
    min-height: 120px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
    resize: both;
    overflow: auto;
    max-width: 400px;
    max-height: 400px;
    z-index: 1000;
    font-family: 'Comic Sans MS', cursive, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    cursor: move;
    touch-action: none;
    pointer-events: auto;
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.sticky-note:hover {
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    transform: translateY(-2px);
}

.sticky-note:focus {
    outline: 3px solid var(--primary);
    outline-offset: 2px;
}

.text-annotation-editable {
    position: absolute;
    background: rgba(255, 255, 255, 0.95);
    border: 2px solid var(--primary);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    min-width: 150px;
    min-height: 40px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
    z-index: 10000;
    font-family: Arial, sans-serif;
    font-size: 16px;
    line-height: 1.4;
    resize: both;
    overflow: auto;
    max-width: 400px;
    max-height: 300px;
    cursor: text;
    touch-action: auto;
    pointer-events: auto;
    transition: all 0.3s ease;
}

.text-annotation-editable:focus {
    box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.3), 0 10px 30px rgba(0, 0, 0, 0.2);
    border-color: var(--primary-dark);
}

/* =================== PRINT STYLES =================== */
@media print {
    .app-header,
    .tools-panel,
    .mobile-fab,
    .features-banner,
    .faq-section,
    .cta-section,
    .tool-footer,
    .page-navigation {
        display: none !important;
    }
    
    .viewer-section {
        box-shadow: none !important;
        margin: 0 !important;
        padding: 0 !important;
    }
    
    .pdf-viewer {
        min-height: auto !important;
    }
    
    .page-wrapper {
        margin: 0 !important;
        box-shadow: none !important;
        break-inside: avoid;
    }
}

/* =================== ACCESSIBILITY =================== */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

.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;
}

:focus-visible {
    outline: 3px solid var(--primary);
    outline-offset: 2px;
}

/* =================== DARK MODE SUPPORT =================== */
@media (prefers-color-scheme: dark) {
    :root {
        --dark: #0f172a;
        --dark-light: #1e293b;
        --gray-900: #f1f5f9;
        --gray-800: #e2e8f0;
        --gray-700: #cbd5e1;
        --gray-600: #94a3b8;
        --gray-500: #64748b;
        --gray-400: #475569;
        --gray-300: #334155;
        --gray-200: #1e293b;
        --gray-100: #0f172a;
        --white: #1e293b;
    }
    
    body {
        background: var(--dark);
        color: var(--gray-900);
    }
    
    .app-header,
    .tools-section,
    .thumbnails-section,
    .quick-actions,
    .features-banner,
    .faq-item,
    .viewer-section {
        background: var(--white);
    }
    
    .upload-zone {
        background: var(--white);
        border-color: var(--gray-300);
    }
    
    .pdf-viewer {
        background: var(--gray-100);
    }
    
    .tool-btn {
        background: var(--gray-200);
        color: var(--gray-800);
    }
    
    .tool-btn.active {
        background: var(--white);
        color: var(--primary);
    }
}
/* =================== PDF VIEWER STATES =================== */
.viewer-placeholder {
    transition: opacity 0.3s ease;
}

.pdf-viewer.loaded .viewer-placeholder {
    display: none !important;
}

.single-page-container {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* This ensures the single page container is centered when visible */
.single-page-container:not([style*="display: none"]) {
    display: flex !important;
    justify-content: center;
    align-items: center;
}
/* =================== CANVAS DISPLAY FIXES =================== */
.canvas-container {
    position: relative;
    width: 100%;
    height: 100%;
}

#pdfCanvas {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    background: white !important;
}

#overlayCanvas {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background: transparent !important;
}

/* Ensure the page wrapper has proper dimensions */
.page-wrapper {
    background: white;
    box-shadow: var(--shadow-xl);
    border-radius: var(--border-radius-sm);
    overflow: hidden;
}
/* AdSense Styling */
.adsense-container {
    text-align: center;
}

.header-ad {
    margin: 15px auto;
}

.sidebar-ad {
    margin-bottom: 20px;
}

/* Mobile responsive ads */
@media (max-width: 768px) {
    .sidebar-ad {
        display: none; /* Hide sidebar ads on mobile */
    }
    

}

/* Prevent zoom breaking layout */
.canvas-container {
    max-width: 100%;
    overflow: hidden;
}

.page-wrapper {
    max-width: 100%;
    transform-origin: 0 0;
    transition: transform 0.2s ease;
}

/* Prevent canvas from exceeding container */
.pdf-canvas, .overlay-canvas {
    max-width: 100% !important;
    height: auto !important;
}

/* Add visual feedback when at max/min zoom */
.control-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* =================== PROGRESS OVERLAY =================== */
.progress-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    backdrop-filter: blur(5px);
}

.progress-container.hidden {
    display: none !important;
}

.progress-overlay {
    background: var(--white);
    border-radius: var(--border-radius-lg);
    padding: 2.5rem;
    max-width: 400px;
    width: 90%;
    box-shadow: var(--shadow-xl);
    text-align: center;
}

.progress-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
}

.loader-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid var(--gray-300);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.loader-text {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--dark);
    margin: 0;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--gray-300);
    border-radius: 4px;
    overflow: hidden;
    margin: 0.5rem 0;
}

.progress-fill {
    height: 100%;
    background: var(--gradient-primary);
    width: 0%;
    transition: width 0.3s ease;
    border-radius: 4px;
}

.cancel-btn {
    margin-top: 1rem;
    padding: 0.75rem 1.5rem;
    font-size: 0.875rem;
}

/* Mobile responsive */
@media (max-width: 768px) {
    .progress-overlay {
        padding: 2rem;
        margin: 1rem;
    }
    
    .loader-spinner {
        width: 50px;
        height: 50px;
    }
    
    .loader-text {
        font-size: 1rem;
    }
}

.pdf-canvas, .overlay-canvas {
    image-rendering: crisp-edges !important;
}
canvas {
    image-rendering: crisp-edges !important;
    image-rendering: pixelated !important;
}

.tools-grid {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 0.75rem !important;
    margin-bottom: 1.5rem !important;
}

@media (max-width: 768px) {
    .tools-grid {
        grid-template-columns: repeat(3, 1fr) !important;
    }
}

@media (max-width: 768px) {
    /* Fix tools grid icons */
    .tools-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.5rem !important;
    }
    
    .tool-btn {
        padding: 0.75rem !important;
    }
    
    .tool-icon {
        width: 32px !important;
        height: 32px !important;
        font-size: 1rem !important;
    }
    
    .tool-label {
        font-size: 0.75rem !important;
    }
    
    .tool-shortcut {
        font-size: 0.65rem !important;
        top: 2px !important;
        right: 2px !important;
    }
}
/* =================== MOBILE SCROLL FIXES =================== */
/* Fix body scroll on mobile */
@media (max-width: 768px) {
    html, body {
        overflow-x: hidden !important;
        overflow-y: auto !important;
        position: relative !important;
        height: auto !important;
        -webkit-overflow-scrolling: touch !important;
    }
    
    body.progress-active {
        /* Only block scroll if progress is active AND we're in viewer */
        overflow: hidden !important;
    }
    
    .annotation-app {
        min-height: 100vh;
    }
    
    /* Fix for iOS Safari */
    @supports (-webkit-touch-callout: none) {
        body {
            height: -webkit-fill-available !important;
        }
    }
    
    /* Ensure viewer section scrolls properly */
    .viewer-section {
        max-height: 70vh !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
    }
    
    /* Fix mobile modal tools grid */
    .modal-tools-grid {
        display: grid !important;
        grid-template-columns: repeat(4, 1fr) !important;
        gap: 10px !important;
        padding: 10px !important;
    }
    
    .mobile-tool-btn {
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: center !important;
        padding: 12px 8px !important;
        background: var(--gray-100) !important;
        border: 2px solid transparent !important;
        border-radius: var(--border-radius-md) !important;
        cursor: pointer !important;
        transition: all 0.2s ease !important;
        min-height: 80px !important;
        width: 100% !important;
    }
    
    .mobile-tool-btn.active {
        border-color: var(--primary) !important;
        background: var(--white) !important;
    }
    
    .mobile-tool-icon {
        font-size: 1.5rem !important;
        color: var(--gray-700) !important;
        margin-bottom: 6px !important;
    }
    
    .mobile-tool-btn.active .mobile-tool-icon {
        color: var(--primary) !important;
    }
    
    .mobile-tool-label {
        font-size: 0.75rem !important;
        font-weight: 600 !important;
        color: var(--gray-800) !important;
        text-align: center !important;
        line-height: 1.2 !important;
    }
    
    /* Progress overlay fixes */
    .progress-container {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        z-index: 10000 !important;
    }
}

/* Ensure canvas doesn't block touch events when not needed */
.overlay-canvas {
    touch-action: auto !important;
}