/* Tool-specific styles only - base styles are in tool-layout.css */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: #0a0a0a;
    color: #e5e7eb;
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    background-color: #141414;
    border-bottom: 1px solid #374151;
    z-index: 100;
}

    max-width: 1200px;
    margin: 0 auto;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
}

    margin-top: 60px;
    padding: 48px 24px;
    text-align: center;
    min-height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
}

    max-width: 720px;
    margin: 0 auto;
}

.tool-main {
    flex: 1;
    padding: 32px 24px 120px;
}

.tool-container {
    max-width: 720px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 48px;
}

.input-section {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.input-group > label {
    font-size: 14px;
    font-weight: 500;
    color: #e5e7eb;
}

.file-upload-zone {
    background-color: #0a0a0a;
    border: 2px dashed #374151;
    border-radius: 12px;
    padding: 48px 32px;
    text-align: center;
    cursor: pointer;
    transition: all 150ms ease;
    position: relative;
    outline: none;
}

.file-upload-zone.has-file {
    border-style: solid;
    border-color: #374151;
    padding: 24px;
}

.upload-icon {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 16px;
    opacity: 0.7;
    color: #6b7280;
    letter-spacing: 2px;
}

.upload-primary {
    font-size: 16px;
    font-weight: 400;
    color: #e5e7eb;
    margin-bottom: 4px;
}

.upload-secondary {
    font-size: 14px;
    font-weight: 400;
    color: #9ca3af;
}

.file-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 12px 16px;
    background-color: #141414;
    border: 1px solid #374151;
    border-radius: 8px;
}

.file-info-details {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.file-info-name {
    font-size: 14px;
    font-weight: 500;
    color: #e5e7eb;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-info-meta {
    font-size: 13px;
    color: #9ca3af;
}

.button-remove {
    background: none;
    border: 1px solid #374151;
    color: #9ca3af;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: all 150ms ease;
    flex-shrink: 0;
}

.button-remove:hover {
    color: #ef4444;
    border-color: #ef4444;
}

.button-remove-sm {
    background: none;
    border: none;
    color: #9ca3af;
    font-size: 12px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    padding: 2px 4px;
    transition: color 150ms ease;
}

.button-remove-sm:hover {
    color: #ef4444;
}

.bookmarks-editor {
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding: 24px;
    background-color: #141414;
    border: 1px solid #374151;
    border-radius: 8px;
}

.bookmarks-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.bookmarks-header h3 {
    font-size: 18px;
    font-weight: 500;
    color: #d1d5db;
}

.bookmarks-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.bookmark-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 400px;
    overflow-y: auto;
}

.bookmark-list:empty::before {
    content: 'No bookmarks added yet. Click "Add Bookmark" or auto-detect headings.';
    display: block;
    text-align: center;
    color: #6b7280;
    font-size: 14px;
    padding: 32px 16px;
}

.bookmark-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background-color: #1a1a1a;
    border: 1px solid #374151;
    border-radius: 6px;
    transition: border-color 150ms ease;
}

.bookmark-item:hover {
    border-color: #4b5563;
}

.bookmark-item.editing {
    border-color: #3b82f6;
}

.bookmark-drag-handle {
    color: #6b7280;
    cursor: grab;
    padding: 4px;
    font-size: 14px;
    user-select: none;
}

.bookmark-drag-handle:active {
    cursor: grabbing;
}

.bookmark-level {
    display: flex;
    align-items: center;
    gap: 4px;
    min-width: 60px;
}

.level-indicator {
    width: 8px;
    height: 8px;
    border-radius: 2px;
    background-color: #3b82f6;
}

.level-indicator.level-2 {
    background-color: #10b981;
    margin-left: 8px;
}

.level-indicator.level-3 {
    margin-left: 16px;
}

.bookmark-title-input {
    flex: 1;
    background-color: transparent;
    border: none;
    color: #e5e7eb;
    font-size: 14px;
    font-family: inherit;
    outline: none;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background-color 150ms ease;
}

.bookmark-title-input:focus {
    background-color: #0a0a0a;
}

.bookmark-page-input {
    width: 60px;
    background-color: #0a0a0a;
    border: 1px solid #374151;
    color: #e5e7eb;
    font-size: 13px;
    font-family: inherit;
    padding: 4px 8px;
    border-radius: 4px;
    text-align: center;
    outline: none;
}

.bookmark-page-input:focus {
    border-color: #3b82f6;
}

.bookmark-level-select {
    width: 50px;
    background-color: #0a0a0a;
    border: 1px solid #374151;
    color: #e5e7eb;
    font-size: 13px;
    font-family: inherit;
    padding: 4px 8px;
    border-radius: 4px;
    outline: none;
    cursor: pointer;
}

.bookmark-level-select:focus {
    border-color: #3b82f6;
}

.bookmark-delete-btn {
    background: none;
    border: none;
    color: #6b7280;
    cursor: pointer;
    font-size: 18px;
    padding: 4px;
    transition: color 150ms ease;
    line-height: 1;
}

.bookmark-delete-btn:hover {
    color: #ef4444;
}

.add-bookmark-form {
    display: flex;
    gap: 8px;
    align-items: flex-end;
    flex-wrap: wrap;
    padding: 16px;
    background-color: #1a1a1a;
    border-radius: 6px;
}

.add-bookmark-form .form-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.add-bookmark-form .form-group label {
    font-size: 12px;
    color: #9ca3af;
}

.add-bookmark-form .form-group input {
    background-color: #0a0a0a;
    border: 1px solid #374151;
    color: #e5e7eb;
    font-size: 14px;
    font-family: inherit;
    padding: 8px 12px;
    border-radius: 4px;
    outline: none;
}

.add-bookmark-form .form-group input:focus {
    border-color: #3b82f6;
}

.add-bookmark-form .form-group.title-group {
    flex: 1;
    min-width: 200px;
}

.add-bookmark-form .form-group.page-group input {
    width: 80px;
}

.add-bookmark-form .form-group select {
    background-color: #0a0a0a;
    border: 1px solid #374151;
    color: #e5e7eb;
    font-size: 14px;
    font-family: inherit;
    padding: 8px 12px;
    border-radius: 4px;
    outline: none;
    cursor: pointer;
}

.settings-group {
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding: 24px;
    background-color: #141414;
    border: 1px solid #374151;
    border-radius: 8px;
}

.settings-title {
    font-size: 18px;
    font-weight: 500;
    color: #d1d5db;
    margin-bottom: 4px;
}

.setting-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
    position: relative;
}

.setting-item > label,
.setting-content > label {
    font-size: 14px;
    font-weight: 500;
    color: #e5e7eb;
}

.setting-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
}

.setting-hint {
    font-size: 12px;
    color: #6b7280;
}

.select-input {
    background-color: #141414;
    border: 1px solid #374151;
    color: #e5e7eb;
    padding: 12px 16px;
    border-radius: 6px;
    font-size: 15px;
    font-family: inherit;
    cursor: pointer;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%239ca3af' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

.select-input:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.15);
}

.select-input option {
    background-color: #1a1a1a;
}

.select-input:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.text-input {
    background-color: #141414;
    border: 1px solid #374151;
    color: #e5e7eb;
    padding: 12px 16px;
    border-radius: 6px;
    font-size: 15px;
    font-family: inherit;
    outline: none;
    width: 100%;
}

.text-input:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.15);
}

.text-input:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.text-input::placeholder {
    color: #6b7280;
}

label.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 14px;
    color: #e5e7eb;
}

label.checkbox-label input[type="checkbox"] {
    display: none;
}

.checkbox-custom {
    width: 18px;
    height: 18px;
    background-color: #141414;
    border: 1px solid #374151;
    border-radius: 4px;
    position: relative;
    transition: all 150ms ease;
    flex-shrink: 0;
}

label.checkbox-label input[type="checkbox"]:checked + .checkbox-custom {
    background-color: #3b82f6;
    border-color: #3b82f6;
}

label.checkbox-label input[type="checkbox"]:checked + .checkbox-custom::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 6px;
    width: 4px;
    height: 8px;
    border: solid #ffffff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

label.checkbox-label input[type="checkbox"]:disabled + .checkbox-custom {
    opacity: 0.5;
    cursor: not-allowed;
}

.pro-features-section {
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding-top: 20px;
    border-top: 1px solid #374151;
}

.pro-feature {
    position: relative;
    opacity: 0.6;
}

.pro-feature.unlocked {
    opacity: 1;
}

.pro-badge {
    color: #0a0a0a;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    padding: 2px 6px;
    border-radius: 4px;
    flex-shrink: 0;
}

.button-primary {
    background-color: #3b82f6;
    color: #ffffff;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 500;
    font-family: inherit;
    border: none;
    cursor: pointer;
    transition: background-color 150ms ease;
    text-align: center;
    width: 100%;
}

.button-secondary {
    background-color: #1a1a1a;
    color: #e5e7eb;
    border: 1px solid #374151;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: background-color 150ms ease;
    text-align: center;
}

.button-download {
    background-color: #059669;
    color: #ffffff;
    padding: 12px 24px;
    border-radius: 6px;
    font-size: 15px;
    font-weight: 500;
    font-family: inherit;
    border: none;
    cursor: pointer;
    transition: background-color 150ms ease;
    text-align: center;
    width: 100%;
}

.button-sm {
    padding: 6px 12px;
    font-size: 13px;
}

.button-nav {
    background-color: #1a1a1a;
    border: 1px solid #374151;
    color: #e5e7eb;
    width: 36px;
    height: 36px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: all 150ms ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.button-nav:hover:not(:disabled) {
    background-color: #374151;
}

.button-nav:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.output-section {
    background-color: #141414;
    border: 1px solid #374151;
    border-radius: 8px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.output-header h3 {
    font-size: 22px;
    font-weight: 600;
    line-height: 28px;
    color: #d1d5db;
}

.stats-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
}

.stats-bar .stat-item {
    flex: 1 1 calc(33.333% - 12px);
    min-width: 100px;
}

.stat-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
    text-align: center;
    padding: 12px;
    background-color: #1a1a1a;
    border-radius: 6px;
}

.stat-label {
    font-size: 12px;
    font-weight: 500;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    font-size: 16px;
    font-weight: 600;
    color: #e5e7eb;
}

.preview-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.preview-canvas-wrap {
    width: 100%;
    background-color: #0a0a0a;
    border: 1px solid #374151;
    border-radius: 8px;
    padding: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 300px;
}

.preview-canvas-wrap canvas {
    max-width: 100%;
    max-height: 500px;
    border-radius: 4px;
}

.preview-nav {
    display: flex;
    align-items: center;
    gap: 16px;
}

.preview-page-info {
    font-size: 14px;
    font-weight: 500;
    color: #9ca3af;
    min-width: 60px;
    text-align: center;
}

.process-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    padding: 32px;
}

.spinner {
    width: 24px;
    height: 24px;
    border: 2px solid #374151;
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.loading-text {
    font-size: 14px;
    color: #9ca3af;
}

.progress-bar {
    width: 100%;
    max-width: 300px;
    height: 4px;
    background-color: #374151;
    border-radius: 2px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background-color: #3b82f6;
    border-radius: 2px;
    width: 0%;
    transition: width 200ms ease;
}

.download-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.detected-info {
    padding: 12px 16px;
    background-color: #064e3b;
    border: 1px solid #059669;
    border-radius: 6px;
    font-size: 14px;
    color: #6ee7b7;
}

.detected-info.warning {
    background-color: #451a03;
    border-color: #d97706;
    color: #fcd34d;
}

.error-text {
    flex: 1;
}

.error-dismiss {
    background: none;
    border: none;
    color: #fca5a5;
    font-size: 16px;
    cursor: pointer;
    padding: 4px;
    flex-shrink: 0;
    transition: color 150ms ease;
}

.error-dismiss:hover {
    color: #ffffff;
}

.success-message {
    background-color: #064e3b;
    border: 1px solid #059669;
    color: #6ee7b7;
    padding: 12px 16px;
    border-radius: 6px;
    font-size: 14px;
    margin-top: 8px;
}

@media (max-width: 768px) {
        padding: 32px 16px;
    }

        font-size: 28px;
        line-height: 36px;
    }

        font-size: 14px;
    }

    .tool-main {
        padding: 24px 16px 100px;
    }

    .tool-container {
        gap: 32px;
    }

    .bookmarks-editor {
        padding: 16px;
    }

    .settings-group {
        padding: 16px;
    }

    .output-section {
        padding: 16px;
    }

    .stats-bar {
        gap: 8px;
    }

    .stats-bar .stat-item {
        flex: 1 1 calc(50% - 4px);
    }

    .stat-item {
        padding: 10px;
    }

    .stat-value {
        font-size: 14px;
    }

    .file-upload-zone {
        padding: 32px 16px;
    }

        padding: 0 16px;
    }

    .preview-canvas-wrap {
        min-height: 200px;
    }

    .preview-canvas-wrap canvas {
        max-height: 350px;
    }

    .button-primary,
    .button-secondary {
        width: 100%;
    }

    .bookmarks-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .bookmarks-actions {
        width: 100%;
    }

    .bookmarks-actions .button-secondary {
        flex: 1;
    }

    .add-bookmark-form {
        flex-direction: column;
        gap: 12px;
    }

    .add-bookmark-form .form-group {
        width: 100%;
    }

    .add-bookmark-form .form-group.page-group input {
        width: 100%;
    }

    .bookmark-item {
        flex-wrap: wrap;
        gap: 8px;
    }

    .bookmark-title-input {
        order: 1;
        width: 100%;
        flex: none;
    }
}

@media (max-width: 480px) {
    .stats-bar .stat-item {
        flex: 1 1 100%;
    }

    .file-info {
        flex-direction: column;
        align-items: flex-start;
    }
}