:root {
    /* IT Training Recommender — crafted by Omid Zaeri (zaerio@) */
    --amzn-orange: #ff9900;
    --amzn-dark: #232f3e;
    --amzn-darker: #191e27;
    --amzn-light: #f5f6f8;
    --amzn-blue: #007eb9;
    --amzn-green: #067d62;
    --amzn-green-light: #e6f4f0;
    --border: #dde0e4;
    --text-primary: #0f1111;
    --text-secondary: #565959;
    --text-muted: #8d9096;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-lg: 0 4px 16px rgba(0,0,0,0.1);
}

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

body {
    font-family: "Amazon Ember", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--amzn-light);
    color: var(--text-primary);
    line-height: 1.6;
}

/* ===== HEADER ===== */
header { background: var(--amzn-dark); color: #fff; padding: 0.75rem 2rem; }

.header-content {
    max-width: 1100px; margin: 0 auto;
    display: flex; justify-content: space-between; align-items: center; gap: 1.5rem;
}

.header-left { display: flex; align-items: center; gap: 0.6rem; }
.logo-icon { opacity: 0.8; }
header h1 { font-size: 1.15rem; font-weight: 500; letter-spacing: -0.01em; }

.header-nav { display: flex; gap: 0.25rem; }
.tab-btn {
    background: transparent; color: rgba(255,255,255,0.6); border: none;
    padding: 0.4rem 1rem; border-radius: 6px; font-size: 0.82rem;
    cursor: pointer; font-weight: 500; font-family: inherit; transition: all 0.15s;
}
.tab-btn.active { background: rgba(255,255,255,0.12); color: #fff; }
.tab-btn:hover:not(.active) { color: #fff; background: rgba(255,255,255,0.06); }

.user-info { font-size: 0.85rem; opacity: 0.85; display: flex; align-items: center; gap: 0.5rem; }
.user-photo {
    width: 28px; height: 28px; border-radius: 50%; object-fit: cover;
    border: 1.5px solid rgba(255,255,255,0.35); display: none;
}

main { max-width: 1100px; margin: 2rem auto; padding: 0 2rem; }

/* ===== TOP BAR (View As) ===== */
.top-bar {
    display: flex; justify-content: space-between; align-items: center;
    background: #1a1a2e; color: #fff; padding: 8px 20px;
}
.top-bar-left { display: flex; align-items: center; gap: 12px; }
.top-bar-right { display: flex; align-items: center; gap: 10px; }
.view-as-badge {
    background: #ff9800; color: #000; padding: 4px 10px; border: none;
    border-radius: 4px; font-size: 0.75rem; font-weight: 700;
    cursor: pointer; transition: background 0.15s; font-family: inherit;
}
.view-as-badge:hover { background: #e68900; }

/* Search-style view-as */
.search-as-container { position: relative; }
.view-as-search {
    background: rgba(255,255,255,0.1); color: #fff;
    border: 1px solid rgba(255,255,255,0.25); padding: 6px 12px 6px 8px;
    border-radius: 6px; font-size: 0.82rem; width: 280px;
    font-family: inherit; outline: none;
}
.view-as-search::placeholder { color: rgba(255,255,255,0.5); }
.view-as-search:focus { border-color: var(--amzn-orange); background: rgba(255,255,255,0.15); }
.view-as-dropdown {
    position: absolute; top: 100%; left: 0; width: 100%;
    background: #1a1a2e; border: 1px solid rgba(255,255,255,0.2);
    border-radius: 0 0 6px 6px; max-height: 240px; overflow-y: auto; z-index: 100;
}
.view-as-option {
    padding: 6px 12px; cursor: pointer; font-size: 0.82rem; color: #fff;
    display: flex; justify-content: space-between; align-items: center;
}
.view-as-option:hover { background: rgba(255,255,255,0.1); }
.view-as-option .vas-name { opacity: 0.6; font-size: 0.75rem; }

/* Tiger Team */
.tiger-section {
    background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
    box-shadow: var(--shadow); margin-bottom: 1.5rem; overflow: hidden;
}
.tiger-header {
    padding: 0.85rem 1.15rem; font-weight: 600; font-size: 0.9rem;
    cursor: pointer; display: flex; justify-content: space-between; align-items: center;
    user-select: none; color: var(--text-secondary);
}
.tiger-header:hover { background: var(--amzn-light); }
.tiger-arrow { transition: transform 0.2s; }
.tiger-header.open .tiger-arrow { transform: rotate(90deg); }
.tiger-body { padding: 1.15rem; }
.tiger-unlock { display: flex; gap: 0.5rem; align-items: center; }
.tiger-code-input {
    flex: 1; padding: 0.5rem 0.75rem; border: 1px solid var(--border);
    border-radius: 6px; font-size: 0.88rem; font-family: inherit;
}
.tiger-info { margin-bottom: 0.5rem; }
.tiger-team-name { font-weight: 700; font-size: 1rem; display: block; }
.tiger-team-desc { font-size: 0.85rem; color: var(--text-secondary); }

/* Site type chips */
.site-type-chips { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.site-chip {
    padding: 0.4rem 0.85rem; border: 2px solid var(--border); border-radius: 20px;
    font-size: 0.82rem; cursor: pointer; font-family: inherit; background: #fff;
    transition: all 0.15s; user-select: none; font-weight: 500;
}
.site-chip:hover { border-color: var(--amzn-blue); }
.site-chip.selected { border-color: var(--amzn-blue); background: #eef7fc; color: var(--amzn-blue); }

/* ===== TEAM DASHBOARD ===== */
.team-dashboard {
    background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 2rem;
}
.team-header { margin-bottom: 1.5rem; }
.team-header h2 { font-size: 1.3rem; font-weight: 600; }

.team-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1rem; }

.team-card {
    background: var(--amzn-light); border: 1px solid var(--border);
    border-radius: var(--radius-sm); padding: 1rem; display: flex; gap: 0.75rem;
    align-items: center; transition: box-shadow 0.15s;
}
.team-card:hover { box-shadow: var(--shadow-lg); }

.team-card-photo {
    width: 40px; height: 40px; border-radius: 50%; object-fit: cover;
    border: 2px solid var(--border); flex-shrink: 0;
}

.team-card-info { flex: 1; min-width: 0; }
.team-card-alias { font-weight: 600; font-size: 0.9rem; }
.team-card-role { font-size: 0.78rem; color: var(--text-muted); margin-top: 0.1rem; }

.team-card-progress { flex-shrink: 0; text-align: center; }
.team-card-pct { font-size: 1.2rem; font-weight: 700; line-height: 1; }
.team-card-pct.green { color: var(--amzn-green); }
.team-card-pct.orange { color: #ff9900; }
.team-card-pct.red { color: #c40000; }
.team-card-sub { font-size: 0.65rem; color: var(--text-muted); text-transform: uppercase; }

.team-card-none { font-size: 0.8rem; color: var(--text-muted); font-style: italic; }

/* ===== WIZARD ===== */
.wizard {
    background: #fff; border-radius: var(--radius); box-shadow: var(--shadow);
    padding: 2.5rem; text-align: center;
}

.wizard-hero { margin-bottom: 2rem; }
.wizard-hero.compact { margin-bottom: 1.5rem; }
.wizard-icon { font-size: 2.5rem; margin-bottom: 0.75rem; }
.wizard-hero h2 { font-size: 1.5rem; font-weight: 600; margin-bottom: 0.4rem; }
.wizard-desc { color: var(--text-secondary); font-size: 0.95rem; max-width: 480px; margin: 0 auto; }

.wizard-steps { text-align: left; max-width: 600px; margin: 0 auto; }

.step { display: none; animation: fadeSlideIn 0.3s ease; }
.step.active { display: block; }

@keyframes fadeSlideIn {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

.step-indicator { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.75rem; }
.step-num {
    width: 28px; height: 28px; border-radius: 50%; background: var(--amzn-orange);
    color: var(--amzn-dark); font-weight: 700; font-size: 0.8rem;
    display: flex; align-items: center; justify-content: center;
}
.step-content h3 { font-size: 1.05rem; font-weight: 600; margin-bottom: 1rem; }

/* Scenario cards */
.scenario-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.scenario-card {
    background: #fff; border: 2px solid var(--border); border-radius: var(--radius);
    padding: 1.5rem 1rem; cursor: pointer; text-align: center;
    display: flex; flex-direction: column; align-items: center; gap: 0.4rem;
    transition: all 0.2s; font-family: inherit;
}
.scenario-card:hover { border-color: var(--amzn-orange); box-shadow: var(--shadow); }
.scenario-card.selected { border-color: var(--amzn-orange); background: #fff8ee; }
.card-icon { font-size: 2rem; }
.card-title { font-weight: 600; font-size: 0.95rem; }
.card-desc { font-size: 0.8rem; color: var(--text-secondary); }

/* Role cards */
.role-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
.role-card {
    background: #fff; border: 2px solid var(--border); border-radius: var(--radius-sm);
    padding: 1rem; cursor: pointer; text-align: left; transition: all 0.2s; font-family: inherit;
}
.role-card:hover { border-color: var(--amzn-blue); box-shadow: var(--shadow); }
.role-card.selected { border-color: var(--amzn-blue); background: #eef7fc; }
.role-card .role-level { font-size: 0.7rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; font-weight: 600; }
.role-card .role-name { font-weight: 600; font-size: 0.9rem; margin-top: 0.15rem; }

.promo-from { margin-top: 1rem; font-size: 0.85rem; color: var(--text-secondary); }
.promo-label { font-weight: 500; }
.promo-role { color: var(--amzn-blue); font-weight: 600; }

.wizard-actions {
    display: flex; justify-content: space-between; align-items: center;
    max-width: 600px; margin: 2rem auto 0; gap: 1rem;
}

/* ===== BUTTONS ===== */
.btn-primary {
    padding: 0.65rem 1.75rem; background: var(--amzn-orange); color: var(--amzn-dark);
    border: none; border-radius: var(--radius-sm); font-size: 0.95rem; font-weight: 600;
    cursor: pointer; font-family: inherit; transition: filter 0.15s;
}
.btn-primary:hover:not(:disabled) { filter: brightness(1.05); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-ghost {
    padding: 0.55rem 1rem; background: transparent; color: var(--text-secondary);
    border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 0.9rem;
    cursor: pointer; font-family: inherit; transition: all 0.15s;
}
.btn-ghost:hover { background: var(--amzn-light); color: var(--text-primary); }

.btn-secondary {
    padding: 0.45rem 0.9rem; background: #fff; border: 1px solid var(--border);
    border-radius: 6px; color: var(--text-primary); font-size: 0.82rem;
    cursor: pointer; font-family: inherit; font-weight: 500;
}
.btn-secondary:hover { background: var(--amzn-light); }

.btn-link {
    background: none; border: none; color: var(--text-muted); font-size: 0.8rem;
    padding: 0; cursor: pointer; font-family: inherit;
}
.btn-link:hover { color: var(--amzn-blue); text-decoration: underline; }

.btn-assign {
    padding: 0.55rem 1.2rem; background: var(--amzn-green); color: #fff;
    border: none; border-radius: var(--radius-sm); font-size: 0.9rem;
    font-weight: 600; cursor: pointer; font-family: inherit;
}
.btn-assign:hover { filter: brightness(1.08); }

.btn-back { margin-bottom: 1.25rem; }

button { font-family: inherit; }

/* ===== RESULTS HERO + RING ===== */
.results-panel { margin-top: 0; }

.results-hero {
    background: #fff; border-radius: var(--radius); box-shadow: var(--shadow);
    padding: 2rem; display: flex; align-items: center; gap: 2.5rem;
    margin-bottom: 1.5rem;
}

.ring-container { position: relative; width: 120px; height: 120px; flex-shrink: 0; }
.progress-ring { width: 120px; height: 120px; transform: rotate(-90deg); }
.ring-bg { fill: none; stroke: #eef0f2; stroke-width: 8; }
.ring-fg {
    fill: none; stroke: var(--amzn-green); stroke-width: 8;
    stroke-linecap: round; transition: stroke-dashoffset 0.6s ease;
}
.ring-label {
    position: absolute; inset: 0; display: flex; flex-direction: column;
    align-items: center; justify-content: center;
}
.ring-pct { font-size: 1.6rem; font-weight: 700; color: var(--amzn-green); line-height: 1; }
.ring-sub { font-size: 0.7rem; color: var(--text-muted); margin-top: 2px; }

.results-info { flex: 1; }
.results-info h2 { font-size: 1.15rem; font-weight: 600; margin-bottom: 0.2rem; }

.results-stats { display: flex; gap: 1.5rem; margin: 1rem 0; }
.stat { display: flex; flex-direction: column; }
.stat-num { font-size: 1.4rem; font-weight: 700; line-height: 1.1; }
.stat-label { font-size: 0.7rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; font-weight: 600; }

.results-actions { display: flex; gap: 0.5rem; align-items: center; }
.results-header { display: flex; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; gap: 1rem; margin-bottom: 1rem; }

/* ===== CATEGORIES ===== */
.category {
    background: #fff; border: 1px solid var(--border); border-radius: var(--radius-sm);
    margin-bottom: 0.75rem; overflow: hidden; box-shadow: var(--shadow);
}
.category-header {
    padding: 0.85rem 1.15rem; font-weight: 600; font-size: 0.9rem;
    cursor: pointer; display: flex; justify-content: space-between; align-items: center;
    user-select: none; transition: background 0.1s;
}
.category-header:hover { background: var(--amzn-light); }
.category-header .badge {
    background: var(--amzn-dark); color: #fff; font-size: 0.7rem;
    padding: 0.15rem 0.55rem; border-radius: 10px; font-weight: 500;
}
.category-body { padding: 0 1.15rem 0.85rem; }

.training-item {
    display: flex; justify-content: space-between; align-items: center;
    padding: 0.55rem 0; border-bottom: 1px solid #f0f1f3; gap: 0.75rem;
}
.training-item:last-child { border-bottom: none; }

.training-left { display: flex; align-items: center; gap: 0.6rem; flex: 1; min-width: 0; }
.training-check {
    width: 18px; height: 18px; cursor: pointer; flex-shrink: 0;
    accent-color: var(--amzn-green);
}
.training-name { font-size: 0.88rem; }
.training-name.completed { text-decoration: line-through; color: var(--text-muted); }
.training-duration { font-size: 0.72rem; color: var(--text-muted); white-space: nowrap; }

.training-meta { display: flex; gap: 0.6rem; align-items: center; flex-shrink: 0; }
.priority { font-size: 0.7rem; padding: 0.12rem 0.45rem; border-radius: 4px; font-weight: 600; }
.priority.required { background: #fce4e4; color: #c40000; }
.priority.recommended { background: #fff3cd; color: #856404; }
.priority.optional { background: #e8f5e9; color: #2e7d32; }

.embark-link {
    color: var(--amzn-blue); text-decoration: none; font-size: 0.8rem;
    font-weight: 500; white-space: nowrap;
}
.embark-link:hover { text-decoration: underline; }
.embark-link.tbu { color: var(--text-muted); cursor: default; font-style: italic; }

/* ===== SELECTOR PANEL (manager view) ===== */
.selector-panel {
    background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
    padding: 1.5rem; display: flex; gap: 1rem; align-items: flex-end;
    flex-wrap: wrap; box-shadow: var(--shadow); margin-bottom: 1.5rem;
}
.form-group { display: flex; flex-direction: column; gap: 0.35rem; flex: 1; min-width: 170px; }
.form-group label { font-size: 0.78rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.03em; }

select, input[type="text"] {
    padding: 0.55rem 0.75rem; border: 1px solid var(--border); border-radius: 6px;
    font-size: 0.92rem; background: #fff; font-family: inherit; transition: border-color 0.15s;
}
select:focus, input[type="text"]:focus { outline: none; border-color: var(--amzn-blue); }
select:disabled, input:disabled { background: var(--amzn-light); cursor: not-allowed; }

/* ===== PROGRESS BAR (manager view) ===== */
.progress-section {
    background: #fff; border: 1px solid var(--border); border-radius: var(--radius-sm);
    padding: 1rem 1.15rem; margin-bottom: 1.25rem;
}
.progress-stats { display: flex; justify-content: space-between; font-size: 0.82rem; margin-bottom: 0.4rem; color: var(--text-secondary); }
.progress-bar { height: 6px; background: #eef0f2; border-radius: 3px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--amzn-green); border-radius: 3px; transition: width 0.4s ease; width: 0%; }

/* ===== MANAGER REGISTRATION ===== */
.mgr-reg-form {
    display: flex; gap: 0.75rem; max-width: 500px; margin: 1.5rem auto 0;
}
.mgr-reg-form input { flex: 1; }
.error-msg { color: #c40000; font-size: 0.85rem; margin-top: 1rem; }

.hidden { display: none !important; }

footer { text-align: center; padding: 2.5rem 2rem; color: var(--text-muted); font-size: 0.82rem; }
footer a { color: var(--amzn-blue); }

/* ===== PRINT ===== */
@media print {
    header, .wizard, .selector-panel, .results-actions, .btn-link,
    .training-check, footer, .header-nav, .btn-back, .btn-ghost { display: none !important; }
    body { background: #fff; }
    main { margin: 0; padding: 0; }
    .results-panel { margin-top: 0; }
    .category { break-inside: avoid; box-shadow: none; }
    .results-hero { box-shadow: none; border: 1px solid #ddd; }
}

@media (max-width: 768px) {
    .header-content { flex-wrap: wrap; }
    .scenario-cards, .role-cards { grid-template-columns: 1fr; }
    .results-hero { flex-direction: column; text-align: center; }
    .results-stats { justify-content: center; }
    .selector-panel { flex-direction: column; }
    .form-group { min-width: 100%; }
    .training-item { flex-direction: column; align-items: flex-start; gap: 0.4rem; }
    .mgr-reg-form { flex-direction: column; }
}

/* ===== AI CHAT WIDGET ===== */
.chat-toggle {
    position: fixed; bottom: 1.5rem; right: 1.5rem; z-index: 9999;
    width: 56px; height: 56px; border-radius: 50%; border: none;
    background: var(--amzn-dark); color: #fff; cursor: pointer;
    box-shadow: 0 4px 16px rgba(0,0,0,0.25); display: flex;
    align-items: center; justify-content: center; transition: transform 0.2s, background 0.2s;
    text-decoration: none;
}
.chat-toggle:hover { transform: scale(1.08); background: #2d3a4e; }

.chat-panel {
    position: fixed; bottom: 5.5rem; right: 1.5rem; z-index: 9998;
    width: 400px; height: 550px;
    background: #fff; border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
    display: flex; flex-direction: column; overflow: hidden;
    animation: chatSlideIn 0.25s ease;
}
.chat-panel.hidden { display: none; }

@keyframes chatSlideIn {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

.chat-header {
    background: var(--amzn-dark); color: #fff;
    padding: 0.7rem 1rem; font-size: 0.9rem; font-weight: 600;
    display: flex; justify-content: space-between; align-items: center; flex-shrink: 0;
}
.chat-close {
    background: none; border: none; color: #fff; font-size: 1.4rem;
    cursor: pointer; line-height: 1; opacity: 0.7;
}
.chat-close:hover { opacity: 1; }

.chat-messages {
    flex: 1; overflow-y: auto; padding: 1rem;
    display: flex; flex-direction: column; gap: 0.6rem;
}
.chat-msg {
    max-width: 85%; padding: 0.6rem 0.85rem; border-radius: 10px;
    font-size: 0.85rem; line-height: 1.5; word-wrap: break-word;
}
.chat-msg.user {
    align-self: flex-end; background: var(--amzn-dark); color: #fff;
    border-bottom-right-radius: 3px;
}
.chat-msg.bot, .chat-msg.assistant {
    align-self: flex-start; background: #f0f1f3; color: var(--text-primary);
    border-bottom-left-radius: 3px;
}
.chat-msg.thinking { color: var(--text-muted); font-style: italic; }

.chat-input-row {
    display: flex; gap: 0.5rem; padding: 0.75rem; border-top: 1px solid var(--border); flex-shrink: 0;
}
.chat-input {
    flex: 1; padding: 0.55rem 0.75rem; border: 1px solid var(--border);
    border-radius: 8px; font-size: 0.88rem; font-family: inherit; outline: none;
}
.chat-input:focus { border-color: var(--amzn-blue); }
.chat-send {
    width: 38px; height: 38px; border: none; border-radius: 8px;
    background: var(--amzn-orange); color: var(--amzn-dark); font-size: 1.1rem;
    font-weight: 700; cursor: pointer; font-family: inherit;
}
.chat-send:hover { filter: brightness(1.05); }

@media (max-width: 520px) {
    .chat-panel { width: calc(100vw - 2rem); right: 1rem; height: 70vh; }
}
@media print { .chat-toggle, .chat-panel { display: none !important; } }

/* ===== MODAL ===== */
.modal-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 10000;
    display: flex; align-items: center; justify-content: center;
}
.modal {
    background: #fff; border-radius: 12px; width: 500px; max-height: 80vh;
    box-shadow: 0 8px 32px rgba(0,0,0,0.25); display: flex; flex-direction: column;
}
.modal-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 1rem 1.25rem; border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-size: 1rem; font-weight: 600; }
.modal-body { padding: 1rem 1.25rem; overflow-y: auto; }
.modal-search {
    width: 100%; padding: 0.5rem 0.75rem; border: 1px solid var(--border);
    border-radius: 6px; font-size: 0.9rem; font-family: inherit; margin-bottom: 0.75rem;
}
.modal-section-label { font-size: 0.78rem; font-weight: 600; color: var(--text-muted); margin-bottom: 0.35rem; }
.modal-category {
    width: 100%; padding: 0.45rem 0.75rem; border: 1px solid var(--border);
    border-radius: 6px; font-size: 0.88rem; font-family: inherit; margin-bottom: 0.75rem;
}
.modal-results { max-height: 300px; overflow-y: auto; }
.modal-item {
    display: flex; justify-content: space-between; align-items: center;
    padding: 0.5rem 0; border-bottom: 1px solid #f0f1f3; gap: 0.5rem;
}
.modal-item:last-child { border-bottom: none; }
.modal-item-name { font-size: 0.88rem; flex: 1; }
.modal-item-add {
    background: var(--amzn-green); color: #fff; border: none; border-radius: 4px;
    padding: 0.25rem 0.6rem; font-size: 0.75rem; font-weight: 600; cursor: pointer; font-family: inherit;
}
.modal-item-add:hover { filter: brightness(1.1); }
.modal-item-add:disabled { opacity: 0.4; cursor: default; }

/* Edit mode remove button */
.training-remove {
    background: none; border: none; color: #c40000; font-size: 1.1rem;
    cursor: pointer; padding: 0 0.3rem; line-height: 1; font-weight: 700;
    opacity: 0.6; transition: opacity 0.15s;
}
.training-remove:hover { opacity: 1; }
