/* Custom CSS for PDF Bookmark Generator */

/* Global styles */
:root {
    --primary-color: #0d6efd;
    --success-color: #198754;
    --warning-color: #fd7e14;
    --danger-color: #dc3545;
    --info-color: #0dcaf0;
    --dark-color: #212529;
    --light-color: #f8f9fa;
}

html, body {
    height: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: #f8f9fa;
    display: flex;
    flex-direction: column;
}

/* Hover cards for index page */
.hover-card {
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
}

.hover-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15) !important;
}

/* Navigation */
.navbar-brand {
    font-weight: 600;
}

.navbar-nav .nav-link {
    font-weight: 500;
    transition: all 0.3s ease;
}

.navbar-nav .nav-link:hover {
    transform: translateY(-1px);
}

/* Cards */
.card {
    border-radius: 12px;
    transition: all 0.3s ease;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15) !important;
}

.card-header {
    background: linear-gradient(135deg, var(--light-color), #ffffff);
    border-radius: 12px 12px 0 0 !important;
}

/* Buttons */
.btn {
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn-lg {
    padding: 12px 24px;
    font-size: 1.1rem;
}

/* Upload section */
#fileInput {
    border-radius: 8px;
    transition: border-color 0.3s ease;
}

#fileInput:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}

/* Progress bars */
.progress {
    height: 12px;
    border-radius: 10px;
    background-color: #e9ecef;
}

.progress-bar {
    border-radius: 10px;
    transition: width 0.6s ease;
}

.progress-bar-animated {
    animation: progress-bar-stripes 1s linear infinite;
}

/* Status cards */
.bg-success {
    background: linear-gradient(135deg, #198754, #20c997) !important;
}

.bg-danger {
    background: linear-gradient(135deg, #dc3545, #fd5c70) !important;
}

.bg-warning {
    background: linear-gradient(135deg, #fd7e14, #ffab00) !important;
}

.bg-primary {
    background: linear-gradient(135deg, #0d6efd, #6610f2) !important;
}

/* Feature cards */
.card.h-100:hover {
    transform: translateY(-5px);
}

/* Statistics */
#statsRow h4 {
    font-weight: 700;
    font-size: 2rem;
}

/* Tables */
.table {
    border-radius: 8px;
    overflow: hidden;
}

.table-hover tbody tr:hover {
    background-color: rgba(0, 123, 255, 0.05);
}

/* Badges */
.badge {
    font-weight: 500;
    padding: 6px 12px;
    border-radius: 6px;
}

/* Forms */
.form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}

.form-check-input:checked {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.form-check-input:focus {
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

/* Form check alignment */
.form-check {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
}

.form-check .form-check-input {
    margin-top: 0.125rem;
    margin-left: 0;
    margin-right: 0;
}

.form-check .form-check-label {
    margin-bottom: 0;
}

/* Tabs */
.nav-tabs .nav-link {
    border-radius: 8px 8px 0 0;
    border: none;
    color: #6c757d;
    font-weight: 500;
}

.nav-tabs .nav-link.active {
    background: linear-gradient(135deg, var(--primary-color), #6610f2);
    color: white;
    border: none;
}

.nav-tabs .nav-link:hover:not(.active) {
    background-color: #f8f9fa;
}

/* JSON Editor */
#jsonEditor {
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    line-height: 1.5;
    border-radius: 8px;
}

/* Accordion */
.accordion-button {
    font-weight: 500;
}

.accordion-button:not(.collapsed) {
    background: linear-gradient(135deg, var(--primary-color), #6610f2);
    color: white;
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in-up {
    animation: fadeInUp 0.5s ease-out;
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
    }
}

.pulse {
    animation: pulse 2s infinite;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .card-body {
        padding: 1rem;
    }
    
    #statsRow h4 {
        font-size: 1.5rem;
    }
    
    .btn-lg {
        padding: 10px 20px;
        font-size: 1rem;
    }
    
    .drag-drop-area {
        padding: 2rem 1rem;
        min-height: 150px;
    }
    
    .drag-drop-area .display-1 {
        font-size: 3rem;
    }
    
    .drag-drop-area h5 {
        font-size: 1.1rem;
    }
}

/* Dark theme elements */
.bg-dark {
    background: linear-gradient(135deg, #212529, #495057) !important;
}

/* Footer */
footer {
    background: linear-gradient(135deg, #212529, #495057) !important;
    border-top: 3px solid var(--primary-color);
    margin-top: auto;
}

/* Loading spinner */
.spinner-border {
    width: 3rem;
    height: 3rem;
}

/* Drag and drop styles */
.drag-drop-area {
    border: 3px dashed #dee2e6;
    border-radius: 12px;
    padding: 3rem 2rem;
    text-align: center;
    background-color: #f8f9fa;
    transition: all 0.3s ease;
    cursor: pointer;
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.drag-drop-area:hover {
    border-color: var(--primary-color);
    background-color: rgba(13, 110, 253, 0.05);
    transform: translateY(-2px);
}

.drag-drop-area.drag-over {
    border-color: var(--primary-color);
    background-color: rgba(13, 110, 253, 0.1);
    border-style: solid;
    transform: scale(1.02);
}

.drag-drop-content {
    pointer-events: none;
}

.drag-drop-content .btn {
    pointer-events: auto;
}

.drag-drop-area.has-files {
    border-style: solid;
    border-color: var(--success-color);
    background-color: rgba(25, 135, 84, 0.05);
}

/* Custom file input */
.custom-file-input {
    position: relative;
    display: inline-block;
    cursor: pointer;
}

/* Alert improvements */
.alert {
    border-radius: 10px;
    border: none;
    font-weight: 500;
}

.alert-success {
    background: linear-gradient(135deg, rgba(25, 135, 84, 0.1), rgba(32, 201, 151, 0.1));
    color: #0f5132;
}

.alert-danger {
    background: linear-gradient(135deg, rgba(220, 53, 69, 0.1), rgba(253, 92, 112, 0.1));
    color: #842029;
}

.alert-warning {
    background: linear-gradient(135deg, rgba(255, 193, 7, 0.1), rgba(255, 171, 0, 0.1));
    color: #664d03;
}

.alert-info {
    background: linear-gradient(135deg, rgba(13, 202, 240, 0.1), rgba(102, 16, 242, 0.1));
    color: #055160;
}

/* Modal improvements */
.modal-content {
    border-radius: 12px;
    border: none;
}

.modal-header {
    background: linear-gradient(135deg, var(--light-color), #ffffff);
    border-radius: 12px 12px 0 0;
}

/* Tooltips */
.tooltip {
    font-size: 0.875rem;
}

/* Status indicators */
.status-indicator {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-right: 8px;
}

.status-completed {
    background-color: var(--success-color);
}

.status-processing {
    background-color: var(--warning-color);
    animation: pulse 1.5s infinite;
}

.status-error {
    background-color: var(--danger-color);
}

.status-queued {
    background-color: var(--info-color);
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

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

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a1a1a1;
}

/* File management styles */
.file-list-item {
    transition: all 0.3s ease;
    border-radius: 8px;
    margin-bottom: 4px;
}

.file-list-item:hover {
    background-color: rgba(0, 123, 255, 0.05);
    transform: translateX(2px);
}

.file-remove-btn {
    opacity: 0.7;
    transition: all 0.3s ease;
}

.file-remove-btn:hover {
    opacity: 1;
    transform: scale(1.1);
    background-color: var(--danger-color);
    border-color: var(--danger-color);
    color: white;
}

.file-counter-badge {
    min-width: 24px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
}

#selectedFiles .card {
    border: 2px dashed transparent;
    transition: all 0.3s ease;
}

#selectedFiles .card.drag-over {
    border-color: var(--primary-color);
    background-color: rgba(13, 110, 253, 0.05);
}

.remove-all-btn {
    transition: all 0.3s ease;
}

.remove-all-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(220, 53, 69, 0.2);
}

/* File size display */
.file-size {
    font-size: 0.75rem;
    color: #6c757d;
    font-weight: 500;
}

/* Empty state styling */
.file-list-empty {
    text-align: center;
    padding: 2rem;
    color: #6c757d;
    font-style: italic;
}

/* Animation for file removal */
@keyframes fadeOutLeft {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(-100%);
    }
}

.file-removing {
    animation: fadeOutLeft 0.3s ease-out forwards;
}

/* File counter in title */
#fileCount {
    background: linear-gradient(135deg, var(--primary-color), #6610f2);
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
    margin-left: 8px;
}

/* Preset Options */
.preset-option {
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    transition: all 0.2s ease;
    cursor: pointer;
}

.preset-option:hover {
    background-color: #e9ecef;
    border-color: #adb5bd;
    transform: translateY(-1px);
}

.preset-option .form-check-input:checked ~ .form-check-label {
    color: #0d6efd;
}

.preset-option .form-check-input:checked {
    background-color: #0d6efd;
    border-color: #0d6efd;
}

.preset-option .form-check-input:checked ~ .form-check-label {
    background-color: rgba(13, 110, 253, 0.1);
    border-radius: 0.25rem;
}

.preset-option .form-check-label {
    cursor: pointer;
    width: 100%;
    padding: 0.25rem;
    transition: all 0.2s ease;
}

.preset-option {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

.preset-option .form-check-input {
    margin-top: 0.375rem;
    flex-shrink: 0;
}

/* Preview Section Styles */
.preview-section {
    animation: slideInUp 0.5s ease-out;
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Bookmark Table Styles */
.bookmark-row {
    transition: all 0.3s ease;
}

.bookmark-row:hover {
    background-color: rgba(0, 123, 255, 0.05);
}

.bookmark-level-0 {
    border-left: 4px solid #0d6efd;
}

.bookmark-level-1 {
    border-left: 4px solid #198754;
}

.bookmark-level-2 {
    border-left: 4px solid #fd7e14;
}

.bookmark-level-3 {
    border-left: 4px solid #0dcaf0;
}

.bookmark-level-4 {
    border-left: 4px solid #dc3545;
}

/* Bookmark Title Editing */
.bookmark-title-display {
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 3px;
    transition: all 0.2s ease;
}

.bookmark-title-display:hover {
    background-color: rgba(13, 110, 253, 0.1);
}

.bookmark-title-input {
    font-size: 0.875rem;
    padding: 2px 6px;
    border: 1px solid #0d6efd;
}

.bookmark-title-input:focus {
    border-color: #0d6efd;
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}

/* Level Filters */
.level-filters .btn {
    margin: 2px;
    border-radius: 15px;
}

/* Bookmark Actions */
.edit-bookmark-btn:hover {
    background-color: #0d6efd;
    color: white;
}

.remove-bookmark-btn:hover {
    background-color: #dc3545;
    color: white;
}

/* Stats Cards in Preview */
#previewStats .col-md-3 {
    padding: 10px;
}

#previewStats h4 {
    font-size: 1.8rem;
    font-weight: 700;
}

/* Sticky Header */
.table-responsive thead th {
    position: sticky;
    top: 0;
    z-index: 10;
    background-color: #f8f9fa;
}

/* Preview loading */
.preview-loading {
    padding: 40px;
    text-align: center;
}

.preview-loading .spinner-border {
    width: 3rem;
    height: 3rem;
}

/* Empty state for bookmarks */
.bookmarks-empty {
    text-align: center;
    padding: 60px 20px;
    color: #6c757d;
}

.bookmarks-empty i {
    font-size: 3rem;
    margin-bottom: 20px;
    opacity: 0.5;
}

/* Action buttons in preview */
.preview-actions {
    border-top: 1px solid #dee2e6;
    padding-top: 20px;
    background-color: #f8f9fa;
    margin: -15px -15px 0 -15px;
    padding: 20px 15px 0 15px;
    border-radius: 0 0 12px 12px;
}

/* Badge animations */
.badge {
    transition: all 0.3s ease;
}

.bookmark-row:hover .badge {
    transform: scale(1.05);
}

/* Modified indicator */
.text-warning {
    color: #fd7e14 !important;
}

.bi-pencil-fill {
    animation: pulse 2s infinite;
}