/* ============================================================
   CFC Training Portal — Frontend Styles
   Brand: #0D72BA (blue), #93278F (purple), #49AB62 (green),
          #F17749 (orange), Mulish typeface
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Mulish:wght@300;400;600;700;800;900&display=swap');

:root {
    --cfc-blue:    #0D72BA;
    --cfc-purple:  #93278F;
    --cfc-green:   #49AB62;
    --cfc-orange:  #F17749;
    --cfc-dark:    #464646;
    --cfc-text:    #2d2d2d;
    --cfc-muted:   #777;
    --cfc-border:  #e0e0e0;
    --cfc-gray:    #f7f7f7;
    --cfc-lb:      #e8f4fc;
    --cfc-lp:      #f5eaf5;
    --cfc-lg:      #eaf6ee;
}

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

.cfc-portal-body {
    font-family: 'Mulish', sans-serif;
    background: #f0f2f7;
    color: var(--cfc-text);
    margin: 0;
    padding: 0;
}

/* ---- Portal shell ---- */
.cfc-portal { min-height: 100vh; display: flex; flex-direction: column; }

.cfc-portal-header {
    background: linear-gradient(135deg, var(--cfc-purple) 0%, var(--cfc-blue) 100%);
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 12px rgba(0,0,0,0.15);
}
.cfc-portal-header-inner {
    max-width: 960px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
    gap: 16px;
}

.cfc-portal-brand { display: flex; align-items: center; gap: 10px; }
.cfc-logo-mark {
    width: 36px;
    height: 36px;
    object-fit: contain;
    flex-shrink: 0;
}
/* Header logo */
.cfc-header-logomark {
    width: 40px;
    height: 40px;
    min-width: 40px;
    max-width: 40px;
    object-fit: contain;
    flex-shrink: 0;
    display: block;
}
/* Auth page logo */
.cfc-auth-logomark {
    width: 52px;
    height: 52px;
    min-width: 52px;
    max-width: 52px;
    object-fit: contain;
    flex-shrink: 0;
    display: block;
}
.cfc-logo-text {
    color: white;
    font-weight: 800;
    font-size: 14px;
    line-height: 1.2;
}
.cfc-logo-text span {
    display: block;
    font-weight: 400;
    font-size: 11px;
    opacity: 0.75;
}

.cfc-portal-user {
    display: flex;
    align-items: center;
    gap: 12px;
    color: rgba(255,255,255,0.85);
    font-size: 13px;
    font-weight: 600;
}

.cfc-back-link {
    color: rgba(255,255,255,0.85);
    text-decoration: none;
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
}
.cfc-back-link:hover { color: white; }

.cfc-portal-main {
    flex: 1;
    max-width: 960px;
    margin: 0 auto;
    width: 100%;
    padding: 32px 20px 60px;
}

/* ---- Alerts ---- */
.cfc-alert {
    padding: 14px 18px;
    border-radius: 8px;
    font-size: 14px;
    line-height: 1.5;
    margin-bottom: 20px;
}
.cfc-alert strong { display: block; margin-bottom: 3px; font-weight: 800; }
.cfc-alert-error   { background: #fdf0f0; border-left: 4px solid #e74c3c; color: #8c2218; }
.cfc-alert-success { background: var(--cfc-lg); border-left: 4px solid var(--cfc-green); color: #1a5c2a; }
.cfc-alert-warning { background: #fff8e6; border-left: 4px solid #f39c12; color: #7a5000; }

.cfc-pending-notice { margin-bottom: 24px; }

/* ---- Buttons ---- */
.cfc-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 22px;
    border-radius: 30px;
    font-family: 'Mulish', sans-serif;
    font-size: 14px;
    font-weight: 800;
    cursor: pointer;
    border: none;
    text-decoration: none;
    transition: transform 0.15s, box-shadow 0.15s, opacity 0.15s;
    letter-spacing: 0.02em;
    white-space: nowrap;
}
.cfc-btn:hover { transform: translateY(-1px); }
.cfc-btn:active { transform: translateY(0); }

.cfc-btn-primary {
    background: linear-gradient(135deg, var(--cfc-purple), var(--cfc-blue));
    color: white;
    box-shadow: 0 4px 14px rgba(13,114,186,0.3);
}
.cfc-btn-primary:hover { box-shadow: 0 6px 18px rgba(13,114,186,0.4); color: white; }

.cfc-btn-ghost {
    background: rgba(255,255,255,0.15);
    color: white;
    border: 1px solid rgba(255,255,255,0.3);
}
.cfc-btn-ghost:hover { background: rgba(255,255,255,0.25); color: white; }

.cfc-btn-cert {
    background: var(--cfc-green);
    color: white;
}

.cfc-btn-sm { padding: 6px 14px; font-size: 12px; }
.cfc-btn-full { width: 100%; }

/* ---- Dashboard ---- */
.cfc-dashboard-header { margin-bottom: 28px; }
.cfc-dashboard-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
}
.cfc-dashboard-header h1 { font-size: 26px; font-weight: 900; color: var(--cfc-dark); margin: 0; }
.cfc-pct-badge {
    font-size: 22px;
    font-weight: 900;
    color: var(--cfc-blue);
}
.cfc-progress-label {
    font-size: 13px;
    font-weight: 700;
    color: var(--cfc-muted);
    margin-bottom: 4px;
}
.cfc-progress-bar-track {
    height: 14px;
    background: var(--cfc-border);
    border-radius: 7px;
    overflow: hidden;
    margin-top: 10px;
}
.cfc-progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--cfc-purple), var(--cfc-blue), var(--cfc-green));
    border-radius: 7px;
    transition: width 0.6s ease;
}

/* ---- Module grid ---- */
.cfc-module-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

/* ---- Module cards — flex column with bottom-aligned actions ---- */
.cfc-module-card {
    background: white;
    border-radius: 14px;
    padding: 20px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
    border: 2px solid transparent;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: box-shadow 0.2s, border-color 0.2s, transform 0.15s;
}
.cfc-module-card:hover { box-shadow: 0 6px 24px rgba(0,0,0,0.1); transform: translateY(-2px); }
.cfc-module-card.cfc-module-passed { border-color: var(--cfc-green); }

.cfc-module-card-top { flex: 1; margin-bottom: 16px; }
.cfc-module-card-bottom { }

.cfc-module-number {
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--cfc-blue);
    margin-bottom: 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.cfc-module-title {
    font-size: 15px;
    font-weight: 800;
    color: var(--cfc-dark);
    line-height: 1.3;
    margin-bottom: 8px;
}
.cfc-module-desc {
    font-size: 12px;
    color: var(--cfc-muted);
    line-height: 1.55;
}
.cfc-module-meta-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--cfc-border);
}
.cfc-module-time {
    font-size: 11px;
    color: var(--cfc-muted);
    font-weight: 600;
}
.cfc-module-score {
    font-size: 11px;
    color: var(--cfc-muted);
    font-weight: 600;
}

.cfc-module-status {
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 3px 8px;
    border-radius: 20px;
}
.cfc-status-passed   { background: var(--cfc-lg); color: #1a5c2a; }
.cfc-status-failed   { background: #fdf0f0; color: #8c2218; }
.cfc-status-progress { background: var(--cfc-lb); color: #0a4f82; }
.cfc-status-available{ background: #fff8e6; color: #7a5000; }
.cfc-status-locked   { background: var(--cfc-gray); color: var(--cfc-muted); }

.cfc-module-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* Outline button for Review action */
.cfc-btn-outline {
    background: transparent;
    color: var(--cfc-blue);
    border: 2px solid var(--cfc-blue);
}
.cfc-btn-outline:hover { background: var(--cfc-lb); color: var(--cfc-blue); }

/* ---- Certificates section (bottom of dashboard) ---- */
.cfc-certs-section {
    margin-top: 48px;
    padding-top: 32px;
    border-top: 2px solid var(--cfc-border);
}
.cfc-certs-section-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 20px;
    gap: 12px;
}
.cfc-certs-section-title {
    font-size: 20px;
    font-weight: 900;
    color: var(--cfc-dark);
    margin: 0 0 4px 0;
}
.cfc-certs-section-sub {
    font-size: 13px;
    color: var(--cfc-muted);
    margin: 0;
}
.cfc-certs-count-badge {
    background: var(--cfc-green);
    color: white;
    font-size: 12px;
    font-weight: 800;
    padding: 4px 12px;
    border-radius: 20px;
    white-space: nowrap;
    flex-shrink: 0;
}
.cfc-certs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 14px;
}
.cfc-cert-card {
    background: white;
    border: 2px solid var(--cfc-border);
    border-radius: 12px;
    padding: 16px 18px;
    text-decoration: none;
    display: flex;
    flex-direction: column;
    gap: 12px;
    transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}
.cfc-cert-card:hover {
    border-color: var(--cfc-green);
    box-shadow: 0 4px 16px rgba(73,171,98,0.15);
    transform: translateY(-2px);
}
.cfc-cert-card-top {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}
.cfc-cert-card-icon {
    font-size: 24px;
    flex-shrink: 0;
    line-height: 1;
}
.cfc-cert-card-label {
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--cfc-green);
    margin-bottom: 4px;
}
.cfc-cert-card-title {
    font-size: 14px;
    font-weight: 800;
    color: var(--cfc-dark);
    line-height: 1.3;
}
.cfc-cert-card-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 10px;
    border-top: 1px solid var(--cfc-border);
}
.cfc-cert-card-date {
    font-size: 11px;
    color: var(--cfc-muted);
    font-weight: 600;
}
.cfc-cert-card-action {
    font-size: 11px;
    font-weight: 800;
    color: var(--cfc-blue);
}

/* ---- Completion banner ---- */
.cfc-completion-banner {
    background: linear-gradient(135deg, var(--cfc-purple), var(--cfc-blue));
    border-radius: 12px;
    padding: 40px;
    text-align: center;
    color: white;
    margin-top: 32px;
}
.cfc-completion-inner { max-width: 500px; margin: 0 auto; }
.cfc-completion-icon { font-size: 48px; margin-bottom: 12px; }
/* Force white over any theme heading/paragraph colors — the banner sits on a
   blue/purple gradient, so its text must stay white. */
.cfc-completion-banner,
.cfc-completion-banner h2,
.cfc-completion-banner p { color: #ffffff !important; }
.cfc-completion-banner h2 { font-size: 28px; font-weight: 900; margin-bottom: 10px; }
.cfc-completion-banner p  { font-size: 15px; opacity: 0.9; }

/* ---- Auth forms ---- */
.cfc-auth-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    background: linear-gradient(135deg, #f0f2f7 0%, var(--cfc-lb) 100%);
}
.cfc-auth-card {
    background: white;
    border-radius: 16px;
    padding: 40px;
    width: 100%;
    max-width: 440px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.1);
}
.cfc-auth-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 28px;
}
.cfc-auth-logo .cfc-logo-text { color: var(--cfc-dark); }
.cfc-auth-title { font-size: 24px; font-weight: 900; color: var(--cfc-dark); margin-bottom: 6px; }
.cfc-auth-sub   { font-size: 14px; color: var(--cfc-muted); margin-bottom: 24px; line-height: 1.5; }

.cfc-form-group { margin-bottom: 16px; }
.cfc-form-group label { display: block; font-size: 13px; font-weight: 700; color: var(--cfc-dark); margin-bottom: 6px; }
.cfc-form-group input, .cfc-form-group textarea {
    width: 100%;
    padding: 11px 14px;
    border: 2px solid var(--cfc-border);
    border-radius: 8px;
    font-family: 'Mulish', sans-serif;
    font-size: 14px;
    color: var(--cfc-text);
    transition: border-color 0.2s;
}
.cfc-form-group input:focus, .cfc-form-group textarea:focus {
    outline: none;
    border-color: var(--cfc-blue);
}
.cfc-form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.cfc-hint { font-weight: 400; color: var(--cfc-muted); font-size: 11px; }

.cfc-auth-footer { margin-top: 20px; text-align: center; font-size: 13px; color: var(--cfc-muted); }
.cfc-auth-footer a { color: var(--cfc-blue); font-weight: 700; text-decoration: none; }
.cfc-auth-footer p { margin-bottom: 6px; }

/* ---- Module view ---- */
.cfc-module-portal .cfc-portal-header { }
.cfc-module-review-banner {
    background: var(--cfc-lg);
    border-bottom: 1px solid #c3e6cb;
    padding: 12px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 13px;
    font-weight: 700;
    color: #1a5c2a;
}

/* ---- Quiz overlay ---- */
.cfc-quiz-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.6);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.cfc-quiz-result-card {
    background: white;
    border-radius: 16px;
    padding: 48px 40px;
    max-width: 480px;
    width: 100%;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.cfc-result-icon { font-size: 56px; margin-bottom: 16px; }
.cfc-quiz-result-card h2 { font-size: 26px; font-weight: 900; margin-bottom: 10px; }
.cfc-quiz-result-card p  { font-size: 15px; color: var(--cfc-muted); margin-bottom: 24px; line-height: 1.5; }
#cfc-result-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* ---- Placeholder ---- */
.cfc-placeholder { min-height: 60vh; display: flex; align-items: center; justify-content: center; }
.cfc-placeholder-inner { text-align: center; padding: 40px; }
.cfc-placeholder-icon { font-size: 48px; margin-bottom: 16px; }
.cfc-placeholder-inner h2 { font-size: 22px; font-weight: 800; margin-bottom: 10px; }
.cfc-placeholder-inner p  { color: var(--cfc-muted); }

/* ---- Error ---- */
.cfc-error { padding: 20px; background: #fdf0f0; border-radius: 8px; color: #8c2218; }

/* ---- Responsive ---- */
@media (max-width: 600px) {
    .cfc-module-grid { grid-template-columns: 1fr; }
    .cfc-form-row { grid-template-columns: 1fr; }
    .cfc-auth-card { padding: 28px 20px; }
    .cfc-portal-main { padding: 20px 14px 40px; }
    .cfc-dashboard-header h1 { font-size: 20px; }
}

/* ---- Category filter tabs ---- */
.cfc-filter-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 24px;
}
.cfc-filter-tab {
    padding: 7px 18px;
    border-radius: 30px;
    border: 2px solid var(--cfc-border);
    background: white;
    font-family: 'Mulish', sans-serif;
    font-size: 13px;
    font-weight: 700;
    color: var(--cfc-muted);
    cursor: pointer;
    transition: all 0.15s;
}
.cfc-filter-tab:hover {
    border-color: var(--cfc-blue);
    color: var(--cfc-blue);
}
.cfc-filter-tab.active {
    background: var(--cfc-blue);
    border-color: var(--cfc-blue);
    color: white;
}

/* ---- Category section headers ---- */
.cfc-category-section { margin-bottom: 36px; }
.cfc-category-section[style*="display: none"] { display: none !important; }

.cfc-category-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 16px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--cfc-border);
}
.cfc-category-title {
    font-size: 18px;
    font-weight: 900;
    color: var(--cfc-dark);
    margin: 0;
}
.cfc-category-count {
    font-size: 12px;
    font-weight: 700;
    color: var(--cfc-muted);
}
