:root {
    --bg-color: #0f172a; /* Slate 900 */
    --panel-bg: rgba(30, 41, 59, 0.7); /* Slate 800 with opacity for glass effect */
    --panel-border: rgba(255, 255, 255, 0.1);
    --text-primary: #f8fafc; /* Slate 50 */
    --text-secondary: #94a3b8; /* Slate 400 */
    --accent-primary: #3b82f6; /* Blue 500 */
    --accent-hover: #2563eb; /* Blue 600 */
    --success: #10b981; /* Emerald 500 */
    --success-hover: #059669; /* Emerald 600 */
    --canvas-bg: #1e293b; /* Slate 800 */
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    height: 100vh;
    overflow: hidden;
    background-image: 
        radial-gradient(at 0% 0%, rgba(59, 130, 246, 0.15) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(16, 185, 129, 0.15) 0px, transparent 50%);
}

.app-container {
    display: flex;
    height: 100vh;
    width: 100vw;
}

/* Sidebar Styling */
.sidebar {
    width: 300px;
    height: 100%;
    display: flex;
    flex-direction: column;
    padding: 24px;
    border-right: 1px solid var(--panel-border);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    background-color: var(--panel-bg);
    z-index: 10;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 40px;
    color: var(--text-primary);
}

.logo i {
    color: var(--accent-primary);
}

.tools-section {
    flex-grow: 1;
}

.tools-section h3 {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.divider {
    height: 1px;
    background-color: var(--panel-border);
    margin: 20px 0;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    font-family: 'Inter', sans-serif;
}

.w-100 {
    width: 100%;
}

.btn-primary {
    background-color: var(--accent-primary);
    color: white;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.btn-primary:hover {
    background-color: var(--accent-hover);
    transform: translateY(-1px);
}

.btn-secondary {
    background-color: transparent;
    color: var(--text-primary);
    border: 1px solid var(--panel-border);
}

.btn-secondary:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

.btn-secondary.active {
    background-color: rgba(59, 130, 246, 0.2);
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

.btn-success {
    background-color: var(--success);
    color: white;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.btn-success:hover {
    background-color: var(--success-hover);
    transform: translateY(-1px);
}

.icon-btn {
    background: transparent;
    border: 1px solid var(--panel-border);
    color: var(--text-primary);
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.icon-btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.tool-hint {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 8px;
    text-align: center;
}

.disabled-tools {
    opacity: 0.5;
    pointer-events: none;
    transition: opacity 0.3s;
}

.disabled-tools.active {
    opacity: 1;
    pointer-events: auto;
}

/* Page Navigation */
.page-navigation {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-top: auto;
    padding-top: 20px;
    border-top: 1px solid var(--panel-border);
}

/* Workspace */
.workspace {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.workspace-header {
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    border-bottom: 1px solid var(--panel-border);
    background-color: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(8px);
}

.zoom-controls {
    display: flex;
    align-items: center;
    gap: 12px;
}

.canvas-wrapper {
    flex-grow: 1;
    overflow: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--canvas-bg);
    position: relative;
    padding: 40px;
}

.empty-state {
    text-align: center;
    color: var(--text-secondary);
    max-width: 400px;
}

.empty-icon {
    font-size: 4rem;
    color: var(--panel-border);
    margin-bottom: 24px;
}

.empty-state h2 {
    color: var(--text-primary);
    margin-bottom: 12px;
}

.pdf-container {
    position: relative;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    background: white;
    /* transition: transform 0.2s ease-out; */
}

.hidden {
    display: none !important;
}

/* Text Editing Layer */
.text-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none; /* Let clicks pass through unless active */
}

.text-layer.interactive {
    pointer-events: auto;
    cursor: text;
}

.pdf-text-input {
    position: absolute;
    background: transparent;
    border: 1px dashed var(--accent-primary);
    outline: none;
    font-family: Arial, sans-serif;
    color: black;
    padding: 2px;
    z-index: 100;
    resize: both;
    overflow: hidden;
    white-space: nowrap;
    min-width: 20px;
}

.pdf-text-element {
    position: absolute;
    color: black;
    font-family: Arial, sans-serif;
    cursor: move;
    user-select: none;
    border: 1px solid transparent;
    padding: 2px;
    pointer-events: auto;
    white-space: pre-wrap;
}

.pdf-text-element:hover {
    border-color: rgba(59, 130, 246, 0.5);
}

.pdf-text-element.selected {
    border: 1px dashed var(--accent-primary);
    background-color: rgba(59, 130, 246, 0.1);
}

.delete-btn {
    position: absolute;
    top: -25px;
    right: 0;
    background: #ef4444;
    color: white;
    border: none;
    border-radius: 4px;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 12px;
    display: none;
}

.pdf-text-element.selected .delete-btn {
    display: flex;
}

/* Added for advanced text editing */
.pdf-original-text {
    position: absolute;
    color: transparent; /* Keep original text transparent to just show canvas */
    cursor: text;
    white-space: pre;
    transform-origin: 0% 0%;
    line-height: 1;
}

.pdf-original-text:hover {
    background-color: rgba(59, 130, 246, 0.2);
    border-radius: 2px;
}

.pdf-original-text.editing {
    color: black;
    background-color: transparent;
    outline: 1px dashed var(--accent-primary);
    caret-color: var(--accent-primary);
    cursor: text;
}
