:root {
    --app-bg: #f6f8fb;
    --app-ink: #172033;
    --app-muted: #6b7280;
    --app-primary: #0f766e;
    --app-primary-dark: #115e59;
    --app-border: #dbe3ec;
    --app-soft: #eef7f5;
}

* {
    letter-spacing: 0;
}

body {
    background: var(--app-bg);
    color: var(--app-ink);
    font-family: "Noto Sans Gujarati", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.app-container {
    max-width: 1180px;
}

.app-main {
    padding-bottom: 84px;
}

.navbar-brand {
    color: var(--app-primary-dark);
}

.brand-logo {
    width: 36px;
    height: 36px;
    object-fit: contain;
}

.btn-primary {
    --bs-btn-bg: var(--app-primary);
    --bs-btn-border-color: var(--app-primary);
    --bs-btn-hover-bg: var(--app-primary-dark);
    --bs-btn-hover-border-color: var(--app-primary-dark);
}

.login-shell {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
    padding: 32px 0 64px 0;
    margin-top: 0;
}

.login-brand {
    text-align: center;
}

.login-logo {
    width: min(130px, 35vw);
    aspect-ratio: 1;
    object-fit: contain;
    filter: drop-shadow(0 8px 16px rgba(13, 148, 136, 0.15));
}

.login-logo.small {
    width: 118px;
}

.login-brand h1 {
    font-size: clamp(1.4rem, 5vw, 2.5rem);
    line-height: 1.08;
    font-weight: 800;
    margin: -10px 0 0;
}

.admin-login-shell {
    min-height: calc(100vh - 72px);
    display: grid;
    place-items: center;
    padding: 32px 0;
}

.admin-login-panel {
    width: min(100%, 430px);
}

.auth-panel,
.app-card {
    background: #fff;
    border: 1px solid var(--app-border);
    border-radius: 8px;
    box-shadow: 0 14px 34px rgba(20, 32, 54, .06);
}

.auth-panel {
    padding: 24px;
    width: 100%;
    max-width: 860px;
}

.lookup-result {
    border: 1px solid var(--app-border);
    border-radius: 8px;
    padding: 12px 14px;
    background: #fff;
}

.lookup-success {
    border-color: #9fd8ca;
    background: #effaf6;
    color: #064e3b;
}

.lookup-error {
    border-color: #fecaca;
    background: #fff1f2;
    color: #991b1b;
}

.page-title {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: flex-start;
    margin: 26px 0 18px;
}

.page-title h1 {
    font-size: clamp(1.65rem, 4vw, 2.4rem);
    line-height: 1.1;
    margin: 0;
    font-weight: 800;
}

.page-title p {
    color: var(--app-muted);
    margin: 6px 0 0;
}

.metric-card {
    min-height: 126px;
    padding: 18px;
}

.metric-card .metric-icon {
    width: 42px;
    height: 42px;
    display: inline-grid;
    place-items: center;
    border-radius: 8px;
    background: var(--app-soft);
    color: var(--app-primary);
    font-size: 1.2rem;
}

.metric-card .metric-number {
    font-size: 2rem;
    line-height: 1;
    font-weight: 800;
    margin-top: 18px;
}

.field-card {
    padding: 16px;
    border: 1px solid var(--app-border);
    border-radius: 8px;
    background: #fff;
}

.field-add-row {
    display: grid;
    place-items: center;
    min-height: 82px;
    border: 1px dashed #9fb2c5;
    border-radius: 8px;
    background: rgba(255, 255, 255, .55);
}

.sticky-actions {
    position: sticky;
    bottom: 0;
    z-index: 12;
    background: rgba(246, 248, 251, .94);
    backdrop-filter: blur(10px);
    border-top: 1px solid var(--app-border);
    margin: 28px -12px 0;
    padding: 12px;
}

.form-section {
    background: #fff;
    border: 1px solid var(--app-border);
    border-radius: 8px;
    padding: 18px;
}

.required-dot {
    color: #dc2626;
    font-weight: 700;
}

.table > :not(caption) > * > * {
    vertical-align: middle;
}

.all-user-table-wrap {
    max-height: calc(100vh - 320px);
    min-height: 280px;
}

.all-user-table {
    min-width: 1040px;
}

.all-user-table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: #fff;
    white-space: nowrap;
}

.all-user-table td {
    max-width: 260px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.answer-list {
    display: grid;
    gap: 12px;
}

.answer-row {
    border: 1px solid var(--app-border);
    border-radius: 8px;
    padding: 12px;
    background: #fff;
}

.answer-row .label {
    color: var(--app-muted);
    font-size: .88rem;
    margin-bottom: 4px;
}

.mobile-submit {
    position: sticky;
    bottom: 0;
    z-index: 10;
    margin: 24px -12px 0;
    padding: 12px;
    background: rgba(246, 248, 251, .96);
    border-top: 1px solid var(--app-border);
}

@media (max-width: 860px) {
    .login-shell {
        grid-template-columns: 1fr;
        padding: 0 0 24px 0;
    }

    .login-brand h1 {
        font-size: 2.6rem;
    }

    .page-title {
        flex-direction: column;
        align-items: stretch;
    }
}

@media (max-width: 576px) {
    .auth-panel,
    .form-section {
        padding: 16px;
    }

    .login-brand h1 {
        font-size: 2.2rem;
    }

    .btn-lg,
    .form-control-lg {
        min-height: 52px;
    }
}

/* ══════════════════════════════════════════════════════════════════
   FORM TITLE BOX  (admin/form_edit.php)
══════════════════════════════════════════════════════════════════ */
.form-title-box {
    background: #fff;
    border: 2px solid var(--app-primary);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 24px rgba(15,118,110,.10);
}

/* header image strip — responsive, no fixed height */
.ftb-img-strip {
    position: relative;
    width: 100%;
    overflow: hidden;
    background: #f0fdf9;
    /* Responsive height, increased to avoid cutting off photos */
    max-height: clamp(160px, 45vw, 420px);
}
.ftb-img-preview {
    width: 100%;
    height: 100%;
    max-height: clamp(160px, 45vw, 420px);
    object-fit: contain; /* Use contain so logos/photos are fully visible */
    display: block;
}
.ftb-img-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 12px 16px;
    background: linear-gradient(transparent 40%, rgba(0,0,0,.5));
}
.ftb-img-badge {
    background: rgba(0,0,0,.55);
    color: #fff;
    font-size: .78rem;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 999px;
    backdrop-filter: blur(4px);
}
.ftb-img-btn {
    background: rgba(255,255,255,.88);
    color: #111;
    border: none;
    font-size: .8rem;
    font-weight: 600;
    padding: 5px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: .15s;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    line-height: 1;
}
.ftb-img-btn:hover { background: #fff; }
.ftb-img-btn.danger { color: #dc2626; }
.ftb-img-btn.danger:hover { background: #fee2e2; }

/* body area */
.ftb-body {
    padding: 20px 22px 16px;
}

/* title row */
.ftb-title-row {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    margin-bottom: 14px;
}
.ftb-title-icon {
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    border-radius: 10px;
    background: var(--app-soft);
    color: var(--app-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    margin-top: 20px;
}
.ftb-label {
    font-size: .78rem;
    font-weight: 700;
    color: var(--app-muted);
    text-transform: uppercase;
    letter-spacing: .05em;
    margin-bottom: 4px;
    display: block;
}
.ftb-title-input {
    width: 100%;
    font-size: 1.45rem;
    font-weight: 800;
    color: var(--app-ink);
    border: none;
    border-bottom: 2px solid var(--app-border);
    border-radius: 0;
    padding: 4px 0 6px;
    background: transparent;
    outline: none;
    transition: border-color .2s;
    line-height: 1.2;
}
.ftb-title-input:focus {
    border-bottom-color: var(--app-primary);
}
.ftb-title-input::placeholder { color: #c0c8d4; font-weight: 400; }

/* description row */
.ftb-desc-row { margin-bottom: 16px; }
.ftb-desc-input {
    width: 100%;
    border: 1px solid var(--app-border);
    border-radius: 8px;
    padding: 8px 12px;
    font-size: .95rem;
    color: var(--app-muted);
    background: #f8fafc;
    resize: vertical;
    outline: none;
    transition: border-color .2s;
    font-family: inherit;
}
.ftb-desc-input:focus { border-color: var(--app-primary); background: #fff; }
.ftb-desc-input::placeholder { color: #c0c8d4; }

/* controls row */
.ftb-controls-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: flex-end;
    padding-top: 12px;
    border-top: 1px solid var(--app-border);
}
.ftb-ctrl-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 7px;
    border: 1.5px dashed var(--app-primary);
    background: var(--app-soft);
    color: var(--app-primary);
    font-size: .85rem;
    font-weight: 600;
    cursor: pointer;
    transition: .15s;
    white-space: nowrap;
}
.ftb-ctrl-btn:hover { background: #c7ede8; }
.ftb-ctrl-item { display: flex; flex-direction: column; gap: 3px; }
.ftb-ctrl-label {
    font-size: .72rem;
    font-weight: 700;
    color: var(--app-muted);
    text-transform: uppercase;
    letter-spacing: .04em;
}
.ftb-ctrl-select,
.ftb-ctrl-date {
    font-size: .88rem;
    padding: 5px 10px;
    border: 1px solid var(--app-border);
    border-radius: 7px;
    background: #f8fafc;
    color: var(--app-ink);
    outline: none;
    transition: border-color .2s;
    height: 34px;
}
.ftb-ctrl-select:focus,
.ftb-ctrl-date:focus { border-color: var(--app-primary); }

/* ── Form header image display on user-facing form ──────────────── */
.form-header-img-wrap {
    border-radius: 12px 12px 0 0;
    overflow: hidden;
    margin-bottom: 0;
    background: #f6f8fb;
}
.form-header-img-wrap img {
    width: 100%;
    height: auto;
    object-fit: contain; /* Prevent cropping */
    display: block;
}
.form-title-display {
    background: #fff;
    border: 1px solid var(--app-border);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 18px rgba(15,118,110,.08);
    margin-bottom: 18px;
}
.form-title-display.has-image {
    border-top-left-radius: 0;
    border-top-right-radius: 0;
    border-top: none;
}
.form-title-display .ftd-inner {
    padding: 20px 22px;
}
.form-title-display h1 {
    font-size: clamp(1.45rem, 4vw, 2.1rem);
    font-weight: 800;
    color: var(--app-ink);
    margin: 0 0 6px;
    line-height: 1.15;
}
.form-title-display .ftd-desc {
    color: var(--app-muted);
    margin: 0;
    font-size: .96rem;
}
.form-title-display .ftd-meta {
    margin-top: 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

/* ══════════════════════════════════════════════════════════════════
   SECTION HEADER — divider in user-facing form
══════════════════════════════════════════════════════════════════ */
.form-section-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 28px 0 16px;
}
.form-section-header::before,
.form-section-header::after {
    content: '';
    flex: 1;
    height: 2px;
    background: linear-gradient(90deg, var(--app-soft), var(--app-border));
    border-radius: 2px;
}
.form-section-header::after {
    background: linear-gradient(90deg, var(--app-border), var(--app-soft));
}
.form-section-header span {
    font-size: .92rem;
    font-weight: 800;
    color: var(--app-primary);
    text-transform: uppercase;
    letter-spacing: .07em;
    white-space: nowrap;
    background: var(--app-soft);
    padding: 4px 14px;
    border-radius: 999px;
    border: 1.5px solid #9fd8ca;
}

/* Section header inside the admin field-card */
.field-card-section {
    background: linear-gradient(135deg, #f0fdf9, #fff);
    border-color: var(--app-primary);
    border-style: dashed;
}

/* ══════════════════════════════════════════════════════════════════
   WHATSAPP CHECKBOX
══════════════════════════════════════════════════════════════════ */
.whatsapp-check-wrap {
    margin-top: 10px;
}
.whatsapp-check-label {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: #f0fdf4;
    border: 1.5px solid #86efac;
    border-radius: 10px;
    padding: 10px 16px;
    cursor: pointer;
    font-size: .97rem;
    font-weight: 600;
    color: #15803d;
    transition: background .15s, border-color .15s;
    width: 100%;
}
.whatsapp-check-label:hover {
    background: #dcfce7;
    border-color: #4ade80;
}
.whatsapp-check-input {
    width: 20px;
    height: 20px;
    accent-color: #16a34a;
    cursor: pointer;
    flex-shrink: 0;
}
.whatsapp-check-label .bi-whatsapp {
    font-size: 1.25rem;
    color: #25d366;
}
.whatsapp-check-label span {
    flex: 1;
    color: #166534;
}

/* ── field-card: section header special color in admin ──── */
.field-card-section .h6 { color: var(--app-primary); }

/* ══════════════════════════════════════════════════════════════════
   VISUAL GRID INTERFACE (LOGIN)
══════════════════════════════════════════════════════════════════ */
.selection-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 12px;
    padding: 10px 0;
}
.selection-card {
    background: #fff;
    border: 2px solid var(--app-border);
    border-radius: 12px;
    padding: 16px 12px;
    text-align: center;
    cursor: pointer;
    font-weight: 700;
    color: var(--app-ink);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 6px rgba(0,0,0,0.02);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 80px;
}
.selection-card:hover {
    border-color: var(--app-primary);
    background: #f0fdf9;
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(15,118,110,0.08);
}
.selection-card:active {
    transform: translateY(0);
}
.selection-card.selected {
    border-color: var(--app-primary-dark);
    background: var(--app-primary);
    color: #fff;
}
.selection-card.selected .text-muted {
    color: #e2e8f0 !important;
}
.selection-card.selected .text-primary {
    color: #fff !important;
}
.tracking-wide {
    letter-spacing: 0.1em;
}
