:root {
    --primary: #1e3c72;
    --primary-light: #2a5298;
    --success: #1b8a5a;
    --danger: #c0392b;
    --bg: #f4f6fa;
    --card-bg: #ffffff;
    --text: #2c2c2c;
    --muted: #6b7280;
    --border: #e2e5ec;
    --radius: 12px;
}

* { box-sizing: border-box; }

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, var(--bg) 0%, #e8ecf5 100%);
    color: var(--text);
    margin: 0;
    min-height: 100vh;
}

.container {
    max-width: 720px;
    margin: 0 auto;
    padding: 40px 20px;
}

.card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 32px;
    box-shadow: 0 4px 24px rgba(30, 60, 114, 0.08);
    margin-bottom: 20px;
}

h1, h2, h3 { color: var(--primary); margin-top: 0; }

.topbar {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: white;
    padding: 16px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.topbar a { color: white; text-decoration: none; opacity: 0.9; }
.topbar a:hover { opacity: 1; text-decoration: underline; }

label { display: block; margin: 14px 0 6px; font-weight: 600; font-size: 14px; }

input[type=text], input[type=email], input[type=password], select {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 15px;
}
input:focus, select:focus { outline: none; border-color: var(--primary-light); }

button, .btn {
    display: inline-block;
    background: var(--primary);
    color: white;
    border: none;
    padding: 13px 22px;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s;
}
button:hover, .btn:hover { background: var(--primary-light); }
.btn-secondary { background: #eef1f7; color: var(--primary); }
.btn-secondary:hover { background: #dfe4f0; }
.btn-success { background: var(--success); }
.btn-success:hover { background: #21a56d; }
.btn-block { width: 100%; margin-top: 18px; }

.error { background: #fdeceb; color: var(--danger); padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; font-size: 14px; }
.success-msg { background: #e8f7f0; color: var(--success); padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; font-size: 14px; }

.level-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 14px;
}
.level-card.locked { opacity: 0.55; }
.badge { font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 20px; }
.badge-completed { background: #e8f7f0; color: var(--success); }
.badge-progress { background: #fff4e0; color: #b8860b; }
.badge-locked { background: #eee; color: var(--muted); }
.badge-new { background: #eef1f7; color: var(--primary); }

.progress-bar-outer { background: #eef1f7; border-radius: 20px; height: 10px; overflow: hidden; margin: 10px 0; }
.progress-bar-inner { background: var(--primary); height: 100%; transition: width 0.3s; }

.question-block { padding: 20px 0; border-bottom: 1px solid var(--border); }
.question-block:last-child { border-bottom: none; }
.q-number { color: var(--muted); font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; }
.q-text { font-size: 17px; font-weight: 600; margin: 8px 0 14px; }
.options label {
    display: flex; align-items: center; gap: 10px;
    font-weight: 400; padding: 10px 14px; border: 1px solid var(--border);
    border-radius: 8px; margin-bottom: 8px; cursor: pointer; transition: 0.15s;
}
.options label:hover { background: #f7f9fc; }
.options input[type=radio] { width: auto; }
.options label.answered { border-color: var(--primary-light); background: #f0f4fc; }

.save-status { font-size: 12px; color: var(--muted); min-height: 16px; margin-top: 4px; }
.save-status.saved { color: var(--success); }

.modal-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.5);
    display: flex; align-items: center; justify-content: center; padding: 20px; z-index: 100;
}
.modal-box {
    background: white; border-radius: var(--radius); padding: 30px; max-width: 480px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}
.modal-box h3 { margin-top: 0; }
.modal-actions { display: flex; gap: 10px; margin-top: 20px; flex-wrap: wrap; }

.footer-buttons { display: flex; gap: 12px; margin-top: 24px; flex-wrap: wrap; }
.footer-buttons form { flex: 1; min-width: 200px; }

.score-highlight { text-align: center; padding: 20px 0; }
.score-highlight .num { font-size: 48px; font-weight: 800; color: #000; }
.score-breakdown { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border); display: inline-block; text-align: left; }
.score-line { color: #000; font-weight: 600; font-size: 14.5px; margin: 6px 0; }
.score-line .score-num-blue { color: var(--primary-light); font-weight: 800; }
.score-line .score-num-green { color: var(--success); font-weight: 800; }

.btn-cert {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    text-align: center;
    padding: 14px 18px;
    border-radius: 8px;
    font-size: 14.5px;
    font-weight: 700;
    text-decoration: none;
    color: #fff;
    transition: opacity 0.15s, transform 0.15s;
}
.btn-cert:hover { opacity: 0.92; transform: translateY(-1px); }
.btn-cert-blue { background: linear-gradient(135deg, var(--primary), var(--primary-light)); }
.btn-cert-green { background: linear-gradient(135deg, #0d4a30, #14663f); }
.btn-cert-disabled {
    background: #c7cbd3;
    color: #6b7280;
    filter: grayscale(1);
    cursor: not-allowed;
    pointer-events: none;
}

/* ============================================================
   MODULE SCORECARDS
   ============================================================ */
.modules-heading {
    color: var(--primary);
    font-size: 22px;
    margin: 8px 0 18px;
    letter-spacing: 0.2px;
}

.module-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 22px;
    margin-bottom: 8px;
}
@media (max-width: 760px) {
    .module-grid { grid-template-columns: 1fr; }
}

.module-card {
    position: relative;
    display: flex;
    flex-direction: column;
    color: #fff;
    text-decoration: none;
    border-radius: 18px;
    padding: 28px 26px 22px;
    min-height: 360px;
    overflow: hidden;
    isolation: isolate;
    box-shadow: 0 10px 30px rgba(0,0,0,0.18);
    transition: transform 0.22s ease, box-shadow 0.22s ease;
}
.module-card::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    opacity: 0.5;
    background:
        radial-gradient(circle at 88% -10%, rgba(255,255,255,0.28), transparent 45%),
        radial-gradient(circle at -10% 115%, rgba(255,255,255,0.16), transparent 50%);
}
.module-card::after {
    content: "";
    position: absolute;
    top: -60px; right: -60px;
    width: 180px; height: 180px;
    border-radius: 50%;
    background: rgba(255,255,255,0.07);
    z-index: -1;
}
a.module-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 16px 38px rgba(0,0,0,0.28);
}

.module-blue {
    background: linear-gradient(150deg, #16305e 0%, #1e3c72 45%, #2a5298 100%);
}
.module-green {
    background: linear-gradient(150deg, #06301f 0%, #0d4a30 45%, #14663f 100%);
}
.module-orange {
    background: linear-gradient(150deg, #7c2d00 0%, #c2410c 45%, #f97316 100%);
}
.module-datacenter {
    background: linear-gradient(150deg, #2c5590 0%, #4879b3 50%, #8fb4dd 100%);
}
.datacenter-card .module-title { text-transform: none; font-size: 19px; }
.survey-card {
    width: 100%;
    min-height: unset;
    padding: 26px 30px 22px;
    margin-bottom: 20px;
}
.survey-card .module-title { text-transform: none; font-size: 19px; }

.module-icon { font-size: 30px; margin-bottom: 10px; filter: drop-shadow(0 2px 4px rgba(0,0,0,0.25)); }

.module-title {
    font-weight: 800;
    color: #ffffff;
    font-size: 20px;
    line-height: 1.3;
    margin: 0 0 14px;
    text-shadow: 0 1px 3px rgba(0,0,0,0.25);
}

.module-desc {
    font-size: 14.5px;
    line-height: 1.55;
    color: rgba(255,255,255,0.92);
    margin: 0 0 14px;
}
.module-desc-secondary {
    font-size: 13.5px;
    color: rgba(255,255,255,0.85);
    background: rgba(0,0,0,0.16);
    border-left: 3px solid rgba(255,255,255,0.55);
    padding: 10px 12px;
    border-radius: 8px;
}
.module-desc-secondary strong { color: #ffe9a8; }

.module-recommend {
    display: inline-block;
    align-self: flex-start;
    font-size: 12px;
    font-weight: 700;
    background: rgba(255,255,255,0.18);
    padding: 5px 12px;
    border-radius: 20px;
    margin-bottom: 14px;
}

.module-footer {
    margin-top: auto;
    padding-top: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    border-top: 1px solid rgba(255,255,255,0.22);
}
.module-duration {
    font-size: 12.5px;
    font-weight: 600;
    color: rgba(255,255,255,0.85);
}
.module-cta {
    font-weight: 800;
    font-size: 14.5px;
    color: #fff;
    letter-spacing: 0.2px;
}
.module-lock-msg {
    font-weight: 700;
    font-size: 13px;
    color: #fff;
}

.module-status-badge {
    position: absolute;
    top: 18px; right: 18px;
    background: rgba(255,255,255,0.92);
    color: #14663f;
    font-size: 11.5px;
    font-weight: 800;
    padding: 5px 11px;
    border-radius: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

/* Locked state: greyscale + non-interactive */
.module-card.module-locked {
    filter: grayscale(1);
    cursor: not-allowed;
    box-shadow: 0 6px 18px rgba(0,0,0,0.12);
}
.module-card.module-locked::before { opacity: 0.15; }
.module-card.module-locked .module-lock-icon {
    position: absolute;
    top: 18px; right: 18px;
    width: 34px; height: 34px;
    border-radius: 50%;
    background: rgba(255,255,255,0.22);
    display: flex; align-items: center; justify-content: center;
    font-size: 15px;
}

/* ============================================================
   RULES SECTION
   ============================================================ */
.rules-section { margin-top: 6px; }
.rules-heading {
    color: var(--primary);
    font-size: 20px;
    margin: 0 0 4px;
}
.rules-subtext { color: var(--muted); font-size: 13.5px; margin: 0 0 20px; }

.rules-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}
@media (max-width: 760px) {
    .rules-grid { grid-template-columns: 1fr; }
}

.rule-item {
    position: relative;
    background: #fbfcff;
    border: 1px solid var(--border);
    border-left: 4px solid var(--primary-light);
    border-radius: 10px;
    padding: 16px 16px 16px 20px;
    transition: border-color 0.15s, background 0.15s;
}
.rule-item:hover { background: #f3f6fc; border-left-color: var(--success); }

.rule-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px; height: 24px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    font-size: 12px;
    font-weight: 800;
    margin-right: 8px;
    flex-shrink: 0;
}
.rule-title {
    font-weight: 700;
    font-size: 14.5px;
    color: var(--text);
}
.rule-text {
    font-size: 13.5px;
    color: var(--muted);
    line-height: 1.55;
    margin: 8px 0 0;
}
.dot {
    display: inline-block;
    width: 10px; height: 10px;
    border-radius: 3px;
    margin: 0 3px -1px;
}
.dot-yellow { background: #f4c542; }
.dot-grey { background: #b9c0cc; }
.dot-green { background: var(--success); }
.dot-red { background: var(--danger); }
