:root {
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --secondary: #1e293b;
    --accent: #eff6ff;
    --text-main: #1f2937;
    --text-light: #6b7280;
    --background: #f9fafb;
    --white: #ffffff;
    --border: #e5e7eb;
    --success: #10b981;
    --error: #ef4444;
    --radius-lg: 1rem;
    --radius-md: 0.5rem;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --font-heading: 'Inter', system-ui, -apple-system, sans-serif;
    --font-body: 'Inter', system-ui, -apple-system, sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-body);
    background-color: var(--background);
    color: var(--text-main);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* Typography */
h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: var(--font-heading);
    color: var(--text-main);
    /* Ensure headings are dark/readable */
    font-weight: 700;
    margin-bottom: 0.75rem;
}

h1 {
    font-size: 2.5rem;
    letter-spacing: -0.025em;
    line-height: 1.2;
}

h2 {
    font-size: 2rem;
    margin-top: 2rem;
}

h3 {
    font-size: 1.5rem;
}

p {
    margin-bottom: 1rem;
    color: var(--text-light);
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: var(--primary-hover);
}

/* Layout Utilities */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

.section {
    padding: 4rem 0;
}

.text-center {
    text-align: center;
}

.hidden {
    display: none !important;
}

.flex {
    display: flex;
}

.flex-col {
    flex-direction: column;
}

.items-center {
    align-items: center;
}

.justify-center {
    justify-content: center;
}

.justify-between {
    justify-content: space-between;
}

.gap-4 {
    gap: 1rem;
}

.gap-8 {
    gap: 2rem;
}

.mt-4 {
    margin-top: 1rem;
}

.mb-4 {
    margin-bottom: 1rem;
}

.mb-8 {
    margin-bottom: 2rem;
}

.mb-12 {
    margin-bottom: 3rem;
}

/* Components */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    font-weight: 600;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    font-size: 1rem;
}

.btn-primary {
    background-color: var(--primary);
    color: var(--white);
    box-shadow: var(--shadow-md);
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-lg);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Navbar */
.navbar {
    background: var(--white);
    border-bottom: 1px solid var(--border);
    padding: 1rem 0;
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 50;
}

.nav-brand {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--primary);
}

.nav-links {
    display: flex;
    gap: 2rem;
}

/* Hero & Tool */
.hero {
    padding: 3rem 0;
    text-align: center;
}

.hero p {
    font-size: 1.125rem;
    max-width: 600px;
    margin: 1rem auto;
}

.tool-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    border: 1px solid var(--border);
    overflow: hidden;
    min-height: 500px;
    transition: height 0.3s ease;
    position: relative;
    max-width: 1000px;
    margin: 0 auto;
}

/* Upload Zone */
.upload-zone {
    padding: 4rem 2rem;
    height: 100%;
    min-height: 500px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background-color: var(--accent);
    /* Very light blue background */
    border: 2px dashed #93c5fd;
    /* Light blue dashed border */
    border-radius: var(--radius-lg);
    /* Rounded corners for the dash area possibly, or keep square inside card */
    margin: 1rem;
    cursor: pointer;
    transition: all 0.3s;
}

.upload-zone:hover {
    background-color: #dbeafe;
    border-color: var(--primary);
}

.upload-icon {
    width: 64px;
    height: 64px;
    color: var(--primary);
    margin-bottom: 1.5rem;
}

/* Workspace */
.workspace {
    padding: 2rem;
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 2rem;
    height: 100%;
}

@media (max-width: 768px) {
    .workspace {
        grid-template-columns: 1fr;
    }
}

.preview-area {
    background: #525659;
    /* Darker background like standard PDF viewers for contrast */
    border-radius: var(--radius-md);
    padding: 2rem;
    overflow: auto;
    /* Allow scrolling if zoomed in */
    display: flex;
    flex-direction: column;
    /* Stack items */
    align-items: center;
    justify-content: flex-start;
    /* Start from top */
    position: relative;
    min-height: 600px;
    /* Taller default */
    width: 100%;
}

.controls-area {
    background: var(--white);
    border-left: 1px solid var(--border);
    padding-left: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

@media (max-width: 768px) {
    .controls-area {
        border-left: none;
        padding-left: 0;
        border-top: 1px solid var(--border);
        padding-top: 1rem;
    }
}

.control-group label {
    display: block;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: var(--text-main);
}

.input-field {
    width: 100%;
    padding: 0.625rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 0.95rem;
}

.input-field:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Crop Interface */
#cropContainer {
    position: relative;
    box-shadow: var(--shadow-lg);
    max-width: 100%;
    max-height: 600px;
    overflow: auto;
}

#pdfCanvas {
    display: block;
    max-width: 100%;
}

.crop-overlay {
    position: absolute;
    border: 2px dashed #fff;
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.5);
    cursor: move;
    touch-action: none;
}

.crop-handle {
    width: 10px;
    height: 10px;
    background: var(--primary);
    border: 1px solid #fff;
    position: absolute;
    border-radius: 50%;
}

/* Handle positions usually set by JS, but base styles here */
.handle-nw {
    top: -5px;
    left: -5px;
    cursor: nw-resize;
}

.handle-ne {
    top: -5px;
    right: -5px;
    cursor: ne-resize;
}

.handle-sw {
    bottom: -5px;
    left: -5px;
    cursor: sw-resize;
}

.handle-se {
    bottom: -5px;
    right: -5px;
    cursor: se-resize;
}

.page-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 1rem;
    background: #fff;
    padding: 0.5rem 1rem;
    border-radius: 2rem;
    /* Pill shape */
    box-shadow: var(--shadow-sm);
    width: max-content;
    margin-left: auto;
    margin-right: auto;
}

.page-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.25rem;
    padding: 0 0.5rem;
    color: var(--text-light);
}

.page-btn:hover {
    color: var(--primary);
}

/* Progress */
.progress-container {
    margin-top: 1rem;
    text-align: center;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: #e2e8f0;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.progress-fill {
    height: 100%;
    background: var(--primary);
    width: 0%;
    transition: width 0.3s ease;
}

/* Features Grid */
.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
    margin: 3rem 0;
}

.feature-card {
    background: var(--white);
    padding: 2rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    transition: transform 0.2s;
}

.feature-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.feature-icon {
    font-size: 2rem;
    margin-bottom: 1rem;
    display: block;
}

/* FAQ */
.faq-item {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    margin-bottom: 1rem;
}

.faq-question {
    padding: 1.25rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.faq-answer {
    padding: 0 1.25rem 1.25rem 1.25rem;
    color: var(--text-light);
    display: none;
    border-top: 1px solid var(--border);
}

.faq-item.active .faq-answer {
    display: block;
}

.faq-icon {
    transition: transform 0.3s;
}

.faq-item.active .faq-icon {
    transform: rotate(180deg);
}

/* Footer */
.footer {
    background: #111827;
    color: #9ca3af;
    padding: 4rem 0 2rem;
    margin-top: 4rem;
}

.footer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.footer h4 {
    color: white;
    margin-bottom: 1rem;
}

.footer ul {
    list-style: none;
}

.footer li {
    margin-bottom: 0.5rem;
}

.footer a {
    color: #9ca3af;
}

.footer a:hover {
    color: white;
}

/* Utility */
.shadow-xl {
    box-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
}