* {
    box-sizing: border-box;
    outline: none;
}

body {
    font-family: 'Inter', 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f3f4f6;
}

.container {
    display: flex;
    height: 100vh;
}

.sidebar {
    width: 280px;
    background-color: #1e293b;
    color: #e2e8f0;
    padding: 24px;
    box-shadow: 4px 0 10px rgba(0,0,0,0.05);
    z-index: 20;
    display: flex;
    flex-direction: column;
    border-right: 1px solid #334155;
}

.logo {
    margin-bottom: 32px;
    text-align: center;
    border-bottom: 1px solid #334155;
    padding-bottom: 20px;
}

.logo h1 {
    font-size: 1.25rem;
    font-weight: 700;
    color: #fff;
    letter-spacing: 0.5px;
    margin: 0;
}

.file-input {
    margin-bottom: 32px;
}

.file-input label {
    display: block;
    background-color: #ef4444;
    color: #fff;
    padding: 12px 16px;
    text-align: center;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.2s ease;
    font-weight: 600;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.file-input label:hover {
    background-color: #dc2626;
    transform: translateY(-1px);
    box-shadow: 0 6px 8px -1px rgba(0, 0, 0, 0.15);
}

.file-input input {
    display: none;
}

.pages {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    overflow: hidden;
}

.pages h2 {
    margin-top: 0;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #94a3b8;
    margin-bottom: 16px;
}

#pages-container {
    height: auto;
    flex-grow: 1;
    overflow-y: auto;
}

.page-preview {
    margin-bottom: 0;
    display: block;
    max-width: 100%;
    height: auto;
    margin: 0 auto;
    border: 2px solid transparent;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    opacity: 0.8;
}

.page-preview:hover {
    border-color: #64748b;
    opacity: 1;
}

.main-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    background-color: #e0e0e0;
}

.toolbar {
    background-color: #ffffff;
    border-bottom: 1px solid #e5e7eb;
    padding: 12px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
    z-index: 20;
}

.tool-group {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #f8fafc;
    padding: 4px;
    border-radius: 8px;
    border: 1px solid #f1f5f9;
}

.toolbar button {
    background-color: transparent;
    color: #475569;
    border: none;
    width: 36px;
    height: 36px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s;
    font-size: 1rem;
}

.toolbar button:hover {
    background-color: #e2e8f0;
    color: #1e293b;
}

.toolbar button.active {
    background-color: #fee2e2;
    color: #ef4444;
}

.toolbar select,
.toolbar input[type="number"] {
    height: 36px;
    border: none;
    border-radius: 6px;
    padding: 0 8px;
    color: #475569;
    background-color: transparent;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
}

.toolbar select:hover,
.toolbar input[type="number"]:hover {
    background-color: #e2e8f0;
    color: #1e293b;
}

.toolbar input[type="number"] {
    width: 60px;
}

#save {
    background-color: #10b981;
    color: white;
    width: auto;
    padding: 0 20px;
    font-weight: 600;
    font-size: 0.9rem;
    gap: 8px;
}

#save:hover {
    background-color: #059669;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.pdf-viewer {
    flex-grow: 1;
    overflow: auto;
    display: flex;
    justify-content: flex-start;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    padding: 20px;
    background-color: #e5e7eb;
}

.canvas-wrapper {
    position: relative;
    box-shadow: 0 0 10px rgba(0,0,0,0.5);
    background-color: white;
}

/* Force fabric wrapper to overlay exactly */
.canvas-container {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
}

.preview-wrapper {
    position: relative;
    margin-bottom: 20px;
    transition: transform 0.2s;
}

.preview-wrapper:hover {
    transform: translateY(-2px);
}

.delete-btn {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #e74c3c;
    color: white;
    border: none;
    border: 2px solid #1e293b;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 14px;
    z-index: 10;
    padding: 0;
    line-height: 1;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    transition: background-color 0.2s;
}

.delete-btn:hover {
    background-color: #dc2626;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}
