/* ---------- Reset & base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen,
                 Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
    font-size: 16px;
    line-height: 1.5;
    color: #1e293b;
    background: #f8fafc;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { margin: 0 0 0.5em; line-height: 1.25; color: #0f172a; }
h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.15rem; }
p { margin: 0 0 1em; }
a { color: #2563eb; text-decoration: none; }
a:hover { text-decoration: underline; }

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

/* ---------- Header ---------- */
.site-header {
    background: white;
    border-bottom: 1px solid #e2e8f0;
    position: sticky;
    top: 0;
    z-index: 50;
}
.header-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
}
.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 700;
    font-size: 1.25rem;
    color: #0f172a;
    text-decoration: none;
}
.logo-icon { font-size: 1.5rem; }
.main-nav { display: flex; gap: 1.5rem; }
.main-nav a {
    color: #475569;
    font-weight: 500;
    padding: 0.5rem 0;
    border-bottom: 2px solid transparent;
    text-decoration: none;
    transition: color 0.15s, border-color 0.15s;
}
.main-nav a:hover {
    color: #2563eb;
    border-bottom-color: #2563eb;
    text-decoration: none;
}

/* ---------- Hero / Index ---------- */
.hero {
    text-align: center;
    padding: 3rem 0 2rem;
}
.hero h1 { font-size: 2.5rem; margin-bottom: 1rem; }
.lead {
    font-size: 1.15rem;
    color: #475569;
    max-width: 640px;
    margin: 0 auto 2rem;
}

.cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0 3rem;
}
.card {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 2rem;
    text-decoration: none;
    color: inherit;
    transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
    display: flex;
    flex-direction: column;
}
.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
    border-color: #cbd5e1;
    text-decoration: none;
}
.card-icon { font-size: 2.5rem; margin-bottom: 1rem; }
.card h2 { margin-bottom: 0.5rem; }
.card p { color: #475569; }
.card-features {
    list-style: none;
    padding: 0;
    margin: 1rem 0;
    flex: 1;
}
.card-features li {
    padding: 0.4rem 0 0.4rem 1.5rem;
    position: relative;
    color: #334155;
    font-size: 0.95rem;
}
.card-features li::before {
    content: "✓";
    position: absolute;
    left: 0;
    color: #10b981;
    font-weight: 700;
}
.card-cta {
    margin-top: 1rem;
    color: #2563eb;
    font-weight: 600;
}

.info {
    padding: 2rem 0 3rem;
}
.info h2 { text-align: center; margin-bottom: 2rem; }
.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}
.info-item {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}
.info-item h3 { color: #1e293b; }
.info-item p { color: #475569; margin: 0; font-size: 0.95rem; }

/* ---------- Page header ---------- */
.page-header {
    padding: 2rem 0 1.5rem;
}
.page-header h1 { margin-bottom: 0.5rem; }

/* ---------- Two column layout ---------- */
.two-col {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 2rem;
    margin-bottom: 3rem;
}
@media (max-width: 880px) {
    .two-col { grid-template-columns: 1fr; }
}

/* ---------- Form card ---------- */
.form-card {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 2rem;
}

.form-group {
    margin-bottom: 1.25rem;
}
.form-group label {
    display: block;
    margin-bottom: 0.4rem;
    font-weight: 600;
    color: #1e293b;
}
.form-group select,
.form-group input[type="password"],
.form-group input[type="text"] {
    width: 100%;
    padding: 0.65rem 0.75rem;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 1rem;
    background: white;
    color: #0f172a;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.form-group select:focus,
.form-group input:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}
.hint {
    display: block;
    margin-top: 0.4rem;
    color: #64748b;
    font-size: 0.85rem;
}
.optional {
    color: #94a3b8;
    font-weight: 400;
    font-size: 0.9rem;
}

/* ---------- File drop ---------- */
.file-drop {
    display: block;
    border: 2px dashed #cbd5e1;
    border-radius: 10px;
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    background: #f8fafc;
    transition: border-color 0.15s, background 0.15s;
}
.file-drop:hover, .file-drop.drag-over {
    border-color: #2563eb;
    background: #eff6ff;
}
.file-drop input[type="file"] {
    position: absolute;
    left: -9999px;
}
.file-drop-icon { font-size: 2.5rem; margin-bottom: 0.5rem; }
.file-drop-text strong { display: block; color: #1e293b; font-size: 1.05rem; }
.file-drop-hint {
    display: block;
    color: #64748b;
    font-size: 0.9rem;
    margin-top: 0.25rem;
}
.file-name {
    margin-top: 0.75rem;
    color: #059669;
    font-weight: 600;
    word-break: break-all;
}

/* ---------- Buttons ---------- */
.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: #2563eb;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, transform 0.05s;
    text-decoration: none;
}
.btn-primary:hover:not(:disabled) { background: #1d4ed8; text-decoration: none; }
.btn-primary:active:not(:disabled) { transform: translateY(1px); }
.btn-primary:disabled { background: #94a3b8; cursor: not-allowed; }

.btn-secondary {
    padding: 0.5rem 1rem;
    background: #f1f5f9;
    color: #1e293b;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background 0.15s;
}
.btn-secondary:hover:not(:disabled) { background: #e2e8f0; }
.btn-secondary:disabled { opacity: 0.5; cursor: not-allowed; }

/* ---------- Status messages ---------- */
.status {
    margin-top: 1rem;
    padding: 0.75rem 1rem;
    border-radius: 6px;
    font-size: 0.95rem;
}
.status-info { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }
.status-success { background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; }
.status-error { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }

/* ---------- Info / aside box ---------- */
.info-box {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 1.5rem;
}
.info-box-inline { margin-top: 1.5rem; }
.info-box h3 { margin-top: 0; margin-bottom: 0.75rem; }
.info-box h3:not(:first-child) { margin-top: 1.25rem; }
.info-box ol, .info-box ul {
    margin: 0 0 0.5rem;
    padding-left: 1.25rem;
}
.info-box li { margin-bottom: 0.4rem; color: #334155; font-size: 0.95rem; }
.warn-list li::marker { color: #f59e0b; }
.info-box .hint { margin-top: 0.75rem; }

/* ---------- Editor / Anonymize ---------- */
.editor-toolbar {
    position: sticky;
    top: 64px;
    z-index: 10;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
}
.toolbar-info {
    font-size: 0.9rem;
    color: #475569;
}
.toolbar-info strong { color: #0f172a; }
.toolbar-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}
#zoomLevel {
    min-width: 3rem;
    text-align: center;
    font-size: 0.9rem;
    color: #475569;
}

.pages-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    padding: 1rem 0;
}
.page-wrapper {
    position: relative;
    background: white;
    box-shadow: 0 2px 12px rgba(15, 23, 42, 0.1);
    border-radius: 2px;
}
.page-wrapper canvas {
    display: block;
}
.page-wrapper .overlay {
    position: absolute;
    inset: 0;
    cursor: crosshair;
    user-select: none;
}
.page-wrapper .page-number {
    position: absolute;
    top: -1.5rem;
    left: 0;
    font-size: 0.85rem;
    color: #64748b;
}
.rect {
    position: absolute;
    background: rgba(0, 0, 0, 0.92);
    outline: 1px solid #ef4444;
    cursor: pointer;
    box-sizing: border-box;
}
.rect.drawing {
    background: rgba(0, 0, 0, 0.5);
    outline-style: dashed;
}
.rect:hover { outline-width: 2px; }

/* ---------- Steps ---------- */
.step { animation: fadeIn 0.2s ease-out; }
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ---------- Footer ---------- */
.site-footer {
    background: white;
    border-top: 1px solid #e2e8f0;
    padding: 1.5rem 0;
    margin-top: 3rem;
}
.privacy-note {
    margin: 0;
    text-align: center;
    color: #475569;
    font-size: 0.9rem;
}
.privacy-note strong { color: #0f172a; }

/* ---------- Error page ---------- */
.error-page {
    text-align: center;
    padding: 4rem 1rem;
}
.error-page h1 { font-size: 2rem; }

/* ---------- Mobile ---------- */
@media (max-width: 640px) {
    .hero { padding: 2rem 0 1rem; }
    .hero h1 { font-size: 1.75rem; }
    .editor-toolbar { flex-direction: column; align-items: stretch; }
    .toolbar-actions { justify-content: center; }
}
