/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    height: 100%;
    overflow: hidden;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

/* Custom Properties for Colors */
:root {
    --primary-color: #667eea;
    --primary-dark: #5a6fd8;
    --secondary-color: #764ba2;
    --secondary-dark: #6a4190;
    --accent-color: #f093fb;
    --accent-dark: #e585f7;
    --success-color: #4ade80;
    --success-dark: #22c55e;
    --warning-color: #fbbf24;
    --warning-dark: #f59e0b;
    --danger-color: #f87171;
    --danger-dark: #ef4444;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --text-light: #9ca3af;
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-tertiary: #f1f5f9;
    --border-color: #e2e8f0;
    --border-light: #f1f5f9;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
}

/* App Container */
.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    background: var(--bg-secondary);
}

/* Header */
.app-header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    padding: 16px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    position: relative;
    overflow: hidden;
}

.app-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, rgba(255,255,255,0.1) 0%, transparent 100%);
    pointer-events: none;
}

.header-left .logo {
    display: flex;
    align-items: center;
    font-size: 18px;
    font-weight: 600;
}

.header-left .logo i {
    margin-right: 8px;
    color: var(--accent-color);
    font-size: 20px;
}

.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
    padding: 8px;
    margin-right: 16px;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.mobile-menu-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
}

@media (max-width: 768px) {
    .mobile-menu-toggle {
        display: block;
    }
}

.header-center {
    display: flex;
    align-items: center;
}

.file-controls {
    display: flex;
    gap: 12px;
}

.header-right {
    display: flex;
    align-items: center;
}

.zoom-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255,255,255,0.1);
    padding: 6px 12px;
    border-radius: 6px;
}

#zoomLevel {
    font-weight: 500;
    min-width: 50px;
    text-align: center;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    white-space: nowrap;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-success {
    background: var(--success-color);
    color: white;
    box-shadow: var(--shadow-sm);
}

.btn-success:hover:not(:disabled) {
    background: var(--success-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background: var(--text-secondary);
    color: white;
    box-shadow: var(--shadow-sm);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--text-primary);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-danger {
    background: var(--danger-color);
    color: white;
    box-shadow: var(--shadow-sm);
}

.btn-danger:hover:not(:disabled) {
    background: var(--danger-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-icon {
    padding: 8px;
    background: transparent;
    color: white;
}

.btn-icon:hover {
    background: rgba(255,255,255,0.1);
}

.btn-large {
    padding: 12px 24px;
    font-size: 16px;
}

/* Main Content */
.main-content {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* Sidebar */
.sidebar {
    width: 300px;
    background: var(--bg-primary);
    border-right: 1px solid var(--border-color);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
    transition: transform 0.3s ease;
}

.sidebar h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--border-light);
    position: relative;
}

.sidebar h3::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 40px;
    height: 2px;
    background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
    border-radius: 1px;
}

/* Tools Panel */
.tools-panel {
    padding: 20px;
    border-bottom: 1px solid #ecf0f1;
}

.tool-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.tool-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 16px 12px;
    background: var(--bg-secondary);
    border: 2px solid transparent;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-primary);
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
}

.tool-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: left 0.5s ease;
}

.tool-btn:hover::before {
    left: 100%;
}

.tool-btn:hover {
    background: var(--bg-tertiary);
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.tool-btn.active {
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    color: white;
    border-color: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.tool-btn i {
    font-size: 18px;
    margin-bottom: 4px;
}

/* Tool Properties */
/* Tool Properties Panel Styles */
.tool-properties {
    background: linear-gradient(145deg, #f8f9fa, #e9ecef);
    border-radius: 12px;
    padding: 15px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    margin-top: 15px;
    max-height: 300px;
    overflow-y: auto;
    transition: all 0.3s ease;
}

.tool-properties h3 {
    color: #495057;
    font-size: 16px;
    margin-bottom: 15px;
    padding-bottom: 8px;
    border-bottom: 2px solid #dee2e6;
    font-weight: 600;
}

.property-group {
    margin-bottom: 15px;
    padding: 12px;
    background: #ffffff;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    transition: all 0.2s ease;
}

.property-group:hover {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.property-group label {
    display: block;
    margin-bottom: 6px;
    color: #495057;
    font-size: 13px;
    font-weight: 500;
}

.property-group input[type="color"] {
    width: 100%;
    height: 36px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    background: none;
}

.property-group input[type="range"] {
    width: 100%;
    margin: 8px 0;
 
    height: 6px;
    border-radius: 3px;
    background: #dee2e6;
    outline: none;
}

.property-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #007bff;
    cursor: pointer;
    transition: all 0.2s ease;
}

.property-group input[type="range"]::-webkit-slider-thumb:hover {
    background: #0056b3;
    transform: scale(1.1);
}

.property-group input[type="text"], 
.property-group input[type="number"],
.property-group select {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #ced4da;
    border-radius: 6px;
    font-size: 13px;
    transition: all 0.2s ease;
}

.property-group input[type="text"]:focus, 
.property-group input[type="number"]:focus,
.property-group select:focus {
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.25);
    outline: none;
}

.property-group input[type="checkbox"] {
    margin-right: 8px;
    transform: scale(1.2);
}

.property-group span {
    font-size: 12px;
    color: #6c757d;
    font-weight: 500;
}

/* Floating Action Button Styles */
.fab {
    position: fixed;
    bottom: 25px;
    right: 25px;
    z-index: 1000;
}

.fab-main {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(145deg, #007bff, #0056b3);
    color: white;
    border: none;
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.4);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    transition: all 0.3s ease;
}

.fab-main:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 16px rgba(0, 123, 255, 0.5);
}

.fab-main:focus {
    outline: none;
}

.fab-options {
    position: absolute;
    bottom: 70px;
    right: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: all 0.3s ease;
}

.fab.active .fab-options {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.fab-option {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: white;
    color: #495057;
    border: none;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    transition: all 0.3s ease;
    transform: scale(0);
}

.fab.active .fab-option {
    transform: scale(1);
}

.fab-option:nth-child(1) {
    transition-delay: 0.05s;
}

.fab-option:nth-child(2) {
    transition-delay: 0.1s;
}

.fab-option:nth-child(3) {
    transition-delay: 0.15s;
}

.fab-option:nth-child(4) {
    transition-delay: 0.2s;
}

.fab-option:nth-child(5) {
    transition-delay: 0.25s;
}

.fab-option:hover {
    background: #f8f9fa;
    transform: scale(1.1);
    color: #007bff;
}

/* Instructions Panel Styles */
.instructions-panel {
    position: fixed;
    top: 0;
    right: -400px;
    width: 400px;
    height: 100vh;
    background: white;
    box-shadow: -5px 0 15px rgba(0, 0, 0, 0.1);
    z-index: 1001;
    transition: right 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.instructions-panel.active {
    right: 0;
}

.instructions-header {
    background: linear-gradient(145deg, #007bff, #0056b3);
    color: white;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.instructions-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.close-btn {
    background: none;
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.close-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.instructions-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.instruction-item {
    margin-bottom: 25px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 10px;
    border-left: 4px solid #007bff;
    transition: all 0.3s ease;
}

.instruction-item:hover {
    background: #e9ecef;
    transform: translateX(5px);
}

.instruction-item h4 {
    margin: 0 0 10px 0;
    color: #007bff;
    font-size: 16px;
    display: flex;
    align-items: center;
}

.instruction-item h4 i {
    margin-right: 8px;
}

.instruction-item p {
    margin: 0;
    color: #495057;
    font-size: 14px;
    line-height: 1.5;
}

/* Overlay for instructions panel */
.instructions-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.instructions-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .instructions-panel {
        width: 100%;
        right: -100%;
    }
    
    .tool-properties {
        max-height: 200px;
    }
    
    .property-group {
        padding: 8px;
    }
    
    .property-group label {
        font-size: 12px;
    }
}

/* Page Operations */
.page-operations {
    padding: 20px;
    border-bottom: 1px solid #ecf0f1;
}

.page-operations .btn {
    width: 100%;
    margin-bottom: 8px;
    justify-content: center;
}

/* Find & Replace */
.find-replace {
    padding: 20px;
    border-bottom: 1px solid #ecf0f1;
}

.find-replace input {
    width: 100%;
    padding: 8px;
    margin-bottom: 8px;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    font-size: 14px;
}

.find-replace .btn {
    width: 100%;
    margin-bottom: 4px;
    justify-content: center;
}

/* Thumbnails */
.thumbnails-panel {
    padding: 20px;
    flex: 1;
}

.thumbnails-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 400px;
    overflow-y: auto;
}

.thumbnail {
    position: relative;
    border: 2px solid transparent;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.thumbnail:hover {
    border-color: #3498db;
}

.thumbnail.active {
    border-color: #2980b9;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

.thumbnail canvas {
    width: 100%;
    height: auto;
    border-radius: 2px;
}

.thumbnail-label {
    position: absolute;
    bottom: 4px;
    left: 4px;
    background: rgba(0,0,0,0.7);
    color: white;
    padding: 2px 6px;
    border-radius: 2px;
    font-size: 10px;
    font-weight: 500;
}

/* Editor Main */
.editor-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: #f5f5f5;
}

.canvas-container {
    flex: 1;
    overflow: auto;
    padding: 20px;
    display: flex;
    justify-content: center;
}

.pdf-container {
    max-width: 800px;
    width: 100%;
}

.welcome-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 500px;
    background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
    border-radius: 20px;
    box-shadow: var(--shadow-xl);
    text-align: center;
    padding: 60px 40px;
    position: relative;
    overflow: hidden;
}

.welcome-screen::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, rgba(102, 126, 234, 0.05) 0%, rgba(118, 75, 162, 0.05) 100%);
    pointer-events: none;
}

.welcome-screen i {
    font-size: 80px;
    color: var(--primary-color);
    margin-bottom: 24px;
    animation: pulse 2s infinite;
}

.welcome-screen h2 {
    font-size: 32px;
    color: var(--text-primary);
    margin-bottom: 16px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.welcome-screen p {
    color: var(--text-secondary);
    margin-bottom: 32px;
    font-size: 18px;
    line-height: 1.6;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

/* PDF Page */
.pdf-page {
    position: relative;
    margin-bottom: 24px;
    background: var(--bg-primary);
    box-shadow: var(--shadow-lg);
    border-radius: 16px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.pdf-page:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-xl);
}

.pdf-page canvas {
    display: block;
    width: 100%;
    height: auto;
}

.pdf-page-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.pdf-page-overlay.active {
    pointer-events: all;
}

/* Annotations */
.annotation {
    position: absolute;
    cursor: move;
    user-select: none;
}

.annotation.selected {
    outline: 2px solid #3498db;
    outline-offset: 2px;
}

.annotation.text-annotation {
    background: transparent;
    border: 1px dashed transparent;
    padding: 2px;
    min-width: 50px;
    min-height: 20px;
}

.annotation.text-annotation.editing {
    border-color: #3498db;
    background: rgba(52, 152, 219, 0.1);
}

.annotation.text-annotation input {
    background: transparent;
    border: none;
    outline: none;
    width: 100%;
    height: 100%;
    font-family: inherit;
    font-size: inherit;
    color: inherit;
}

.annotation.image-annotation img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.annotation.form-annotation {
    background: rgba(52, 152, 219, 0.1);
    border: 1px solid #3498db;
    display: flex;
    align-items: center;
    padding: 4px 8px;
}

.annotation.form-annotation input,
.annotation.form-annotation select {
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 2px;
    padding: 2px 4px;
    font-size: 12px;
    width: 100%;
}

.annotation.signature-annotation {
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid #dee2e6;
}

/* Resize Handles */
.resize-handle {
    position: absolute;
    width: 8px;
    height: 8px;
    background: #3498db;
    border: 1px solid white;
    border-radius: 50%;
    cursor: nw-resize;
}

.resize-handle.nw { top: -4px; left: -4px; cursor: nw-resize; }
.resize-handle.ne { top: -4px; right: -4px; cursor: ne-resize; }
.resize-handle.sw { bottom: -4px; left: -4px; cursor: sw-resize; }
.resize-handle.se { bottom: -4px; right: -4px; cursor: se-resize; }

/* Modals */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.modal-content {
    background: var(--bg-primary);
    border-radius: 16px;
    box-shadow: var(--shadow-xl);
    max-width: 500px;
    width: 90%;
    max-height: 90%;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border-color);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px;
    border-bottom: 1px solid #ecf0f1;
}

.modal-header h3 {
    margin: 0;
    color: #2c3e50;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #7f8c8d;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    color: #2c3e50;
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
}

.modal-body label {
    display: block;
    margin: 8px 0 4px;
    font-weight: 500;
    color: #2c3e50;
}

.modal-body input,
.modal-body select {
    width: 100%;
    padding: 8px;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    font-size: 14px;
    margin-bottom: 12px;
}

/* Signature Canvas */
#signatureCanvas {
    border: 1px solid #dee2e6;
    border-radius: 4px;
    cursor: crosshair;
    width: 100%;
    height: 200px;
    margin-bottom: 12px;
}

.signature-controls,
.image-controls,
.form-controls {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

/* Image Preview */
.image-preview {
    max-width: 100%;
    max-height: 200px;
    margin: 12px 0;
    border: 1px dashed #dee2e6;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100px;
}

.image-preview img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255,255,255,0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 20000;
}

.loading-content {
    text-align: center;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--border-light);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 16px;
}

.progress-bar {
    width: 300px;
    height: 8px;
    background: var(--border-light);
    border-radius: 4px;
    margin: 16px auto 0;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
    border-radius: 4px;
    transition: width 0.3s ease;
    width: 0%;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .app-header {
        padding: 12px 16px;
        flex-wrap: wrap;
        gap: 12px;
    }
    
    .header-left .logo span {
        display: none;
    }
    
    .file-controls {
        order: 3;
        width: 100%;
        justify-content: center;
        margin-top: 8px;
    }
    
    .file-controls .btn span {
        display: none;
    }
    
    .sidebar {
        position: fixed;
        left: -300px;
        top: 80px;
        height: calc(100vh - 80px);
        z-index: 1000;
        transition: transform 0.3s ease;
        box-shadow: var(--shadow-xl);
        backdrop-filter: blur(10px);
        background: rgba(255, 255, 255, 0.95);
    }
    
    .sidebar.open {
        transform: translateX(300px);
    }
    
    .tool-group {
        grid-template-columns: 1fr 1fr 1fr 1fr;
        gap: 12px;
    }
    
    .tool-btn {
        padding: 12px 8px;
        font-size: 10px;
        border-radius: 8px;
    }
    
    .tool-btn i {
        font-size: 16px;
        margin-bottom: 6px;
    }
    
    .canvas-container {
        padding: 16px;
    }
    
    .pdf-page {
        margin-bottom: 16px;
        border-radius: 12px;
    }
    
    .modal-content {
        margin: 20px;
        width: calc(100% - 40px);
        border-radius: 12px;
    }
    
    .thumbnails-container {
        max-height: 200px;
    }
    
    .welcome-screen {
        height: 400px;
        padding: 40px 20px;
        border-radius: 16px;
    }
    
    .welcome-screen h2 {
        font-size: 24px;
    }
    
    .welcome-screen p {
        font-size: 16px;
    }
}

@media (max-width: 480px) {
    .app-header {
        padding: 8px 12px;
    }
    
    .tool-group {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }
    
    .canvas-container {
        padding: 8px;
    }
    
    .sidebar {
        width: 280px;
        left: -280px;
    }
    
    .zoom-controls span {
        display: none;
    }
    
    .fab {
        bottom: 20px;
        right: 20px;
    }
    
    .fab-main {
        width: 50px;
        height: 50px;
        font-size: 20px;
    }
    
    .fab-option {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }
    
    .welcome-screen {
        height: 350px;
        padding: 30px 16px;
    }
    
    .welcome-screen h2 {
        font-size: 20px;
    }
    
    .welcome-screen p {
        font-size: 14px;
    }
}

/* Touch Support */
@media (hover: none) and (pointer: coarse) {
    .tool-btn:hover {
        background: #f8f9fa;
        border-color: transparent;
    }
    
    .tool-btn:active {
        background: #e9ecef;
        border-color: #dee2e6;
    }

    
    .annotation {
        /* Larger touch targets */
        min-width: 44px;
        min-height: 44px;
    }
    
    .resize-handle {
        width: 12px;
        height: 12px;
    }
}

/* High DPI Support */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .pdf-page canvas {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Focus Styles */
.btn:focus,
input:focus,
select:focus,
textarea:focus {
    outline: 2px solid #3498db;
    outline-offset: 2px;
}

/* Accessibility */
.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;
}

/* Enhanced Annotation Styles */
.stamp-annotation {
    border: 3px solid var(--warning-color);
    background: rgba(255, 255, 255, 0.9);
    font-weight: bold;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    transform: rotate(-15deg);
    box-shadow: var(--shadow-md);
    user-select: none;
}

/* Crop Tool Styles */
.crop-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.3);
    z-index: 1000;
    cursor: crosshair;
}

.crop-selection {
    position: absolute;
    border: 2px dashed #fff;
    background: rgba(255, 255, 255, 0.1);
    pointer-events: none;
}

.crop-controls {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 1001;
    display: flex;
    gap: 10px;
}

.crop-controls .btn {
    box-shadow: var(--shadow-lg);
}

.comment-annotation {
    background: #FFFF99;
    border: 1px solid #ccc;
    border-radius: 4px;
    padding: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    font-size: 12px;
    word-wrap: break-word;
    overflow: hidden;
}

.comment-annotation .author {
    font-weight: bold;
    font-size: 10px;
    margin-bottom: 4px;
    color: #333;
}

.redaction-annotation {
    background: #000000;
    cursor: move;
}

.redaction-annotation.pattern {
    background: repeating-linear-gradient(
        45deg,
        #000000,
        #000000 5px,
        transparent 5px,
        transparent 10px
    );
}

.link-annotation {
    color: #0066CC;
    text-decoration: underline;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
}

.link-annotation:hover {
    color: #004499;
    background: rgba(0, 102, 204, 0.1);
}

.watermark-annotation {
    font-size: 36px;
    font-weight: bold;
    color: #808080;
    opacity: 0.3;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    user-select: none;
}

.measure-annotation {
    pointer-events: none;
}

.measure-annotation svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.measure-annotation .measure-text {
    position: absolute;
    background: white;
    padding: 2px 4px;
    font-size: 12px;
    border: 1px solid;
    border-radius: 2px;
}

.attachment-annotation {
    background: #e3f2fd;
    border: 1px solid #2196f3;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: #1976d2;
    cursor: move;
}

.attachment-annotation:hover {
    background: #bbdefb;
}

/* Enhanced Property Panel Styles */
.property-panel .range-input {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.property-panel .range-input input[type="range"] {
    flex: 1;
}

.property-panel .range-value {
    min-width: 40px;
    font-size: 12px;
    color: var(--text-secondary);
}

/* Enhanced Input Styles */
.property-group input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    background: var(--border-light);
    border-radius: 3px;
    outline: none;
}

.property-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    background: var(--primary-color);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    transition: all 0.2s ease;
}

.property-group input[type="range"]::-webkit-slider-thumb:hover {
    background: var(--primary-dark);
    transform: scale(1.1);
    box-shadow: var(--shadow-md);
}

.property-group input[type="color"] {
    border: 2px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.property-group input[type="color"]:hover {
    border-color: var(--primary-color);
    transform: scale(1.05);
}

.property-group select {
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    transition: all 0.2s ease;
}

.property-group select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.property-panel .color-input {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.property-panel .color-input input[type="color"] {
    width: 40px;
    height: 30px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.property-panel .checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 8px;
}

.property-panel .checkbox-group label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    cursor: pointer;
}

.property-panel textarea {
    width: 100%;
    min-height: 60px;
    padding: 6px;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    font-size: 12px;
    resize: vertical;
}

/* Modal Enhancements */
.modal-tabs {
    display: flex;
    border-bottom: 1px solid #dee2e6;
    margin-bottom: 16px;
}

.modal-tab {
    padding: 8px 16px;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 14px;
    color: #666;
    border-bottom: 2px solid transparent;
}

.modal-tab.active {
    color: #3498db;
    border-bottom-color: #3498db;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Notifications */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    max-width: 400px;
    animation: slideInRight 0.3s ease;
}

.notification-content {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    border-radius: 12px;
    box-shadow: var(--shadow-xl);
    color: white;
    font-weight: 500;
}

.notification-success {
    background: linear-gradient(135deg, var(--success-color), var(--success-dark));
}

.notification-error {
    background: linear-gradient(135deg, var(--danger-color), var(--danger-dark));
}

.notification-info {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
}

.notification-close {
    background: none;
    border: none;
    color: white;
    font-size: 18px;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
    margin-left: auto;
}

.notification-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Floating Action Button */
.fab {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 1000;
}

.fab-main {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    box-shadow: var(--shadow-xl);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.fab-main:hover {
    transform: scale(1.1);
    box-shadow: 0 20px 40px rgba(102, 126, 234, 0.4);
}

.fab-options {
    position: absolute;
    bottom: 70px;
    right: 0;
    display: flex;
    flex-direction: column;
    gap: 16px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: all 0.3s ease;
}

.fab:hover .fab-options {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.fab-option {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--bg-primary);
    border: 2px solid var(--border-color);
    color: var(--text-primary);
    font-size: 18px;
    cursor: pointer;
    box-shadow: var(--shadow-lg);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.fab-option:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    transform: scale(1.1);
}

/* Print Styles */
@media print {
    .app-header,
    .sidebar,
    .fab {
        display: none;
    }
    
    .editor-main {
        padding: 0;
    }
    
    .pdf-page {
        box-shadow: none;
        margin: 0;
        page-break-after: always;
    }
}
.annotation {
    position: absolute;
    box-sizing: border-box;
}

.annotation.selected {
    outline: 2px solid #007bff;
    outline-offset: 2px;
}

.resize-handle {
    position: absolute;
    width: 10px;
    height: 10px;
    background-color: #fff;
    border: 1px solid #007bff;
    border-radius: 50%;
    z-index: 1000;
    display: none;
}

.resize-handle-nw {
    left: -5px;
    top: -5px;
    cursor: nw-resize;
}

.resize-handle-ne {
    right: -5px;
    top: -5px;
    cursor: ne-resize;
}

.resize-handle-sw {
    left: -5px;
    bottom: -5px;
    cursor: sw-resize;
}

.resize-handle-se {
    right: -5px;
    bottom: -5px;
    cursor: se-resize;
}