/* Import Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* Base Styles */
body {
    font-family: 'Inter', sans-serif;
}

/* Primary Brand Color */
.text-primary {
    color: #2563eb;
}
.dark .text-primary {
    color: #60a5fa;
}
.hover\:text-primary:hover {
    color: #1d4ed8;
}
.dark .hover\:text-primary:hover {
    color: #93c5fd;
}

/* Dark Mode Scrollbar */
.dark ::-webkit-scrollbar {
    width: 12px;
}
.dark ::-webkit-scrollbar-track {
    background: #1f2937;
}
.dark ::-webkit-scrollbar-thumb {
    background-color: #4b5563;
    border-radius: 20px;
    border: 3px solid #1f2937;
}

/* Canvas Styles */
#pdf-canvas, .pdf-page-canvas {
    border: 1px solid #d1d5db;
    cursor: default;
    border-radius: 0.5rem;
    margin-bottom: 1rem;
}
.dark #pdf-canvas, .dark .pdf-page-canvas {
    border-color: #4b5563;
}

/* Tool Card Hover Effect */
.tool-card {
    transition: transform 0.2s, box-shadow 0.2s;
}
.tool-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
}
.dark .tool-card:hover {
    box-shadow: 0 10px 15px -3px rgba(0,0,0,0.2), 0 4px 6px -2px rgba(0,0,0,0.1);
}

/* Loader Animation */
.loader {
    border: 4px solid #f3f4f6;
    border-top: 4px solid #3b82f6;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
}
.dark .loader {
    border-color: #374151;
    border-top-color: #3b82f6;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Page Thumbnails */
.page-thumbnail {
    position: relative;
    cursor: grab;
    border: 2px solid #e5e7eb;
    padding: 4px;
    background: white;
    border-radius: 4px;
    overflow: visible;
}
.dark .page-thumbnail {
    background: #374151;
    border-color: #4b5563;
}
.page-thumbnail.selected {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.5);
}
.page-thumbnail.ghost {
    opacity: 0.5;
    background: #c7d2fe;
}

/* Delete Button on Thumbnails */
.page-thumbnail .delete-page-btn {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #ef4444;
    color: white;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid white;
    cursor: pointer;
    transition: all 0.2s;
    z-index: 10;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}
.page-thumbnail .delete-page-btn:hover {
    background: #dc2626;
    transform: scale(1.1);
}
.dark .page-thumbnail .delete-page-btn {
    border-color: #1f2937;
}

/* Page Number Badge */
.page-number {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0,0,0,0.6);
    color: white;
    text-align: center;
    font-size: 12px;
    padding: 2px 0;
}

/* Active Tool Button */
.tool-btn.active, .edit-toolbar-btn.active {
    background-color: #3b82f6;
    color: white;
}

/* Signature Selection */
.signature-item {
    position: relative;
    transition: all 0.2s;
}
.signature-item:hover {
    transform: scale(1.05);
}
.signature-item.selected-for-placing {
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.5);
    border-radius: 4px;
}

/* PDF Scroll View */
#pdf-scroll-view {
    overflow-y: auto;
    max-height: 80vh;
    background-color: #f3f4f6;
    padding: 1rem;
    border-radius: 0.5rem;
}
.dark #pdf-scroll-view {
    background-color: #1f2937;
}

/* Drag Over Effect */
.drag-over-active {
    border: 2px dashed #3b82f6 !important;
    background-color: #eff6ff !important;
}
.dark .drag-over-active {
    background-color: #1e3a8a !important;
}

/* Category Button Active State */
.category-btn.active {
    background-color: #3b82f6;
    color: white;
    border-color: #3b82f6;
}

/* Edit PDF Specific Styles */
.tool-btn {
    @apply w-full flex items-center gap-2 p-3 rounded-lg text-left font-medium transition-colors bg-gray-100 dark:bg-gray-700 hover:bg-gray-200 dark:hover:bg-gray-600;
}
.control-group {
    @apply mb-4;
}
/* Import Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* Base Styles */
body {
    font-family: 'Inter', sans-serif;
}

/* Primary Brand Color */
.text-primary {
    color: #2563eb;
}
.dark .text-primary {
    color: #60a5fa;
}
.hover\:text-primary:hover {
    color: #1d4ed8;
}
.dark .hover\:text-primary:hover {
    color: #93c5fd;
}

/* Dark Mode Scrollbar */
.dark ::-webkit-scrollbar {
    width: 12px;
}
.dark ::-webkit-scrollbar-track {
    background: #1f2937;
}
.dark ::-webkit-scrollbar-thumb {
    background-color: #4b5563;
    border-radius: 20px;
    border: 3px solid #1f2937;
}

/* Canvas Styles */
#pdf-canvas, .pdf-page-canvas {
    border: 1px solid #d1d5db;
    cursor: default;
    border-radius: 0.5rem;
    margin-bottom: 1rem;
}
.dark #pdf-canvas, .dark .pdf-page-canvas {
    border-color: #4b5563;
}

/* Tool Card Hover Effect */
.tool-card {
    transition: transform 0.2s, box-shadow 0.2s;
}
.tool-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
}
.dark .tool-card:hover {
    box-shadow: 0 10px 15px -3px rgba(0,0,0,0.2), 0 4px 6px -2px rgba(0,0,0,0.1);
}

/* Loader Animation */
.loader {
    border: 4px solid #f3f4f6;
    border-top: 4px solid #3b82f6;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
}
.dark .loader {
    border-color: #374151;
    border-top-color: #3b82f6;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Page Thumbnails */
.page-thumbnail {
    position: relative;
    cursor: grab;
    border: 2px solid #e5e7eb;
    padding: 4px;
    background: white;
    border-radius: 4px;
    overflow: visible;
}
.dark .page-thumbnail {
    background: #374151;
    border-color: #4b5563;
}
.page-thumbnail.selected {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.5);
}
.page-thumbnail.ghost {
    opacity: 0.5;
    background: #c7d2fe;
}

/* Delete Button on Thumbnails */
.page-thumbnail .delete-page-btn {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #ef4444;
    color: white;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid white;
    cursor: pointer;
    transition: all 0.2s;
    z-index: 10;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}
.page-thumbnail .delete-page-btn:hover {
    background: #dc2626;
    transform: scale(1.1);
}
.dark .page-thumbnail .delete-page-btn {
    border-color: #1f2937;
}

/* Page Number Badge */
.page-number {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0,0,0,0.6);
    color: white;
    text-align: center;
    font-size: 12px;
    padding: 2px 0;
}

/* Active Tool Button */
.tool-btn.active, .edit-toolbar-btn.active {
    background-color: #3b82f6;
    color: white;
}

/* Signature Selection */
.signature-item {
    position: relative;
    transition: all 0.2s;
}
.signature-item:hover {
    transform: scale(1.05);
}
.signature-item.selected-for-placing {
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.5);
    border-radius: 4px;
}

/* PDF Scroll View */
#pdf-scroll-view {
    overflow-y: auto;
    max-height: 80vh;
    background-color: #f3f4f6;
    padding: 1rem;
    border-radius: 0.5rem;
}
.dark #pdf-scroll-view {
    background-color: #1f2937;
}

/* Drag Over Effect */
.drag-over-active {
    border: 2px dashed #3b82f6 !important;
    background-color: #eff6ff !important;
}
.dark .drag-over-active {
    background-color: #1e3a8a !important;
}

/* Category Button Active State */
.category-btn.active {
    background-color: #3b82f6;
    color: white;
    border-color: #3b82f6;
}

/* Edit PDF Specific Styles */
.tool-btn {
    @apply w-full flex items-center gap-2 p-3 rounded-lg text-left font-medium transition-colors bg-gray-100 dark:bg-gray-700 hover:bg-gray-200 dark:hover:bg-gray-600;
}
.control-group {
    @apply mb-4;
}
.control-label {
    @apply block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2;
}
.form-control {
    @apply w-full p-2 border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-700 text-gray-900 dark:text-gray-100 focus:ring-2 focus:ring-blue-500 focus:outline-none;
}
input[type="color"].form-control {
    @apply h-10 p-1;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.animate-fade-in {
    animation: fadeIn 0.5s ease-out forwards;
}

/* Sejda-Style PDF Editor Styles */
.sejda-tool-btn {
    color: #4b5563;
    background-color: transparent;
}
.dark .sejda-tool-btn {
    color: #d1d5db;
}
.sejda-tool-btn:hover {
    background-color: #f3f4f6;
    color: #1f2937;
}
.dark .sejda-tool-btn:hover {
    background-color: #374151;
    color: #f9fafb;
}
.sejda-tool-btn.active {
    background-color: #eff6ff !important;
    color: #2563eb !important;
}
.dark .sejda-tool-btn.active {
    background-color: rgba(30, 58, 138, 0.4) !important;
    color: #60a5fa !important;
}

.sejda-sheet {
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.15), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    background-color: #ffffff;
    user-select: none;
}

.sejda-existing-text {
    box-sizing: border-box;
    transition: background-color 0.1s, outline 0.1s;
}
.sejda-existing-text:hover {
    background-color: rgba(59, 130, 246, 0.15);
    outline: 1px dashed #3b82f6;
}

.sejda-element {
    box-sizing: border-box;
}
.sejda-element.active,
.sejda-element:hover {
    outline: 1px solid rgba(59, 130, 246, 0.7);
}

.sejda-editable-content {
    cursor: text;
    user-select: text;
    white-space: pre !important;
    word-break: keep-all !important;
    background-color: transparent !important;
}
.sejda-editable-content:focus {
    outline: none !important;
    background-color: transparent !important;
}

.sejda-element.active {
    outline: 1.5px dashed #2563eb !important;
}

.sejda-find-highlight {
    animation: findPulse 1.2s ease-in-out infinite alternate;
}
@keyframes findPulse {
    from { opacity: 0.5; }
    to { opacity: 0.95; }
}

.sejda-handle {
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

/* Comic Cloud Comment Styling */
.comic-speech-cloud {
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.15));
}
.comic-bubble-body {
    border: 2.5px solid #1e293b;
    border-radius: 20px;
    box-shadow: 4px 4px 0px #1e293b;
}

/* Floating Toolbar & Shape Swatches */
.float-swatch, .shape-sub-swatch {
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.float-swatch:hover, .shape-sub-swatch:hover {
    transform: scale(1.25);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.5);
}
