/* AdmissionBridge Public Portal */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --c-primary:     #3b82f6;
    --c-primary-h:   #2563eb;
    --c-primary-bg:  #eff6ff;
    --c-bg:          #f8fafc;
    --c-surface:     #ffffff;
    --c-border:      #e2e8f0;
    --c-text:        #0f172a;
    --c-text-muted:  #64748b;
    --c-success:     #22c55e;
    --c-success-bg:  #f0fdf4;
    --c-warning:     #f59e0b;
    --c-warning-bg:  #fffbeb;
    --c-danger:      #ef4444;
    --c-danger-bg:   #fef2f2;
    --radius:        8px;
    --radius-lg:     12px;
    --shadow-sm:     0 1px 2px rgba(0,0,0,.06);
    --shadow:        0 1px 3px rgba(0,0,0,.10), 0 1px 2px rgba(0,0,0,.06);
    --shadow-lg:     0 10px 15px -3px rgba(0,0,0,.10), 0 4px 6px -4px rgba(0,0,0,.10);
    --max-w:         680px;
}

html, body { height: 100%; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    font-size: 15px;
    line-height: 1.6;
    color: var(--c-text);
    background: var(--c-bg);
    -webkit-font-smoothing: antialiased;
}

/* ── Top bar ────────────────────────────────────────────────────────────── */

.pub-topbar {
    background: var(--c-surface);
    border-bottom: 1px solid var(--c-border);
    padding: 0 20px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: sticky;
    top: 0;
    z-index: 100;
}

.pub-topbar-inner {
    width: 100%;
    max-width: var(--max-w);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.pub-brand {
    font-size: 18px;
    font-weight: 700;
    color: var(--c-text);
    text-decoration: none;
}
.pub-brand span { color: var(--c-primary); }

.pub-topbar-links {
    display: flex;
    gap: 16px;
}

.pub-topbar-links a {
    font-size: 13px;
    color: var(--c-text-muted);
    text-decoration: none;
    font-weight: 500;
}
.pub-topbar-links a:hover { color: var(--c-primary); }

/* ── Main container ─────────────────────────────────────────────────────── */

.pub-main {
    max-width: var(--max-w);
    margin: 0 auto;
    padding: 32px 20px 60px;
}

/* ── Card ───────────────────────────────────────────────────────────────── */

.pub-card {
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 32px;
    margin-bottom: 24px;
}

.pub-card-header {
    margin-bottom: 24px;
}

.pub-card-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--c-text);
    margin-bottom: 6px;
}

.pub-card-desc {
    font-size: 14px;
    color: var(--c-text-muted);
    line-height: 1.5;
}

/* ── Step indicator ─────────────────────────────────────────────────────── */

.pub-steps {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    margin-bottom: 32px;
    padding: 0 8px;
    overflow-x: auto;
}

.pub-step {
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

.pub-step-num {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    background: var(--c-border);
    color: var(--c-text-muted);
    flex-shrink: 0;
}

.pub-step-label {
    font-size: 13px;
    color: var(--c-text-muted);
    font-weight: 500;
}

.pub-step.active .pub-step-num {
    background: var(--c-primary);
    color: #fff;
}
.pub-step.active .pub-step-label {
    color: var(--c-text);
    font-weight: 600;
}

.pub-step.done .pub-step-num {
    background: var(--c-success);
    color: #fff;
}
.pub-step.done .pub-step-label {
    color: var(--c-success);
}

.pub-step-line {
    width: 32px;
    height: 2px;
    background: var(--c-border);
    flex-shrink: 0;
    margin: 0 4px;
}
.pub-step-line.done { background: var(--c-success); }

/* ── Form fields ────────────────────────────────────────────────────────── */

.pub-field {
    margin-bottom: 20px;
}

.pub-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--c-text);
    margin-bottom: 6px;
}

.pub-label .req {
    color: var(--c-danger);
    margin-left: 2px;
}

.pub-input,
.pub-select,
.pub-textarea {
    width: 100%;
    padding: 10px 14px;
    font-size: 15px;
    line-height: 1.5;
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    background: var(--c-surface);
    color: var(--c-text);
    transition: border-color .15s, box-shadow .15s;
}

.pub-input:focus,
.pub-select:focus,
.pub-textarea:focus {
    outline: none;
    border-color: var(--c-primary);
    box-shadow: 0 0 0 3px rgba(59,130,246,.15);
}

.pub-input.is-invalid,
.pub-select.is-invalid,
.pub-textarea.is-invalid {
    border-color: var(--c-danger);
}

.pub-textarea {
    resize: vertical;
    min-height: 80px;
}

.pub-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2364748b' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

.pub-hint {
    font-size: 12px;
    color: var(--c-text-muted);
    margin-top: 4px;
}

.pub-error {
    font-size: 12px;
    color: var(--c-danger);
    margin-top: 4px;
}

.pub-field-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

/* ── Checkbox / consent ─────────────────────────────────────────────────── */

.pub-checkbox-wrap {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.pub-checkbox-wrap input[type="checkbox"] {
    margin-top: 3px;
    width: 18px;
    height: 18px;
    accent-color: var(--c-primary);
    flex-shrink: 0;
}

.pub-checkbox-wrap label {
    font-size: 14px;
    color: var(--c-text);
    line-height: 1.5;
}

/* ── ID type toggle ─────────────────────────────────────────────────────── */

.pub-id-toggle {
    display: flex;
    gap: 0;
    margin-bottom: 16px;
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    overflow: hidden;
}

.pub-id-toggle label {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    background: var(--c-surface);
    color: var(--c-text-muted);
    border-right: 1px solid var(--c-border);
    transition: background .15s, color .15s;
}
.pub-id-toggle label:last-child { border-right: none; }
.pub-id-toggle input { display: none; }
.pub-id-toggle input:checked + label {
    background: var(--c-primary);
    color: #fff;
}

/* ── File upload zone ───────────────────────────────────────────────────── */

.pub-upload-zone {
    border: 2px dashed var(--c-border);
    border-radius: var(--radius);
    padding: 24px 16px;
    text-align: center;
    cursor: pointer;
    transition: border-color .15s, background .15s;
    position: relative;
}
.pub-upload-zone:hover {
    border-color: var(--c-primary);
    background: var(--c-primary-bg);
}
.pub-upload-zone.is-invalid {
    border-color: var(--c-danger);
}

.pub-upload-zone input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

.pub-upload-icon {
    margin-bottom: 8px;
    color: var(--c-text-muted);
}

.pub-upload-text {
    font-size: 14px;
    color: var(--c-text-muted);
}
.pub-upload-text strong { color: var(--c-primary); }

.pub-upload-hint {
    font-size: 12px;
    color: var(--c-text-muted);
    margin-top: 4px;
}

.pub-upload-preview {
    margin-top: 12px;
    font-size: 13px;
    color: var(--c-success);
    font-weight: 500;
}

/* ── Document list (documents page) ────────────────────────────────────── */

.pub-doc-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.pub-doc-item {
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    padding: 16px;
}

.pub-doc-item-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.pub-doc-type {
    font-size: 14px;
    font-weight: 600;
    color: var(--c-text);
}

.pub-doc-status {
    font-size: 12px;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 999px;
}
.pub-doc-status.pending { background: var(--c-warning-bg); color: var(--c-warning); }
.pub-doc-status.verified { background: var(--c-success-bg); color: var(--c-success); }
.pub-doc-status.rejected { background: var(--c-danger-bg); color: var(--c-danger); }
.pub-doc-status.missing { background: #f1f5f9; color: var(--c-text-muted); }

.pub-doc-file {
    font-size: 13px;
    color: var(--c-text-muted);
}

.pub-doc-rejection {
    font-size: 13px;
    color: var(--c-danger);
    margin-top: 6px;
}

/* ── Buttons ────────────────────────────────────────────────────────────── */

.pub-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 28px;
    font-size: 15px;
    font-weight: 600;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    text-decoration: none;
    transition: background .15s, box-shadow .15s;
}

.pub-btn-primary {
    background: var(--c-primary);
    color: #fff;
}
.pub-btn-primary:hover {
    background: var(--c-primary-h);
}
.pub-btn-primary:disabled {
    opacity: .6;
    cursor: not-allowed;
}

.pub-btn-secondary {
    background: var(--c-surface);
    color: var(--c-text);
    border: 1px solid var(--c-border);
}
.pub-btn-secondary:hover {
    background: #f1f5f9;
}

.pub-btn-full {
    width: 100%;
}

.pub-btn-group {
    display: flex;
    gap: 12px;
    margin-top: 28px;
}

/* ── Alert boxes ────────────────────────────────────────────────────────── */

.pub-alert {
    padding: 14px 18px;
    border-radius: var(--radius);
    font-size: 14px;
    line-height: 1.5;
    margin-bottom: 20px;
}
.pub-alert-danger {
    background: var(--c-danger-bg);
    color: var(--c-danger);
    border: 1px solid #fecaca;
}
.pub-alert-success {
    background: var(--c-success-bg);
    color: #15803d;
    border: 1px solid #bbf7d0;
}
.pub-alert-warning {
    background: var(--c-warning-bg);
    color: #92400e;
    border: 1px solid #fde68a;
}
.pub-alert-info {
    background: var(--c-primary-bg);
    color: #1d4ed8;
    border: 1px solid #bfdbfe;
}

/* ── Info grid (payment ref, confirmation) ──────────────────────────────── */

.pub-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    overflow: hidden;
}

.pub-info-item {
    padding: 14px 16px;
    border-bottom: 1px solid var(--c-border);
}
.pub-info-item:nth-child(odd) {
    border-right: 1px solid var(--c-border);
}
.pub-info-item:nth-last-child(-n+2) {
    border-bottom: none;
}

.pub-info-label {
    font-size: 12px;
    color: var(--c-text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: .02em;
}

.pub-info-value {
    font-size: 15px;
    font-weight: 600;
    color: var(--c-text);
    margin-top: 2px;
}

/* ── Status badge (status tracker) ──────────────────────────────────────── */

.pub-status-badge {
    display: inline-block;
    padding: 4px 14px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 600;
    text-transform: capitalize;
}
.pub-status-badge.submitted     { background: #dbeafe; color: #1d4ed8; }
.pub-status-badge.payment_pending { background: var(--c-warning-bg); color: #92400e; }
.pub-status-badge.fee_paid      { background: var(--c-success-bg); color: #15803d; }
.pub-status-badge.assessment_scheduled { background: #f3e8ff; color: #7c3aed; }
.pub-status-badge.assessment_complete  { background: #dbeafe; color: #1d4ed8; }
.pub-status-badge.accepted      { background: var(--c-success-bg); color: #15803d; }
.pub-status-badge.enrolled      { background: var(--c-success-bg); color: #15803d; }
.pub-status-badge.waitlisted    { background: var(--c-warning-bg); color: #92400e; }
.pub-status-badge.declined      { background: var(--c-danger-bg); color: #b91c1c; }
.pub-status-badge.withdrawn     { background: #f1f5f9; color: var(--c-text-muted); }
.pub-status-badge.draft         { background: #f1f5f9; color: var(--c-text-muted); }

/* ── Section titles ─────────────────────────────────────────────────────── */

.pub-section-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--c-text);
    margin-bottom: 16px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--c-border);
}

/* ── Status tracker timeline ────────────────────────────────────────────── */

.pub-timeline {
    display: flex;
    flex-direction: column;
    gap: 0;
    margin: 20px 0;
}

.pub-timeline-item {
    display: flex;
    gap: 16px;
    padding-bottom: 20px;
    position: relative;
}

.pub-timeline-item:last-child { padding-bottom: 0; }

.pub-timeline-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--c-border);
    flex-shrink: 0;
    margin-top: 4px;
    position: relative;
    z-index: 1;
}
.pub-timeline-item:not(:last-child) .pub-timeline-dot::after {
    content: '';
    position: absolute;
    top: 12px;
    left: 5px;
    width: 2px;
    height: calc(100% + 8px);
    background: var(--c-border);
}
.pub-timeline-dot.active { background: var(--c-primary); }
.pub-timeline-dot.done   { background: var(--c-success); }

.pub-timeline-content {
    flex: 1;
}

.pub-timeline-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--c-text);
}

.pub-timeline-desc {
    font-size: 13px;
    color: var(--c-text-muted);
    margin-top: 2px;
}

/* ── Expandable detail toggle ──────────────────────────────────────────── */

.pub-detail-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--c-primary-bg);
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    color: var(--c-primary);
    margin-bottom: 0;
    transition: background .15s;
    user-select: none;
}
.pub-detail-toggle:hover { background: #dbeafe; }

.pub-detail-panel {
    border: 1px solid var(--c-border);
    border-top: none;
    border-radius: 0 0 var(--radius) var(--radius);
    padding: 20px 16px;
    margin-bottom: 24px;
    background: var(--c-surface);
}

.pub-detail-section-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--c-text-muted);
    text-transform: uppercase;
    letter-spacing: .5px;
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--c-border);
}
.pub-detail-section-title:not(:first-child) { margin-top: 16px; }

/* ── Document re-upload ────────────────────────────────────────────────── */

.pub-reupload-section {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px dashed var(--c-border);
}

.pub-btn-link {
    background: none;
    border: none;
    color: var(--c-primary);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0;
}
.pub-btn-link:hover { color: var(--c-primary-h); text-decoration: underline; }

.pub-reupload-form {
    margin-top: 12px;
    padding: 14px;
    background: #fafbfc;
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
}

.pub-btn-sm {
    font-size: 13px;
    padding: 8px 16px;
}

/* ── Comment thread ────────────────────────────────────────────────────── */

.pub-comments-section {
    margin-bottom: 24px;
}

.pub-comments-thread {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 16px;
    max-height: 400px;
    overflow-y: auto;
    padding-right: 4px;
}

.pub-comment {
    padding: 12px 14px;
    border-radius: var(--radius);
    font-size: 14px;
}

.pub-comment-parent {
    background: var(--c-primary-bg);
    border: 1px solid #bfdbfe;
    margin-left: 0;
    margin-right: 40px;
}

.pub-comment-admin {
    background: #f8fafc;
    border: 1px solid var(--c-border);
    margin-left: 40px;
    margin-right: 0;
}

.pub-comment-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.pub-comment-author {
    font-weight: 600;
    font-size: 13px;
    color: var(--c-text);
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.pub-comment-time {
    font-size: 12px;
    color: var(--c-text-muted);
}

.pub-comment-body {
    color: var(--c-text);
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-word;
}

.pub-comments-empty {
    font-size: 14px;
    color: var(--c-text-muted);
    text-align: center;
    padding: 20px 0;
}

.pub-comment-form {
    padding: 14px;
    background: #fafbfc;
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
}

/* ── Alert variants ────────────────────────────────────────────────────── */

.pub-alert-success {
    background: var(--c-success-bg);
    border: 1px solid #bbf7d0;
    color: #166534;
}

.pub-alert-danger {
    background: var(--c-danger-bg);
    border: 1px solid #fecaca;
    color: #991b1b;
}

/* ── Footer ─────────────────────────────────────────────────────────────── */

.pub-footer {
    text-align: center;
    padding: 24px 20px;
    font-size: 13px;
    color: var(--c-text-muted);
    border-top: 1px solid var(--c-border);
    margin-top: 40px;
}

/* ── Responsive ─────────────────────────────────────────────────────────── */

@media (max-width: 600px) {
    .pub-card { padding: 20px 16px; }
    .pub-field-row { grid-template-columns: 1fr; gap: 0; }
    .pub-info-grid { grid-template-columns: 1fr; }
    .pub-info-item:nth-child(odd) { border-right: none; }
    .pub-info-item { border-bottom: 1px solid var(--c-border); }
    .pub-info-item:last-child { border-bottom: none; }
    .pub-btn-group { flex-direction: column; }
    .pub-step-label { display: none; }
    .pub-step-line { width: 20px; }
}
