/* ============================================================
   NTUC Trainer Platform - global stylesheet
   ============================================================ */
:root {
    --navy:        #0f2557;
    --navy-dark:   #0a1a3f;
    --blue:        #1e5eff;
    --red:         #e11931;
    --bg:          #f2f4f8;
    --card:        #ffffff;
    --border:      #e3e7ee;
    --text:        #1c2333;
    --muted:       #6b7486;
    --success-bg:  #e6f7ee;  --success-fg: #146c43;
    --error-bg:    #fdecec;  --error-fg:   #b02a37;
    --info-bg:     #e8f0fe;  --info-fg:    #1a4fb4;
    --radius:      12px;
    --shadow:      0 2px 10px rgba(15, 37, 87, .08);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 15px;
    line-height: 1.55;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

.muted { color: var(--muted); font-weight: normal; font-size: .9em; }
.mt-8 { margin-top: 8px; }

/* ---------- Navbar ---------- */
.navbar {
    background: linear-gradient(90deg, var(--navy-dark), var(--navy));
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    height: 60px;
    box-shadow: 0 2px 8px rgba(0,0,0,.18);
    position: sticky;
    top: 0;
    z-index: 50;
}

.nav-brand {
    color: #fff;
    font-size: 20px;
    font-weight: 700;
    letter-spacing: .5px;
}
.nav-brand span { color: var(--red); }
.nav-brand:hover { text-decoration: none; opacity: .9; }

.nav-right { display: flex; align-items: center; gap: 16px; }

.user-menu { position: relative; padding: 18px 0; cursor: default; }
.user-name { color: #dfe6f5; font-size: 14px; white-space: nowrap; }
.user-name b { color: #fff; }
.caret { font-size: 11px; opacity: .8; }

.user-dropdown {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: var(--shadow);
    min-width: 185px;
    overflow: hidden;
}
.user-menu:hover .user-dropdown { display: block; }
.dropdown-item {
    display: block;
    padding: 11px 16px;
    color: var(--text);
    font-size: 14px;
}
.dropdown-item:hover { background: var(--bg); text-decoration: none; }

.btn-logout {
    background: var(--red);
    color: #fff !important;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
}
.btn-logout:hover { background: #c31229; text-decoration: none; }

/* ---------- Layout ---------- */
.container {
    width: 100%;
    max-width: 1080px;
    margin: 0 auto;
    padding: 34px 24px 60px;
    flex: 1;
}
.page-narrow { max-width: 520px; margin: 0 auto; }

.page-title { margin: 0 0 4px; font-size: 26px; color: var(--navy); }
.page-sub   { margin: 0 0 26px; color: var(--muted); }

.site-footer {
    text-align: center;
    color: var(--muted);
    font-size: 12px;
    padding: 18px;
    border-top: 1px solid var(--border);
    background: #fff;
}

/* ---------- Cards ---------- */
.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 26px 28px;
}
.content-section { margin-bottom: 20px; }
.content-section h2 { margin: 0 0 10px; font-size: 18px; color: var(--navy); }
.placeholder-text {
    color: var(--muted);
    font-style: italic;
    background: var(--bg);
    border: 1px dashed #c9d2e0;
    border-radius: 8px;
    padding: 16px;
}

.link-list { list-style: none; margin: 0; padding: 0; }
.link-list li { padding: 10px 0; border-bottom: 1px solid var(--border); }
.link-list li:last-child { border-bottom: none; }
.link-list a { font-weight: 600; margin-right: 10px; }

/* ---------- Dashboard tiles ---------- */
.tile-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 20px;
}
.tile {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 24px;
    color: var(--text);
    display: flex;
    flex-direction: column;
    transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.tile:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 22px rgba(15, 37, 87, .16);
    border-color: var(--blue);
    text-decoration: none;
}
.tile-icon { font-size: 30px; margin-bottom: 10px; }
.tile h3 { margin: 0 0 6px; font-size: 16px; color: var(--navy); }
.tile p  { margin: 0 0 14px; font-size: 13px; color: var(--muted); flex: 1; }
.tile-go { color: var(--blue); font-size: 13px; font-weight: 600; }

/* ---------- Forms ---------- */
label { display: block; margin: 14px 0 6px; font-weight: 600; font-size: 14px; }
input[type="text"], input[type="email"], input[type="password"],
input[type="date"], textarea, select {
    width: 100%;
    padding: 11px 13px;
    border: 1px solid #c9d2e0;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    background: #fff;
    color: var(--text);
}
input:focus, textarea:focus {
    outline: none;
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(30, 94, 255, .15);
}
textarea { resize: vertical; }

.otp-input {
    text-align: center;
    font-size: 26px !important;
    letter-spacing: 12px;
    font-weight: 700;
}

.btn {
    display: inline-block;
    border: none;
    border-radius: 8px;
    padding: 12px 22px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: background .15s ease;
    text-align: center;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--navy); color: #fff; margin-top: 18px; }
.btn-primary:hover { background: var(--navy-dark); }
.btn-secondary { background: #e8ecf4; color: var(--navy); }
.btn-secondary:hover { background: #d9e0ee; }
.btn-ghost { background: transparent; color: var(--blue); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--bg); }
.btn-block { width: 100%; display: block; }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

/* ---------- Alerts ---------- */
.alert { padding: 12px 16px; border-radius: 8px; margin: 12px 0; font-size: 14px; }
.alert-success { background: var(--success-bg); color: var(--success-fg); }
.alert-error   { background: var(--error-bg);   color: var(--error-fg); }
.alert-info    { background: var(--info-bg);    color: var(--info-fg); }

/* ---------- Auth pages ---------- */
.auth-body {
    background: linear-gradient(135deg, var(--navy-dark) 0%, var(--navy) 55%, #1c3f8f 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 30px 16px;
}
.auth-card {
    background: #fff;
    width: 100%;
    max-width: 420px;
    border-radius: 16px;
    padding: 38px 36px;
    box-shadow: 0 18px 50px rgba(0, 0, 0, .35);
}
.brand { font-size: 26px; margin: 0 0 4px; color: var(--navy); letter-spacing: .5px; }
.brand span { color: var(--red); }
.auth-card h2 { margin: 0 0 14px; font-size: 18px; color: var(--text); font-weight: 600; }
.auth-alt { text-align: center; font-size: 13px; margin: 14px 0 0; color: var(--muted); }

.setup-list { list-style: none; padding: 0; margin: 14px 0; }
.setup-list li { padding: 7px 4px; font-size: 14px; border-bottom: 1px solid var(--border); }
.setup-list li.ok   { color: var(--success-fg); }
.setup-list li.fail { color: var(--error-fg); font-weight: 600; }

/* ---------- PEN-200 generator ---------- */
.step-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px; height: 26px;
    border-radius: 50%;
    background: var(--navy);
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    margin-right: 10px;
}
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 22px;
}
@media (max-width: 640px) { .form-grid { grid-template-columns: 1fr; } }

.sig-wrap { margin-top: 6px; }
.sig-canvas {
    border: 2px dashed #c9d2e0;
    border-radius: 8px;
    background: #fff;
    cursor: crosshair;
    touch-action: none;
    display: block;
    width: 100%;
    max-width: 440px;
    height: 140px;
}
.sig-tools { margin-top: 8px; display: flex; gap: 10px; align-items: center; }

.paste-box { min-height: 170px; font-family: Consolas, Menlo, monospace; font-size: 13px; }

.learner-table { width: 100%; border-collapse: collapse; margin-top: 14px; }
.learner-table th {
    text-align: left;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .4px;
    color: var(--muted);
    padding: 8px 10px;
    border-bottom: 2px solid var(--border);
}
.learner-table td { padding: 6px 10px; border-bottom: 1px solid var(--border); }
.learner-table input { padding: 8px 10px; font-size: 13px; }
.learner-table .sn-cell { width: 40px; color: var(--muted); font-size: 13px; }
.learner-table .rm-cell { width: 46px; text-align: center; }
.rm-btn {
    background: transparent;
    border: none;
    color: var(--red);
    font-size: 16px;
    cursor: pointer;
    line-height: 1;
    padding: 4px 8px;
    border-radius: 6px;
}
.rm-btn:hover { background: var(--error-bg); }

.result-box { text-align: center; padding: 10px 0; }
.result-box .btn { margin: 8px 8px 0; }

.spinner {
    display: inline-block;
    width: 18px; height: 18px;
    border: 3px solid rgba(255,255,255,.35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin .8s linear infinite;
    vertical-align: -4px;
    margin-right: 8px;
}
@keyframes spin { to { transform: rotate(360deg); } }
.hidden { display: none !important; }
