/* Pro PDF Editor Stylesheet */

:root {
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --bg: #0f172a;
    --bg-panel: #1e293b;
    --border: rgba(255, 255, 255, 0.08);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --radius-lg: 16px;
    --radius-md: 12px;
    --shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="light"] {
    --bg: #f8fafc;
    --bg-panel: #ffffff;
    --border: rgba(15, 23, 42, 0.08);
    --text-main: #0f172a;
    --text-muted: #64748b;
    --shadow: 0 10px 30px -10px rgba(15, 23, 42, 0.08);
}

body {
    background-color: var(--bg);
    color: var(--text-main);
    font-family: 'Inter', sans-serif;
    margin: 0;
    padding-top: 70px;
    min-height: 100vh;
    overflow-x: hidden;
}

.pdf-container {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 1.5rem;
}

.tool-header {
    text-align: center;
    margin-bottom: 3rem;
}

.tool-header h1 {
    font-family: 'Outfit', sans-serif;
    font-size: 2.75rem;
    font-weight: 800;
    margin: 0 0 0.5rem;
    background: linear-gradient(135deg, #818cf8, #c084fc);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.tool-header p {
    color: var(--text-muted);
    font-size: 1.05rem;
    max-width: 600px;
    margin: 0 auto;
}

/* Upload Dropzone */
.dropzone {
    background: var(--bg-panel);
    border: 2px dashed var(--primary);
    border-radius: var(--radius-lg);
    padding: 4rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.25rem;
    max-width: 600px;
    margin: 0 auto 2rem;
}

.dropzone:hover, .dropzone.dragover {
    border-color: #a78bfa;
    background: rgba(99, 102, 241, 0.04);
    transform: scale(1.01);
}

.dropzone i {
    font-size: 3.5rem;
    color: var(--primary);
    transition: var(--transition);
}

.dropzone:hover i {
    transform: translateY(-5px);
}

.dropzone h3 {
    margin: 0;
    font-family: 'Outfit', sans-serif;
    font-size: 1.35rem;
    font-weight: 700;
}

.dropzone p {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Editor Workspace */
.editor-workspace {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.control-bar {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    box-shadow: var(--shadow);
}

.btn-group {
    display: flex;
    gap: 0.75rem;
}

.btn-pdf {
    padding: 10px 18px;
    font-size: 0.9rem;
    font-weight: 600;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text-main);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: var(--transition);
}

.btn-pdf:hover {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.05);
}

.btn-pdf.primary {
    background: var(--primary);
    color: white;
    border: none;
}

.btn-pdf.primary:hover {
    background: var(--primary-hover);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.25);
}

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

/* Grid of Pages */
.pages-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1.75rem;
    padding: 1rem 0;
}

.page-card {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1rem;
    text-align: center;
    position: relative;
    box-shadow: var(--shadow);
    cursor: grab;
    user-select: none;
    transition: transform 0.2s, box-shadow 0.2s;
}

.page-card:active {
    cursor: grabbing;
}

.page-card.dragging {
    opacity: 0.4;
    border-color: var(--primary);
    transform: scale(0.95);
}

.page-thumbnail-container {
    width: 100%;
    aspect-ratio: 1 / 1.414;
    background: #0f172a;
    border-radius: 6px;
    overflow: hidden;
    position: relative;
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
}

.page-thumbnail-container canvas {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: transform 0.3s ease;
}

.page-number {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-top: 0.75rem;
    display: block;
}

/* Page action buttons (hover overlay) */
.page-actions {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 6px;
    opacity: 0;
    pointer-events: none;
    transition: var(--transition);
}

.page-card:hover .page-actions {
    opacity: 1;
    pointer-events: auto;
}

.btn-action {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.95rem;
    transition: var(--transition);
}

.btn-action:hover {
    background: var(--primary);
    transform: scale(1.1);
}

.btn-action.delete:hover {
    background: #ef4444;
}

/* Spinner Overlay */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.7);
    backdrop-filter: blur(6px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    z-index: 11000;
    color: white;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
