/* Private PDF Tools - Custom Styles */

/* Base styles */
* {
    box-sizing: border-box;
}

/* Drag and drop zone styles */
.drop-zone {
    border: 2px dashed #d1d5db;
    border-radius: 1rem;
    padding: 3rem 2rem;
    text-align: center;
    transition: all 0.2s ease;
    cursor: pointer;
    background: #fafafa;
}

.drop-zone:hover {
    border-color: #22c55e;
    background: #f0fdf4;
}

.drop-zone.drag-over {
    border-color: #22c55e;
    background: #dcfce7;
    transform: scale(1.01);
}

.drop-zone.has-files {
    border-style: solid;
    border-color: #22c55e;
    background: #f0fdf4;
}

/* File list styles */
.file-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.file-item {
    display: flex;
    align-items: center;
    padding: 1rem;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 0.75rem;
    margin-bottom: 0.5rem;
    transition: all 0.2s ease;
}

.file-item:hover {
    border-color: #22c55e;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.file-item.dragging {
    opacity: 0.4;
    transform: scale(0.98);
    background: #f3f4f6;
    border-style: dashed;
}

.file-item.drag-over {
    border-color: #22c55e;
    background: #f0fdf4;
}

.file-item[draggable="true"] {
    cursor: move;
}

.file-item .drag-handle {
    cursor: grab;
    padding: 0.5rem;
    color: #9ca3af;
    transition: color 0.2s, background-color 0.2s;
    border-radius: 0.375rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.file-item .drag-handle:hover {
    color: #22c55e;
    background: #f0fdf4;
}

.file-item .drag-handle:active {
    cursor: grabbing;
    color: #16a34a;
}

.file-item .file-info {
    flex: 1;
    margin-left: 0.75rem;
    min-width: 0;
}

.file-item .file-name {
    font-weight: 500;
    color: #111827;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-item .file-meta {
    font-size: 0.875rem;
    color: #6b7280;
}

.file-item .remove-btn {
    padding: 0.5rem;
    color: #9ca3af;
    background: none;
    border: none;
    cursor: pointer;
    border-radius: 0.5rem;
    transition: all 0.2s;
}

.file-item .remove-btn:hover {
    color: #ef4444;
    background: #fef2f2;
}

/* Progress bar */
.progress-bar {
    width: 100%;
    height: 8px;
    background: #e5e7eb;
    border-radius: 4px;
    overflow: hidden;
}

.progress-bar .progress {
    height: 100%;
    background: linear-gradient(90deg, #22c55e 0%, #16a34a 100%);
    border-radius: 4px;
    transition: width 0.3s ease;
}

/* Page thumbnail grid */
.page-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 1rem;
    padding: 1rem 0;
}

.page-thumbnail {
    position: relative;
    aspect-ratio: 0.707;
    background: white;
    border: 2px solid #e5e7eb;
    border-radius: 0.5rem;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.2s ease;
}

.page-thumbnail:hover {
    border-color: #22c55e;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.page-thumbnail.selected {
    border-color: #22c55e;
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.3);
}

.page-thumbnail canvas {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.page-thumbnail .page-number {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    font-size: 0.75rem;
    padding: 0.25rem;
    text-align: center;
}

.page-thumbnail .select-indicator {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    width: 1.5rem;
    height: 1.5rem;
    background: #22c55e;
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    color: white;
}

.page-thumbnail.selected .select-indicator {
    display: flex;
}

/* Action buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    font-weight: 600;
    border-radius: 0.75rem;
    transition: all 0.2s ease;
    cursor: pointer;
    border: none;
    font-size: 1rem;
}

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

.btn-primary {
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: linear-gradient(135deg, #16a34a 0%, #15803d 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(34, 197, 94, 0.4);
}

.btn-secondary {
    background: white;
    color: #374151;
    border: 1px solid #e5e7eb;
}

.btn-secondary:hover:not(:disabled) {
    background: #f9fafb;
    border-color: #d1d5db;
}

.btn-danger {
    background: #ef4444;
    color: white;
}

.btn-danger:hover:not(:disabled) {
    background: #dc2626;
}

/* Privacy badge */
.privacy-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 2rem;
    font-size: 0.875rem;
    color: #166534;
}

/* Loading spinner */
.spinner {
    width: 24px;
    height: 24px;
    border: 3px solid #e5e7eb;
    border-top-color: #22c55e;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Toast notifications */
.toast-container {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.toast {
    padding: 1rem 1.5rem;
    background: #1f2937;
    color: white;
    border-radius: 0.75rem;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    animation: slideIn 0.3s ease;
    max-width: 400px;
}

.toast.success {
    background: #166534;
}

.toast.error {
    background: #dc2626;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Options panel */
.options-panel {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 0.75rem;
    padding: 1.5rem;
    margin: 1.5rem 0;
}

.options-panel h3 {
    font-size: 1rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 1rem;
}

.option-group {
    margin-bottom: 1rem;
}

.option-group:last-child {
    margin-bottom: 0;
}

.option-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: #6b7280;
    margin-bottom: 0.5rem;
}

.option-group select,
.option-group input[type="text"],
.option-group input[type="number"] {
    width: 100%;
    padding: 0.625rem 0.875rem;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    background: white;
    color: #111827;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.option-group select:focus,
.option-group input:focus {
    outline: none;
    border-color: #22c55e;
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.2);
}

/* Radio button group */
.radio-group {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.radio-option {
    display: flex;
    align-items: center;
    padding: 0.625rem 1rem;
    background: white;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.2s;
}

.radio-option:hover {
    border-color: #22c55e;
}

.radio-option.selected {
    border-color: #22c55e;
    background: #f0fdf4;
}

.radio-option input {
    margin-right: 0.5rem;
}

/* Result section */
.result-section {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 1rem;
    padding: 2rem;
    text-align: center;
}

.result-section h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: #166534;
    margin-bottom: 0.5rem;
}

.result-section p {
    color: #15803d;
    margin-bottom: 1.5rem;
}

/* Image preview grid */
.image-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
}

.image-preview {
    position: relative;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 0.75rem;
    overflow: hidden;
}

.image-preview img {
    width: 100%;
    height: 150px;
    object-fit: cover;
}

.image-preview .image-info {
    padding: 0.75rem;
    font-size: 0.875rem;
}

.image-preview .image-name {
    font-weight: 500;
    color: #111827;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.image-preview .image-size {
    color: #6b7280;
}

.image-preview .download-btn {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    padding: 0.5rem;
    background: white;
    border: none;
    border-radius: 0.5rem;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: all 0.2s;
}

.image-preview .download-btn:hover {
    background: #f0fdf4;
    transform: scale(1.1);
}

/* Responsive adjustments */
@media (max-width: 640px) {
    .drop-zone {
        padding: 2rem 1rem;
    }

    .page-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    }

    .btn {
        padding: 0.625rem 1.25rem;
        font-size: 0.875rem;
    }

    .file-item {
        padding: 0.75rem;
    }

    .radio-group {
        flex-direction: column;
    }

    .radio-option {
        width: 100%;
    }
}

/* Utility classes */
.hidden {
    display: none !important;
}

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

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

.mb-4 {
    margin-bottom: 1rem;
}

.gap-4 {
    gap: 1rem;
}
