/* ============================================================
   base.css — Global styles for Techfinder / IEQT
   Shared across all pages: reset, variables, header component,
   flash messages, footer component, shared utilities.
   ============================================================ */

/* ---------- Reset & box model ---------- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* ---------- CSS variables (IEQT Design System) ---------- */
:root {
    /* IEQT Brand Colors */
    --primary:      #377A8A;
    --primary-dark: #2A5F6D;
    --primary-light: #4A9BAD;
    --primary-bg:   #EBF4F6;

    /* Semantic colors */
    --success:      #38a169;
    --danger:       #e53e3e;
    --warning:      #d69e2e;
    --info:         #377A8A;

    /* Neutral palette */
    --bg:           #F4F7F8;
    --surface:      #ffffff;
    --text:         #1E2D32;
    --muted:        #5F7A82;
    --border:       #D0E2E6;
    --border-light: #E8F2F4;

    /* Layout */
    --radius:       8px;
    --radius-lg:    12px;
    --shadow:       0 2px 12px rgba(55, 122, 138, 0.10);
    --shadow-md:    0 4px 20px rgba(55, 122, 138, 0.13);
    --content-padding: 0 2rem;

    /* Typography */
    --font-body:    'Calibri', 'Segoe UI', system-ui, sans-serif;
    --font-heading: 'Calibri Light', 'Calibri', 'Segoe UI', system-ui, sans-serif;
}

/* ---------- Body — sticky footer via flexbox ---------- */
html { height: 100%; }

body {
    font-family: var(--font-body);
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    font-size: 15px;
    line-height: 1.55;
}

/* ---------- Main content ---------- */
main {
    flex: 1;
    width: 100%;
    padding: 2rem var(--content-padding);
}

/* ---------- Flash messages ---------- */
.flashes {
    width: 100%;
    padding: 1.5rem 2rem 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.flash {
    display: inline-block;
    width: auto;
    max-width: 680px;
    min-width: 280px;
    padding: 12px 24px;
    border-radius: 999px;
    font-size: 0.875rem;
    font-weight: 600;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.07);
}

@media (max-width: 600px) {
    .flash {
        max-width: 100%;
        border-radius: var(--radius);
    }
}

.flash.success { background: #f0fff4; color: var(--success); border: 1px solid #c6f6d5; }
.flash.danger  { background: #fff5f5; color: var(--danger);  border: 1px solid #fed7d7; }
.flash.warning { background: #fffff0; color: var(--warning); border: 1px solid #fefcbf; }
.flash.info    { background: var(--primary-bg); color: var(--primary-dark); border: 1px solid #B8D8DF; }

/* ============================================================
   HEADER COMPONENT — sticky, full viewport width
   ============================================================ */
.app-header {
    width: 100%;
    background: var(--surface);
    border-bottom: 2px solid var(--primary);
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
    flex-shrink: 0;
}

.header-inner {
    width: 100%;
    padding: 0 2rem;
    height: 68px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

/* Brand */
.header-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    flex-shrink: 0;
}

.header-logo-img {
    height: 38px;
    width: auto;
    display: block;
    object-fit: contain;
}

.header-brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
    border-left: 2px solid var(--border);
    padding-left: 0.75rem;
}

.header-title {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--primary-dark);
    letter-spacing: 0.01em;
}

.header-tagline {
    font-size: 0.68rem;
    color: var(--muted);
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

/* Navigation */
.header-nav {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.header-user {
    font-size: 0.85rem;
    color: var(--muted);
    padding: 6px 12px;
    background: var(--primary-bg);
    border-radius: var(--radius);
    white-space: nowrap;
    border: 1px solid var(--border);
}

.header-link {
    color: var(--muted);
    text-decoration: none;
    font-size: 0.875rem;
    padding: 7px 14px;
    border-radius: var(--radius);
    transition: background 0.2s, color 0.2s;
    white-space: nowrap;
    font-weight: 500;
}

.header-link:hover {
    background: var(--primary-bg);
    color: var(--primary-dark);
}

.header-link-primary {
    background: var(--primary);
    color: white !important;
    font-weight: 600;
}

.header-link-primary:hover {
    background: var(--primary-dark);
    color: white !important;
}

@media (max-width: 500px) {
    .header-tagline  { display: none; }
    .header-user     { display: none; }
    .header-inner    { padding: 0 1rem; }
    .header-logo-img { height: 30px; }
}

/* ============================================================
   FOOTER COMPONENT
   ============================================================ */
.app-footer {
    width: 100%;
    background: var(--primary-dark);
    border-top: none;
    padding: 2rem 0;
    flex-shrink: 0;
    margin-top: auto;
}

.footer-inner {
    width: 100%;
    padding: 0 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1.5rem;
}

.footer-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.footer-logo-img {
    height: 32px;
    width: auto;
    object-fit: contain;
    /* Invert to white on dark background */
    filter: brightness(0) invert(1);
    opacity: 0.9;
}

.footer-title {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 0.95rem;
    color: #ffffff;
}

.footer-tagline {
    font-size: 0.72rem;
    color: rgba(255, 255, 255, 0.65);
    margin-top: 2px;
}

.footer-links {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.footer-links a {
    color: rgba(255, 255, 255, 0.75);
    text-decoration: none;
    font-size: 0.82rem;
    transition: color 0.2s;
}

.footer-links a:hover { color: #ffffff; }

.footer-separator {
    color: rgba(255, 255, 255, 0.35);
    font-size: 0.8rem;
}

.footer-meta {
    text-align: right;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.65);
    line-height: 1.6;
}

.footer-version { font-weight: 600; color: rgba(255, 255, 255, 0.9); }
.footer-part-of { font-style: italic; }
.footer-copyright { color: rgba(255, 255, 255, 0.65); }

@media (max-width: 600px) {
    .footer-inner  { flex-direction: column; text-align: center; padding: 0 1rem; }
    .footer-meta   { text-align: center; }
    .footer-brand  { justify-content: center; }
    .footer-links  { justify-content: center; }
}

/* ============================================================
   SHARED UTILITIES
   ============================================================ */

/* Card */
.card {
    background: white;
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}

.card h2 {
    font-family: var(--font-heading);
    font-size: 1rem;
    color: var(--primary-dark);
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--primary-bg);
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Skill tags */
.tag {
    display: inline-block;
    padding: 4px 11px;
    border-radius: 6px;
    font-size: 0.78rem;
    font-weight: 600;
    margin: 3px 3px 3px 0;
}

.tag-skill { background: var(--primary-bg); color: var(--primary-dark); }
.tag-soft  { background: #EDF6F8; color: var(--primary); }

/* Back link — shared by the results, history and candidate pages */
.back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--primary);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    margin-top: 1rem;
    transition: color 0.2s, opacity 0.2s;
}

.back-link:hover { color: var(--primary-dark); opacity: 0.85; }

/* Profile type badges — shared by the results, history and candidate pages */
.profile-badge {
    display: inline-block;
    padding: 0.15rem 0.55rem;
    border-radius: 0.75rem;
    font-size: 0.72rem;
    font-weight: 700;
    white-space: nowrap;
}
.badge-postbac { background: #fef9c3; color: #92400e; }
.badge-bac23   { background: #dcfce7; color: #15803d; }

/* Score badge */
.score-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-weight: 700;
    font-size: 0.85rem;
}

.score-excellent { background: #f3f9e8; color: #3a6000; }
.score-good      { background: #e8fdf0; color: #065f2c; }
.score-partial   { background: #fff7ed; color: #9a3412; }
.score-low       { background: #fff5f5; color: #822727; }

/* Header role badge */
.header-role-badge {
    display: inline-block;
    margin-left: 6px;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    vertical-align: middle;
}
.header-role-badge--admin { background: var(--primary-bg); color: var(--primary-dark); }
.header-role-badge--user  { background: #f0fff4; color: #276749; }
.header-link-admin { color: var(--primary); font-weight: 700; }