/* ---------- base ---------- */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    padding: 0;
    font-family: "Poppins", sans-serif;
    color: #1f2937;
}

body p {
    color: #1f2937;
}

:root {
    --blue: #2563eb;
    --blue-hover: #3975f8;
    --blue-active: #6291f5;
    --gray: #f3f4f6;
    --text: #1f2937;
    --danger: #dc2626;
}

/* ---------- colors ---------- */
.blue-color { color: var(--blue); }
.gray1-color { color: var(--text); }
.green-color { color: #10b981; }
.purple-color { color: #8b5cf6; }
.gray2-color { color: var(--gray); }

.container {
    width: 90%;
    max-width: 1200px;
    margin: 0 auto;
}

/* ---------- buttons ---------- */
.base-btn {
    display: inline-block;
    background-color: var(--blue);
    color: #fff;
    cursor: pointer;
    font-family: inherit;
    font-size: 1.4rem;
    padding: 10px 24px;
    border-radius: 10px;
    border: none;
    text-decoration: none;
    transition: background-color 0.3s;
}

.base-btn:hover { background-color: var(--blue-hover); }
.base-btn:active { background-color: var(--blue-active); }
.base-btn:disabled { opacity: 0.6; cursor: wait; }

.ghost-btn {
    background: #fff;
    color: var(--blue);
    border: 2px solid var(--blue);
    border-radius: 10px;
    padding: 6px 14px;
    font-family: inherit;
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s;
}

.ghost-btn:hover { background: var(--blue); color: #fff; }
.ghost-btn.danger { color: var(--danger); border-color: var(--danger); }
.ghost-btn.danger:hover { background: var(--danger); color: #fff; }

:focus-visible {
    outline: 3px solid var(--blue-active);
    outline-offset: 2px;
}

/* ---------- nav ---------- */
#brand-box {
    display: flex;
    position: absolute;
    top: 40px;
    margin-left: 20px;
    z-index: 2;
}

#brand-link a {
    text-decoration: none;
    font-weight: 500;
    font-size: 2.2rem;
}

/* ---------- header ---------- */
header#top {
    background: url(../imgs/header-img1.png) center / cover no-repeat;
    border-bottom: 1px solid hsla(215, 28%, 17%, 0.4);
}

#header-box {
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}

#header-title {
    font-size: clamp(2.4rem, 6vw, 4rem);
    font-weight: 600;
    margin: 0;
}

#header-text {
    font-size: clamp(1.1rem, 3vw, 2rem);
}

/* ---------- form ---------- */
#formSec {
    padding: 50px 0;
    margin: 30px 0;
    border-bottom: 1px solid hsla(215, 28%, 17%, 0.4);
}

#formBox {
    background-color: var(--gray);
    border-radius: 10px;
    padding: 20px;
}

.formTitle {
    font-size: clamp(2rem, 5vw, 3rem);
    font-weight: bold;
    text-align: center;
    margin: 0 0 10px;
}

.draftStatus {
    text-align: center;
    font-size: 0.9rem;
    color: #6b7280 !important;
    margin: 0 0 20px;
}

.formGroup {
    border: none;
    border-bottom: 1px solid #b6b6b644;
    margin: 0;
    padding: 10px 0 30px;
    min-width: 0;
}

.formGroup.noBorder { border-bottom: none; }

.formHeader {
    font-size: 1.8rem;
    font-weight: bold;
    padding: 0;
    margin: 20px auto;
    text-align: center;
}

.formItems {
    display: flex;
    flex-wrap: wrap;
    gap: 16px 20px;
}

.formItem {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 1rem;
    flex: 1 1 240px;
}

.formItem.wide { flex-basis: 100%; }
.formItem label { font-weight: 600; }
.req { color: var(--danger); }

.baseInput {
    border: 2px solid hsla(0, 0%, 31%, 0.18);
    border-radius: 10px;
    padding: 8px 10px;
    font-size: 1rem;
    font-family: "Poppins", sans-serif;
    width: 100%;
    background: #fff;
}

textarea.baseInput { resize: vertical; }
.baseInput:hover { border-color: var(--blue-active); }
.baseInput:focus { outline: none; border-color: var(--blue-active); }
.baseInput.invalid { border-color: var(--danger); }

.errorMsg {
    color: var(--danger);
    font-size: 0.8rem;
    min-height: 1em;
}

.counter { color: #6b7280; font-size: 0.8rem; text-align: right; }

.photo-crop-help { margin: -2px 0 8px; color: #6b7280; font-size: .84rem; line-height: 1.4; }

.photoRow {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
}

.photoRow input { flex: 1 1 200px; width: auto; }

#photoPreview {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #fff;
    box-shadow: 0 0 0 2px hsla(0, 0%, 31%, 0.18);
}

/* dynamic entries */
.entryList { display: flex; flex-direction: column; gap: 16px; margin-bottom: 16px; }

.entry {
    position: relative;
    background: #fff;
    border-radius: 10px;
    padding: 16px;
    border: 1px solid #e5e7eb;
}

.entry .formItems { padding-right: 0; }
.entry.compact .formItem { flex: 1 1 180px; }

.entry .removeEntry {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 30px;
    height: 30px;
    padding: 0;
    border-radius: 50%;
    line-height: 1;
}

.entry .formItems { margin-right: 36px; }

.formActions { margin-top: 16px; text-align: right; }

/* ---------- templates ---------- */
#templateSelect {
    text-align: center;
    padding-bottom: 20px;
}

#templateItems {
    display: flex;
    justify-content: space-around;
    flex-wrap: wrap;
}

.templateItemImg {
    width: min(400px, 90%);
    height: auto;
    margin: 10px;
    cursor: pointer;
    border: 3px solid transparent;
    border-radius: 8px;
    transition: transform 0.2s, border 0.2s, opacity 0.2s;
}

.templateItemImg.notSelected { opacity: 0.6; border: 3px solid transparent; }
.templateItemImg.selected { opacity: 1; border: 3px solid #007bff; transform: scale(1.03); }
.templateItemImg:hover { opacity: 1; }

#templateSelect .base-btn { margin: 30px 0; }

/* ---------- footer ---------- */
footer {
    background-color: var(--blue);
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 20px 20px 0 0;
    color: #fff;
}

.footer-box {
    padding: 35px;
    display: flex;
    flex-wrap: wrap;
    gap: 24px;
    justify-content: space-between;
    align-items: baseline;
}

.footer-item {
    flex: 1 1 240px;
    display: flex;
    flex-direction: column;
}

.footer-item span { font-size: 1.6rem; font-weight: bold; }

.footer-item p {
    margin-top: 10px;
    font-size: 1.1rem;
    font-weight: 600;
    color: #e5e7eb;
    max-width: 90%;
}

.footer-item ul {
    margin-top: 10px;
    font-size: 1.2rem;
    padding: 0;
    color: #fff;
}

#learnMore { list-style: square inside; line-height: 1.6; }
.footer-item ul li a { text-decoration: none; color: #e5e7eb; }
.footer-item ul li a:hover { color: #fff; }

#icons { list-style: none; display: flex; gap: 20px; margin-left: 0; }
#icons li { font-size: 2.2rem; }

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    * { transition: none !important; }
}

/* ---------- tools, score card, template previews ---------- */
.toolRow { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-bottom: 18px; }
.ghost-btn i { margin-right: 4px; }

.scoreCard { background: #fff; border: 1px solid #e5e7eb; border-radius: 10px; padding: 14px 16px; margin-bottom: 18px; }
.scoreTop { display: flex; justify-content: space-between; margin-bottom: 8px; }
.scoreBar { height: 10px; border-radius: 99px; background: #e5e7eb; overflow: hidden; }
#scoreFill { height: 100%; width: 0; border-radius: 99px; background: #ef4444; transition: width .3s; }
#scoreFill[data-level="mid"] { background: #f59e0b; }
#scoreFill[data-level="high"] { background: #10b981; }
#scoreTips { margin: 10px 0 0; padding-left: 20px; font-size: .9rem; color: #4b5563; }
#scoreTips:empty { display: none; }

#templateItems { display: flex; flex-wrap: wrap; gap: 22px; justify-content: center; }
.tplCard {
    width: 280px; text-align: center; cursor: pointer; padding: 10px; border-radius: 12px;
    border: 3px solid transparent; opacity: .75; transition: opacity .2s, border-color .2s, transform .2s;
}
.tplCard:hover { opacity: 1; }
.tplCard.selected { opacity: 1; border-color: #2563eb; transform: translateY(-3px); }
.tplCard strong { display: block; margin-top: 8px; }
.tplCard small { color: #6b7280; }
.tplThumb { position: relative; width: 260px; height: 371px; overflow: hidden; background: #fff; border: 1px solid #d1d5db; border-radius: 6px; box-shadow: 0 2px 10px rgba(0, 0, 0, .12); }
.tplThumb iframe { position: absolute; top: 0; left: 0; width: 794px; height: 1123px; border: 0; transform-origin: top left; pointer-events: none; }

/* ---------- guided, step-by-step form ---------- */
.wizard-step[hidden] { display: none !important; }
.wizard-step-intro { margin: 0 0 12px; }
.wizard-step-intro h3 { margin: 0 0 5px; font-size: clamp(1.25rem, 3vw, 1.6rem); color: #111827; }
.wizard-step-intro p { margin: 0 0 16px; color: #6b7280; font-size: .95rem; }
.wizard-progress { margin: 0 0 18px; }
.wizard-progress-label { font-weight: 600; font-size: .92rem; margin-bottom: 8px; }
.wizard-progress-track { height: 7px; background: #e5e7eb; border-radius: 999px; overflow: hidden; }
.wizard-progress-fill { height: 100%; width: 0; background: var(--blue); border-radius: inherit; transition: width .22s ease; }
.wizard-nav { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 20px 0 12px; }
.wizard-nav .base-btn { font-size: 1rem; }
.wizard-nav .ghost-btn, .templateBack { min-height: 44px; }
.templateBack { margin: 0 0 18px; }
.fieldHint { color: #6b7280; font-size: .78rem; }

@media (max-width: 640px) {
    .container { width: min(94%, 1200px); }
    #brand-box { top: 18px; margin-left: 4px; }
    #brand-link a { font-size: 1.8rem; }
    #header-box { min-height: 76svh; padding-top: 60px; }
    #formSec { padding: 28px 0; margin: 16px 0; }
    #formBox { padding: 14px; }
    .formHeader { font-size: 1.35rem; }
    .formItems { gap: 12px; }
    .formItem, .entry.compact .formItem { flex-basis: 100%; }
    .entry { padding: 14px 12px; }
    .entry .formItems { margin-right: 0; padding-top: 24px; }
    .entry .removeEntry { top: 7px; right: 7px; }
    .toolRow { display: grid; grid-template-columns: 1fr; }
    .toolRow .ghost-btn { width: 100%; min-height: 42px; }
    .wizard-nav { position: sticky; bottom: 8px; z-index: 5; background: #fff; padding: 10px; border: 1px solid #e5e7eb; border-radius: 12px; box-shadow: 0 6px 18px rgba(15, 23, 42, .12); }
    .wizard-nav .base-btn { padding: 10px 14px; }
    .tplCard { width: min(100%, 300px); }
    .tplThumb { margin: 0 auto; }
    .footer-box { padding: 24px 8px; }
}

@media (prefers-reduced-motion: reduce) {
    .wizard-progress-fill { transition: none; }
}

/* ---------- profile photo cropper ---------- */
.photo-crop-dialog {
    width: min(94vw, 460px);
    max-width: 460px;
    padding: 0;
    border: 0;
    border-radius: 18px;
    color: #111827;
    background: transparent;
    box-shadow: 0 24px 80px rgba(15, 23, 42, .28);
}
.photo-crop-dialog::backdrop { background: rgba(15, 23, 42, .62); backdrop-filter: blur(3px); }
.photo-crop-card { background: #fff; border-radius: 18px; padding: 20px; }
.photo-crop-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.photo-crop-head h2 { margin: 0 0 5px; font-size: 1.25rem; color: #111827; }
.photo-crop-head p { margin: 0; color: #6b7280; font-size: .9rem; line-height: 1.45; }
.photo-crop-close { flex: 0 0 auto; border: 1px solid #e5e7eb; border-radius: 9px; background: #fff; color: #374151; width: 36px; height: 36px; font-size: 1.45rem; line-height: 1; cursor: pointer; }
.photo-crop-canvas-wrap { width: min(100%, 320px); aspect-ratio: 1; margin: 0 auto 16px; overflow: hidden; border-radius: 12px; background: #e5e7eb; border: 1px solid #d1d5db; }
#photoCropCanvas { display: block; width: 100%; height: 100%; cursor: grab; touch-action: none; }
#photoCropCanvas.is-dragging { cursor: grabbing; }
.photo-crop-zoom { display: grid; grid-template-columns: auto minmax(0, 1fr) 38px; align-items: center; gap: 12px; margin: 0 0 18px; font-weight: 600; font-size: .9rem; }
.photo-crop-zoom input { width: 100%; accent-color: var(--blue); }
.photo-crop-zoom output { text-align: right; color: #4b5563; font-variant-numeric: tabular-nums; }
.photo-crop-actions { display: flex; justify-content: flex-end; gap: 10px; }
.photo-crop-actions button { min-height: 44px; }
@media (max-width: 480px) {
    .photo-crop-dialog { width: calc(100vw - 20px); max-height: calc(100dvh - 24px); overflow-y: auto; }
    .photo-crop-card { padding: 16px; }
    .photo-crop-actions { flex-direction: column-reverse; }
    .photo-crop-actions button { width: 100%; justify-content: center; }
}
