/* Import Poppins font */

@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap');

/* Basic reset and layout */

:root {
    --background: #050505;
    --card-background: #1A1A1A;
    --text-primary: #ffffff;
    --text-secondary: #9ca3af;
    --border: #374151;
    --button-bg: #2563eb;
    --button-hover: #1d4ed8;
    --radius: 0.5rem;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    transition: none !important;
}

body {
    font-family: 'Sewimple', sans-serif;
    background-color: var(--background);
    color: var(--text-primary);
}

.header {
    text-align: center;
    padding: 20px;
    background-color: #fff;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    width: 100%;
}

.header h1 {
    font-size: 2rem;
    margin: 0;
    color: #333;
}

.header p {
    font-size: 1rem;
    margin-top: 10px;
    color: #666;
}

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

.tool-card {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    padding: 20px;
    text-align: center;
    transition: all 0.2s ease-in-out;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    display: block;
}

.tool-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.1);
    cursor: pointer;
}

.tool-card:active {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.tool-card .icon {
    font-size: 2rem;
    margin-bottom: 15px;
    display: inline-block;
}

.tool-card h3 {
    font-size: 1.2rem;
    margin: 0 0 10px;
    color: inherit;
    text-decoration: none;
}

.tool-card p {
    font-size: 0.9rem;
    color: #555;
    color: inherit;
    text-decoration: none;
}

.new-label {
    display: inline-block;
    background: #ff5252;
    color: #fff;
    font-size: 0.8rem;
    padding: 2px 8px;
    border-radius: 4px;
    margin-top: 10px;
}

body {
    margin: 0;
    padding: 0;
    font-family: Arial, sans-serif;
    background: #f8f9fa;
}


/* Main container */

.merge-container {
    display: flex;
    justify-content: center;
    padding: 20px;
    background-color: white;
    transition: background-color 0.3s;
}

html.dark .merge-container {
    background-color: #020817;
}


/* Left panel */

.left-panel {
    width: 800px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}


/* Upload box */

.upload-box {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 25px;
    text-align: center;
    border: 2px dashed #dee2e6;
    margin-bottom: 20px;
    transition: background-color 0.3s, border-color 0.3s;
}

html.dark .upload-box {
    background: #1A1A1A;
    border-color: #374151;
}

.upload-box:hover {
    background-color: rgba(76, 175, 80, 0.05);
}

.upload-box.file-selected {
    background-color: rgba(76, 175, 80, 0.1);
}

.upload-icon {
    margin-bottom: 10px;
    color: #666;
}

.upload-box h2 {
    font-family: 'Poppins', sans-serif;
    font-size: 20px;
    margin: 0 0 8px;
    color: #333;
}

.upload-text {
    color: #666;
    font-size: 14px;
    margin: 0 0 10px;
}

.upload-area {
    border: none;
    padding: 10px;
    margin-top: 10px;
    cursor: pointer;
}

.choose-files-btn {
    background: var(--button-bg);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    width: auto;
    display: inline-block;
}

.choose-files-btn:hover {
    background: var(--button-hover);
}


/* PDF List */

.pdf-list {
    background: var(--card-background);
    border-radius: var(--radius);
    padding: 1rem;
    margin-top: 1rem;
    border: 1px solid var(--border);
}

html.dark .pdf-list {
    background: #1A1A1A;
}

.pdf-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: var(--background);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

html.dark .pdf-item {
    background: #1A1A1A;
    border-color: #374151;
}

.pdf-item:hover {
    border-color: #007bff;
    box-shadow: 0 3px 6px rgba(0, 123, 255, 0.1);
    transform: translateY(-1px);
}

.pdf-item:last-child {
    margin-bottom: 0;
}

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

.pdf-name {
    font-family: 'Sewimple', sans-serif;
    font-size: 14px;
    color: var(--text-primary);
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pdf-size {
    font-size: 12px;
    color: var(--text-secondary);
}

.move-buttons {
    display: flex;
    gap: 0.5rem;
}

.move-button {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    background: var(--card-background);
    border-radius: 4px;
    cursor: pointer;
    color: var(--text-primary);
}

html.dark .move-button {
    background: #374151;
    border-color: #4b5563;
    color: #fff;
}

.move-button:hover:not(:disabled) {
    background: var(--background);
    border-color: var(--button-bg);
    color: var(--button-bg);
}

.move-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.page-selection {
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
}

.page-selection label {
    color: #666;
    font-size: 13px;
    font-weight: 500;
    transition: color 0.3s;
}

html.dark .page-selection label {
    color: #9ca3af;
}

.page-selection input {
    width: 100px;
    padding: 6px 10px;
    border: 1px solid #ced4da;
    border-radius: 6px;
    font-size: 13px;
    color: #495057;
    transition: background-color 0.3s, border-color 0.3s, color 0.3s;
}

html.dark .page-selection input {
    background: #374151;
    border-color: #4b5563;
    color: #fff;
}

.page-selection input:focus {
    border-color: #007bff;
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

.page-hint {
    color: #8898aa;
    font-size: 12px;
    margin-left: 6px;
    opacity: 0.8;
    white-space: nowrap;
    transition: color 0.3s;
}

html.dark .page-hint {
    color: #9ca3af;
}


/* Style for the example text */

.page-hint::before {
    content: "(";
    margin-right: 1px;
}

.page-hint::after {
    content: ")";
    margin-left: 1px;
}


/* Remove button improvements */

.remove-button {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #fee2e2;
    background: white;
    border-radius: 6px;
    cursor: pointer;
    color: #dc3545;
    transition: all 0.2s ease;
    font-size: 16px;
    padding: 0;
}

.remove-button:hover {
    background: #fff5f5;
    border-color: #dc3545;
    color: #dc3545;
}


/* Scrollbar styling */

.pdf-list::-webkit-scrollbar {
    width: 8px;
}

.pdf-list::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.pdf-list::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 4px;
}

.pdf-list::-webkit-scrollbar-thumb:hover {
    background: #999;
}


/* Right panel */

.right-panel {
    flex: 1;
    background: white;
    border-radius: 8px;
    padding: 20px;
    min-height: 600px;
    max-height: 800px;
    display: flex;
    flex-direction: column;
}

.preview-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.preview-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.pdf-page-container {
    background: white;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    border-radius: 4px;
    overflow: hidden;
}

.pdf-page-container:last-child {
    margin-bottom: 0;
}

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


/* Preview header with download button */

.preview-header {
    padding: 15px 20px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
}

.download-button {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #28a745;
    color: white;
    border: none;
    padding: 10px 24px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.download-button:hover {
    background: #218838;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(40, 167, 69, 0.2);
}


/* Merge button */

.merge-button {
    background: var(--button-bg);
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    font-weight: 500;
    border: none;
    font-size: 14px;
    cursor: pointer;
    width: 100%;
}

.merge-button:hover:not(:disabled) {
    background: var(--button-hover);
}

.merge-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}


/* Header */

.tool-header {
    padding: 20px;
}

.tool-header h1 {
    font-family: 'Poppins', sans-serif;
    font-size: 24px;
    margin: 0;
    color: #333;
    transition: color 0.3s;
}

html.dark .tool-header h1 {
    color: #fff;
}

.tool-header p {
    font-family: 'Poppins', sans-serif;
    font-size: 14px;
    color: #666;
    margin: 5px 0 0;
    transition: color 0.3s;
}

html.dark .tool-header p {
    color: #9ca3af;
}


/* Preview placeholder */

.preview-placeholder {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #666;
    padding: 40px;
}

.preview-icon {
    margin-bottom: 15px;
    opacity: 0.7;
}

.preview-placeholder p {
    margin: 0;
    font-size: 15px;
    color: #666;
}

.text-muted-foreground {
    color: #666;
}

.bg-primary {
    background-color: #007bff;
}

.bg-green-500 {
    background-color: #28a745;
}

.border-border {
    border-color: #ddd;
}

.hover\:border-primary:hover {
    border-color: #007bff;
}

.rounded {
    border-radius: 0.375rem;
}

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

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

.text-lg {
    font-size: 1.125rem;
}

.text-2xl {
    font-size: 1.5rem;
}

.font-bold {
    font-weight: 700;
}

.font-semibold {
    font-weight: 600;
}

.mt-4 {
    margin-top: 1rem;
}

.mb-8 {
    margin-bottom: 2rem;
}

.w-full {
    width: 100%;
}

.max-w-md {
    max-width: 28rem;
}

.py-2 {
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
}

.px-4 {
    padding-left: 1rem;
    padding-right: 1rem;
}

.p-6 {
    padding: 1.5rem;
}

.hidden {
    display: none;
}

.flex {
    display: flex;
}

.flex-col {
    flex-direction: column;
}

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

.justify-center {
    justify-content: center;
}

.relative {
    position: relative;
}

.border {
    border-width: 1px;
}

.border-dashed {
    border-style: dashed;
}

.transition-colors {
    transition: border-color 0.2s;
}


/* Dialog styles */

.dialog {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.75);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.dialog.hidden {
    display: none;
}

.dialog-content {
    background: var(--card-background);
    padding: 20px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    max-width: 90%;
    max-height: 90vh;
    width: 800px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    transition: background-color 0.3s;
    color: var(--text-primary);
}

html.dark .dialog-content {
    background: #1A1A1A;
}

.dialog-content h3 {
    margin: 0;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
    color: var(--text-primary);
}

html.dark .dialog-content h3 {
    color: #fff;
}

#preview-container {
    background: var(--background);
    border-radius: var(--radius);
    overflow-y: auto;
    max-height: calc(90vh - 140px);
    /* Account for header and buttons */
    padding: 1rem;
}

.dialog-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--border);
}

.download-button,
.close-button {
    padding: 8px 16px;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    font-weight: 500;
}

.download-button {
    background: var(--button-bg);
    color: white;
}

.close-button {
    background: var(--card-background);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.close-button:hover {
    background: var(--background);
}


/* PDF Preview Styles */

.pdf-pages-wrapper {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.pdf-page-container {
    background: white;
    padding: 10px;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    position: relative;
}

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

.page-number {
    position: absolute;
    bottom: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.5);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
}

.preview-error {
    text-align: center;
    padding: 20px;
    color: #dc3545;
}

.error-details {
    font-size: 14px;
    color: #666;
    margin-top: 10px;
}

.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: #666;
}


/* Close button style */

.close-button {
    background: #dc3545;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
}

.close-button:hover {
    background: #c82333;
}

.header-text {
    width: 100%;
}

.tool-page {
    background-color: white;
    transition: background-color 0.3s;
}

html.dark .tool-page {
    background-color: #020817;
}


/* Update button text */

.choose-files-btn,
.merge-button,
.download-button,
.close-button {
    font-family: 'Poppins', sans-serif;
}


/* Add styles for the theme toggle button */

.theme-toggle {
    position: fixed;
    top: 1rem;
    right: 1rem;
    padding: 0.5rem;
    border-radius: 9999px;
    transition: background-color 0.3s;
    z-index: 50;
    cursor: pointer;
}

html.light .theme-toggle {
    background-color: #f3f4f6;
}

html.dark .theme-toggle {
    background-color: #374151;
}

.theme-toggle:hover {
    opacity: 0.9;
}