/* PAN Photo & Signature Crop Tool
   Base layer is Bootstrap 5 (grid + reset); everything below is the tool's own
   design system. UTI = amber accent, NSDL = blue accent. */

:root {
    --ink: #16202e;
    --ink-soft: #5b6a7d;
    --line: #e2e8f0;
    --bg: #f4f6fb;
    --card: #ffffff;
    --uti: #d9631a;
    --uti-soft: #fdf1e7;
    --nsdl: #1257a8;
    --nsdl-soft: #eaf1fb;
    --ok: #16794b;
    --err: #b42318;
    --radius: 14px;
    --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 10px 30px rgba(16, 24, 40, .07);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
    font-size: 15px;
    line-height: 1.55;
}

h1, h2, h3 { font-weight: 700; letter-spacing: -.01em; margin: 0; }

/* ---------- header ---------- */
.site-head {
    background: linear-gradient(120deg, #0e1c2f, #1c3557);
    color: #fff;
    padding: 22px 0;
}
.brand { display: flex; align-items: center; gap: 14px; }
.brand__mark {
    display: grid; place-items: center;
    width: 48px; height: 48px; flex: 0 0 48px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--uti), #f0a35e);
    font-weight: 800; letter-spacing: .5px;
}
.site-head h1 { font-size: 1.25rem; }
.site-head p { margin: 2px 0 0; font-size: .86rem; color: #b9c7db; }

main.container { padding-bottom: 48px; }

/* ---------- service chooser ---------- */
.chooser { margin: 26px 0 8px; }
.choice {
    background: var(--card);
    border: 1px solid var(--line);
    border-top: 4px solid var(--line);
    border-radius: var(--radius);
    padding: 22px;
    height: 100%;
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.choice:hover { transform: translateY(-2px); }
.choice--uti:hover { border-color: var(--uti); }
.choice--nsdl:hover { border-color: var(--nsdl); }
.choice:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }
.choice--uti { border-top-color: var(--uti); }
.choice--nsdl { border-top-color: var(--nsdl); }
.choice h2 { font-size: 1.15rem; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* Currently open service */
.choice__flag {
    display: none;
    padding: 2px 9px; border-radius: 999px;
    font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
}
.choice.is-active .choice__flag { display: inline-block; }
.choice--uti.is-active { border-color: var(--uti); box-shadow: 0 0 0 3px rgba(217, 99, 26, .18), var(--shadow); }
.choice--nsdl.is-active { border-color: var(--nsdl); box-shadow: 0 0 0 3px rgba(18, 87, 168, .18), var(--shadow); }
.choice--uti.is-active { border-top-color: var(--uti); }
.choice--nsdl.is-active { border-top-color: var(--nsdl); }
.choice--uti .choice__flag { background: var(--uti-soft); color: var(--uti); }
.choice--nsdl .choice__flag { background: var(--nsdl-soft); color: var(--nsdl); }
.choice > p { margin: 2px 0 12px; color: var(--ink-soft); font-size: .9rem; }
.choice ul { margin: 0 0 16px; padding-left: 18px; color: var(--ink-soft); font-size: .88rem; }
.choice li { margin-bottom: 3px; }

/* ---------- buttons ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    border: 1px solid transparent;
    border-radius: 10px;
    padding: 11px 20px;
    font-weight: 600;
    font-size: .93rem;
    cursor: pointer;
    text-decoration: none;
    transition: filter .15s ease, background .15s ease;
}
.btn:hover { filter: brightness(.94); }
.btn--uti { background: var(--uti); color: #fff; }
.btn--nsdl { background: var(--nsdl); color: #fff; }
.btn--primary { background: var(--ink); color: #fff; }
.btn--ghost { background: #fff; color: var(--ink); border-color: var(--line); }
.btn[disabled] { opacity: .55; cursor: not-allowed; filter: none; }

.panel--uti .btn--primary { background: var(--uti); }
.panel--nsdl .btn--primary { background: var(--nsdl); }

/* ---------- tabs ---------- */
.tabs {
    display: flex; gap: 10px; flex-wrap: wrap;
    margin: 26px 0 18px;
    padding: 6px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: var(--shadow);
}
.tab {
    flex: 1 1 220px;
    border: 0; background: transparent;
    padding: 12px 16px;
    border-radius: 9px;
    font-weight: 650;
    color: var(--ink-soft);
    cursor: pointer;
}
.tab:hover { background: #f1f4f9; }
/* The selected service is filled solid so it is unmistakable. */
.tab.active { color: #fff; }
.tab--uti.active { background: var(--uti); box-shadow: 0 2px 8px rgba(217, 99, 26, .35); }
.tab--nsdl.active { background: var(--nsdl); box-shadow: 0 2px 8px rgba(18, 87, 168, .35); }
.tab.active:hover { filter: brightness(.95); }
.tab--uti.active:hover { background: var(--uti); }
.tab--nsdl.active:hover { background: var(--nsdl); }

/* ---------- panel ---------- */
.panel__head { margin-bottom: 16px; }
.panel__head h2 { font-size: 1.05rem; }
.panel__head p { margin: 2px 0 0; color: var(--ink-soft); font-size: .87rem; }

/* ---------- tool card ---------- */
.tool-card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 20px;
    height: 100%;
    box-shadow: var(--shadow);
    position: relative;
}
.tool-card__head { display: flex; gap: 12px; align-items: flex-start; }
.tool-card__icon {
    width: 40px; height: 40px; flex: 0 0 40px;
    display: grid; place-items: center;
    border-radius: 10px; font-size: 19px;
}
.panel--uti .tool-card__icon { background: var(--uti-soft); }
.panel--nsdl .tool-card__icon { background: var(--nsdl-soft); }
.tool-card__head h3 { font-size: 1rem; }
.tool-card__head p { margin: 2px 0 0; font-size: .85rem; color: var(--ink-soft); }

.spec-strip {
    display: grid; grid-template-columns: repeat(3, 1fr);
    gap: 8px; margin: 16px 0; padding: 0; list-style: none;
}
.spec-strip li {
    background: #f7f9fc;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 9px 10px;
    text-align: center;
}
.spec-strip span { display: block; font-size: .7rem; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-soft); }
.spec-strip strong { font-size: .98rem; }
.panel--uti .spec-strip strong { color: var(--uti); }
.panel--nsdl .spec-strip strong { color: var(--nsdl); }

/* ---------- dropzone ---------- */
.dropzone {
    border: 2px dashed #c6d0dd;
    border-radius: 12px;
    background: #fafbfe;
    padding: 30px 18px;
    text-align: center;
    cursor: pointer;
    transition: border-color .15s ease, background .15s ease;
}
.dropzone:hover, .dropzone:focus-visible, .dropzone.is-over { border-color: var(--ink); background: #f2f5fa; outline: none; }
.panel--uti .dropzone.is-over { border-color: var(--uti); background: var(--uti-soft); }
.panel--nsdl .dropzone.is-over { border-color: var(--nsdl); background: var(--nsdl-soft); }
.dropzone__icon { font-size: 26px; color: var(--ink-soft); }
.dropzone__title { margin: 6px 0 2px; font-weight: 650; }
.dropzone__hint { margin: 0; font-size: .82rem; color: var(--ink-soft); }
.dropzone .link { color: var(--nsdl); text-decoration: underline; }

/* ---------- crop mode switch ---------- */
.modes {
    display: flex; flex-wrap: wrap; gap: 6px; padding: 5px;
    background: #f1f4f9; border: 1px solid var(--line); border-radius: 10px;
}
.mode {
    flex: 1 1 0; border: 0; background: transparent;
    padding: 8px 10px; border-radius: 7px;
    font-size: .84rem; font-weight: 650; color: var(--ink-soft); cursor: pointer;
}
.mode:hover { background: #e7ecf4; }
.mode.active { background: #fff; color: var(--ink); box-shadow: 0 1px 2px rgba(16, 24, 40, .12); }
.panel--uti .mode.active { color: var(--uti); }
.panel--nsdl .mode.active { color: var(--nsdl); }
.mode-note { margin: 8px 0 12px; font-size: .78rem; color: var(--ink-soft); }

/* ---------- editor ---------- */
.editor { display: grid; grid-template-columns: 1fr 168px; gap: 14px; }
.editor__canvas {
    background: #0f1622;
    border-radius: 10px;
    overflow: hidden;
    height: 320px;
}
.editor__image { display: block; max-width: 100%; }
.editor__label { margin: 0 0 6px; font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-soft); }
.preview-box {
    width: 100%;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}
.preview-box img { display: block; max-width: none; }
.preview-note { margin: 8px 0 0; font-size: .74rem; color: var(--ink-soft); }

.toolbar {
    display: flex; align-items: center; flex-wrap: wrap; gap: 6px;
    margin-top: 12px; padding: 8px;
    background: #f7f9fc; border: 1px solid var(--line); border-radius: 10px;
}
.tbtn {
    border: 1px solid var(--line); background: #fff; color: var(--ink);
    border-radius: 8px; padding: 6px 10px; min-width: 36px;
    font-size: .85rem; font-weight: 600; cursor: pointer; line-height: 1.4;
}
.tbtn:hover { background: #eef2f8; }
.toolbar__sep { width: 1px; height: 22px; background: var(--line); margin: 0 4px; }
.tbtn[disabled] { opacity: .45; cursor: not-allowed; }
.toolbar--locked .zoom-slider { opacity: .45; }
.zoom-slider { flex: 1 1 90px; min-width: 80px; accent-color: var(--ink); }

.editor__actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 14px; flex-wrap: wrap; }
.format-pick { font-size: .82rem; color: var(--ink-soft); display: flex; align-items: center; gap: 8px; }
.format-select { border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; background: #fff; color: var(--ink); font-weight: 600; }
.editor__actions .btn { flex: 1 1 200px; }

/* ---------- result ---------- */
.result { display: flex; gap: 16px; flex-wrap: wrap; }
.result__thumb {
    background: #f7f9fc; border: 1px solid var(--line); border-radius: 10px;
    padding: 12px; display: grid; place-items: center; min-width: 150px;
}
.result__image { max-width: 220px; height: auto; image-rendering: -webkit-optimize-contrast; }
.result__meta { flex: 1 1 220px; }
.result__title { margin: 0 0 8px; font-weight: 700; color: var(--ok); }
.props { width: 100%; font-size: .86rem; border-collapse: collapse; }
.props th { text-align: left; font-weight: 500; color: var(--ink-soft); padding: 4px 0; }
.props td { text-align: right; font-weight: 650; padding: 4px 0; word-break: break-all; }
.verified { margin: 8px 0 0; font-size: .76rem; color: var(--ok); }
.result__actions { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; }
.result__actions .btn { flex: 1 1 150px; }

/* ---------- messages / loader ---------- */
.msg { margin-top: 14px; padding: 10px 12px; border-radius: 10px; font-size: .86rem; }
.msg--error { background: #fdf1f0; color: var(--err); border: 1px solid #f3c8c4; }
.msg--warn { background: #fff8e8; color: #8a5b09; border: 1px solid #f2dfb4; }
.msg--ok { background: #eefaf3; color: var(--ok); border: 1px solid #bfe5d1; }

.loader {
    position: absolute; inset: 0;
    display: flex; align-items: center; justify-content: center; gap: 10px;
    background: rgba(255, 255, 255, .82);
    border-radius: var(--radius);
    font-weight: 600; z-index: 5;
}
.spinner {
    width: 18px; height: 18px; border-radius: 50%;
    border: 3px solid #d5deea; border-top-color: var(--ink);
    animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- fullscreen editor ---------- */
.tool-card.is-fullscreen {
    position: fixed; inset: 0; z-index: 1000;
    border-radius: 0; overflow-y: auto;
    padding: 16px;
}
.tool-card.is-fullscreen .editor { grid-template-columns: 1fr; }
.tool-card.is-fullscreen .editor__canvas { height: min(58vh, 520px); }
.tool-card.is-fullscreen .preview-box { max-width: 220px; }
body.no-scroll { overflow: hidden; }

/* ---------- info table ---------- */
.info { margin-top: 34px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.info h2 { font-size: 1.02rem; margin-bottom: 12px; }
.spec-table { font-size: .88rem; margin: 0; }
.spec-table th { color: var(--ink-soft); font-weight: 600; }
.badge-svc { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: .76rem; font-weight: 700; }
.badge-svc--uti { background: var(--uti-soft); color: var(--uti); }
.badge-svc--nsdl { background: var(--nsdl-soft); color: var(--nsdl); }
.engine-note { margin: 12px 0 0; font-size: .82rem; color: var(--ink-soft); }

.site-foot { padding: 18px 0 28px; text-align: center; color: var(--ink-soft); font-size: .82rem; }

/* ---------- cropper look ---------- */
.cropper-view-box, .cropper-face { border-radius: 2px; }
.panel--uti .cropper-view-box { outline-color: var(--uti); }
.panel--nsdl .cropper-view-box { outline-color: var(--nsdl); }

/* ---------- responsive ---------- */
@media (max-width: 991.98px) {
    .editor { grid-template-columns: 1fr; }
    .editor__canvas { height: 280px; }
    .preview-box { max-width: 190px; }
}
@media (max-width: 575.98px) {
    body { font-size: 14.5px; }
    .tool-card { padding: 16px; }
    .editor__canvas { height: 250px; }
    .spec-strip { grid-template-columns: 1fr 1fr 1fr; gap: 6px; }
    .spec-strip strong { font-size: .9rem; }
    .result__image { max-width: 150px; }
    .tab { flex: 1 1 100%; }
}
