/* ============================================================================
   NIS-2 COMPLIANCE TOOL - Stylesheet
   Branding: Navy #1B2A4A, Gold #C9A84C
   Strategie Manufaktur Unternehmensberatung e.U.
   ============================================================================ */

:root {
  --navy: #1B2A4A;
  --navy-light: #2A3F6A;
  --navy-dark: #111D33;
  --gold: #C9A84C;
  --gold-light: #D4BC72;
  --red: #C0392B;
  --orange: #E67E22;
  --yellow: #F39C12;
  --green: #27AE60;
  --grey: #95A5A6;
  --grey-light: #ECF0F1;
  --grey-dark: #7F8C8D;
  --white: #FFFFFF;
  --bg: #F8F9FA;
  --text: #333333;
  --text-light: #666666;
  --shadow: 0 2px 8px rgba(27,42,74,0.1);
  --shadow-lg: 0 4px 20px rgba(27,42,74,0.15);
  --radius: 8px;
  --radius-sm: 4px;
  --transition: 0.2s ease;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
  background: var(--bg); color: var(--text);
  line-height: 1.6; min-height: 100vh;
}

/* === LAYOUT === */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: 260px; background: var(--navy); color: var(--white);
  padding: 24px 0; position: fixed; top: 0; left: 0; height: 100vh;
  display: flex; flex-direction: column; z-index: 100;
}
.sidebar-brand { padding: 0 20px 24px; border-bottom: 1px solid rgba(255,255,255,0.1); }
.sidebar-brand h2 { font-size: 15px; color: var(--gold); letter-spacing: 1px; }
.sidebar-brand small { font-size: 11px; color: rgba(255,255,255,0.5); }
.sidebar-nav { flex: 1; padding: 16px 0; }
.sidebar-nav a {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 20px; color: rgba(255,255,255,0.7);
  text-decoration: none; font-size: 14px; transition: var(--transition);
}
.sidebar-nav a:hover, .sidebar-nav a.active {
  background: rgba(255,255,255,0.1); color: var(--white);
}
.sidebar-nav a.active { border-left: 3px solid var(--gold); }
.sidebar-footer { padding: 16px 20px; border-top: 1px solid rgba(255,255,255,0.1); font-size: 12px; color: rgba(255,255,255,0.4); }
.main { flex: 1; margin-left: 260px; padding: 32px; }

/* === LOGIN PAGE === */
.login-wrapper {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; background: linear-gradient(135deg, var(--navy) 0%, var(--navy-light) 100%);
}
.login-card {
  background: var(--white); border-radius: var(--radius); padding: 48px;
  width: 420px; max-width: 90vw; box-shadow: var(--shadow-lg);
}
.login-card h1 { color: var(--navy); font-size: 24px; margin-bottom: 8px; }
.login-card .subtitle { color: var(--text-light); margin-bottom: 32px; font-size: 14px; }

/* === FORMS === */
.form-group { margin-bottom: 20px; }
.form-group label { display: block; font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.form-group input, .form-group select, .form-group textarea {
  width: 100%; padding: 10px 14px; border: 1px solid #D5D8DC;
  border-radius: var(--radius-sm); font-size: 14px; transition: var(--transition);
  background: var(--white);
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(201,168,76,0.15);
}
.form-group textarea { resize: vertical; min-height: 80px; }

/* === BUTTONS === */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 20px; border: none; border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 600; cursor: pointer; transition: var(--transition);
  text-decoration: none; line-height: 1.4;
}
.btn-primary { background: var(--gold); color: var(--navy); }
.btn-primary:hover { background: var(--gold-light); }
.btn-navy { background: var(--navy); color: var(--white); }
.btn-navy:hover { background: var(--navy-light); }
.btn-outline { background: transparent; border: 1px solid var(--navy); color: var(--navy); }
.btn-outline:hover { background: var(--navy); color: var(--white); }
.btn-danger { background: var(--red); color: var(--white); }
.btn-sm { padding: 6px 14px; font-size: 12px; }
.btn-lg { padding: 14px 28px; font-size: 16px; width: 100%; justify-content: center; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* === CARDS === */
.card {
  background: var(--white); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 24px; margin-bottom: 20px;
}
.card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.card-header h2 { font-size: 18px; color: var(--navy); }
.card-header h3 { font-size: 16px; color: var(--navy); }

/* === PAGE HEADER === */
.page-header { margin-bottom: 28px; }
.page-header h1 { font-size: 26px; color: var(--navy); margin-bottom: 4px; }
.page-header p { color: var(--text-light); font-size: 14px; }

/* === SCORE === */
.score-display { text-align: center; padding: 32px; }
.score-number { font-size: 64px; font-weight: 800; line-height: 1; }
.score-label { font-size: 16px; color: var(--text-light); margin-top: 8px; }
.risk-badge {
  display: inline-block; padding: 6px 16px; border-radius: 20px;
  font-size: 13px; font-weight: 700; color: var(--white); margin-top: 12px;
}
.risk-Kritisch { background: var(--red); }
.risk-Hoch { background: var(--orange); }
.risk-Mittel { background: var(--yellow); color: var(--navy); }
.risk-Niedrig { background: var(--green); }

/* === TRAFFIC LIGHTS === */
.status-dot {
  display: inline-block; width: 14px; height: 14px; border-radius: 50%;
  margin-right: 8px; vertical-align: middle;
}
.status-green { background: var(--green); }
.status-yellow { background: var(--yellow); }
.status-orange { background: var(--orange); }
.status-red { background: var(--red); }
.status-grey { background: var(--grey); }

/* === PROGRESS BAR === */
.progress-bar { height: 8px; background: var(--grey-light); border-radius: 4px; overflow: hidden; margin: 8px 0; }
.progress-fill { height: 100%; background: var(--gold); border-radius: 4px; transition: width 0.4s ease; }

/* === ASSESSMENT FORM === */
.control-card {
  background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 24px; margin-bottom: 16px; border-left: 4px solid var(--grey);
  transition: var(--transition);
}
.control-card.answered { border-left-color: var(--green); }
.control-card.partial { border-left-color: var(--yellow); }
.control-card.negative { border-left-color: var(--red); }
.control-card .control-id { font-size: 12px; font-weight: 700; color: var(--gold); text-transform: uppercase; }
.control-card h3 { font-size: 16px; color: var(--navy); margin: 6px 0 12px; }
.control-card .question { font-size: 14px; color: var(--text); margin-bottom: 16px; line-height: 1.5; }
.control-card .meta { font-size: 12px; color: var(--text-light); margin-top: 12px; }

.answer-options { display: flex; gap: 8px; flex-wrap: wrap; }
.answer-option {
  padding: 8px 16px; border: 2px solid #D5D8DC; border-radius: var(--radius-sm);
  background: var(--white); cursor: pointer; font-size: 13px; font-weight: 600;
  transition: var(--transition); user-select: none;
}
.answer-option:hover { border-color: var(--navy); }
.answer-option.selected-ja { border-color: var(--green); background: rgba(39,174,96,0.08); color: var(--green); }
.answer-option.selected-teilweise { border-color: var(--yellow); background: rgba(243,156,18,0.08); color: #D4A017; }
.answer-option.selected-nein { border-color: var(--red); background: rgba(192,57,43,0.08); color: var(--red); }
.answer-option.selected-na { border-color: var(--grey); background: rgba(149,165,166,0.08); color: var(--grey-dark); }

/* === TABLE === */
.table-wrapper { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { background: var(--navy); color: var(--white); padding: 12px 16px; text-align: left; font-size: 13px; font-weight: 600; }
td { padding: 12px 16px; border-bottom: 1px solid var(--grey-light); font-size: 13px; }
tr:hover td { background: rgba(201,168,76,0.04); }

/* === ALERTS === */
.alert { padding: 14px 18px; border-radius: var(--radius-sm); margin-bottom: 16px; font-size: 14px; }
.alert-error { background: #FDEDEC; border-left: 4px solid var(--red); color: var(--red); }
.alert-success { background: #EAFAF1; border-left: 4px solid var(--green); color: #1E8449; }
.alert-info { background: #EBF5FB; border-left: 4px solid #3498DB; color: #2471A3; }

/* === STATS ROW === */
.stats-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; text-align: center; }
.stat-card .stat-value { font-size: 32px; font-weight: 800; color: var(--navy); }
.stat-card .stat-label { font-size: 12px; color: var(--text-light); margin-top: 4px; }

/* === LOADING === */
.spinner { width: 36px; height: 36px; border: 3px solid var(--grey-light); border-top-color: var(--gold); border-radius: 50%; animation: spin 0.8s linear infinite; margin: 20px auto; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading-overlay { position: fixed; inset: 0; background: rgba(255,255,255,0.85); display: flex; align-items: center; justify-content: center; z-index: 1000; }

/* === RESPONSIVE === */
@media (max-width: 768px) {
  .sidebar { display: none; }
  .main { margin-left: 0; padding: 16px; }
  .stats-row { grid-template-columns: 1fr 1fr; }
  .login-card { padding: 32px 24px; }
  .answer-options { flex-direction: column; }
}

/* === PRINT === */
@media print {
  .sidebar, .btn, .no-print { display: none !important; }
  .main { margin-left: 0; }
  .card { box-shadow: none; border: 1px solid #ddd; }
}
/* === Engagement-TopBar (ADMIN-2 v2.1c) === */
#engagement-topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 9999;
    height: 44px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
    font-size: 14px;
    line-height: 44px;
    color: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    transition: background-color 0.3s ease;
}

#engagement-topbar.etb-warning {
    background: linear-gradient(90deg, #B8860B, #C9A84C);
}

#engagement-topbar.etb-active {
    background: linear-gradient(90deg, #2a9d39, #4caf50);
}

#engagement-topbar .etb-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

#engagement-topbar .etb-status {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#engagement-topbar .etb-icon {
    font-size: 18px;
    font-weight: 700;
}

#engagement-topbar .etb-text strong {
    font-weight: 600;
}

#engagement-topbar .etb-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

#engagement-topbar .etb-btn {
    padding: 6px 14px;
    border-radius: 4px;
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    border: 0;
    cursor: pointer;
    line-height: normal;
    font-family: inherit;
}

#engagement-topbar .etb-btn-primary {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
}

#engagement-topbar .etb-btn-primary:hover {
    background: rgba(255, 255, 255, 0.3);
}

#engagement-topbar .etb-btn-end {
    background: rgba(0, 0, 0, 0.3);
    color: #fff;
}

#engagement-topbar .etb-btn-end:hover {
    background: rgba(0, 0, 0, 0.5);
}

/* Sprint A: Customer-Dashboard-Sprung — Gold-Akzent als positive Hauptaktion */
#engagement-topbar .etb-btn-dashboard {
    background: #C9A84C;
    color: #1B2A4A;
    font-weight: 600;
    transition: background 0.15s ease, transform 0.1s ease;
}

#engagement-topbar .etb-btn-dashboard:hover {
    background: #d8bc6b;
}

#engagement-topbar .etb-btn-dashboard:active {
    transform: scale(0.98);
}

/* Body-Padding wenn TopBar aktiv */
body.has-engagement-topbar {
    padding-top: 44px;
}

/* Sidebar-Anpassung: existierende .sidebar ist position:fixed top:0 height:100vh.
   Bei aktiver TopBar muss sie 44px nach unten und 44px kuerzer werden. */
body.has-engagement-topbar .sidebar {
    top: 44px !important;
    height: calc(100vh - 44px) !important;
}

/* Mobile Anpassung */
@media (max-width: 600px) {
    #engagement-topbar {
        height: auto;
        line-height: 1.4;
    }
    #engagement-topbar .etb-content {
        flex-direction: column;
        padding: 8px;
        gap: 8px;
    }
    body.has-engagement-topbar {
        padding-top: 90px;
    }
    body.has-engagement-topbar .sidebar {
        top: 90px !important;
        height: calc(100vh - 90px) !important;
    }
}

/* === NISty Wortmarke (Sprint v2.1d) === */
.nisty-wordmark {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-weight: 700;
    letter-spacing: -0.02em;
    display: inline-block;
}
.nisty-wordmark .nisty-nis { color: #1B2A4A; }
.nisty-wordmark .nisty-ty  { color: #C9A84C; font-weight: 600; }
.nisty-wordmark.nisty-sm { font-size: 18px; }
.nisty-wordmark.nisty-md { font-size: 24px; }
.nisty-wordmark.nisty-lg { font-size: 36px; }
.nisty-wordmark.nisty-xl { font-size: 56px; }
.nisty-wordmark.nisty-on-dark .nisty-nis { color: #fff; }
.nisty-wordmark.nisty-on-dark .nisty-ty  { color: #C9A84C; }

.nisty-tagline {
    font-size: 12px;
    color: #6b7280;
    font-weight: 400;
    letter-spacing: 0.02em;
    margin-top: 4px;
}
.nisty-tagline.nisty-tagline-on-dark { color: rgba(255, 255, 255, 0.6); }

/* === v2.1e advisor-assignments === */
.adv-toolbar { display: flex; gap: 16px; align-items: center; margin: 16px 0; }
.adv-toolbar label { display: flex; align-items: center; gap: 6px; font-size: 13px; color: #666; }
#assignments-table { width: 100%; border-collapse: collapse; font-size: 13px; }
#assignments-table th, #assignments-table td { padding: 8px 12px; text-align: left; border-bottom: 1px solid #eee; }
#assignments-table th { background: #f7f8fa; font-weight: 600; color: #1B2A4A; }
.badge-active { color: #2a9d39; font-weight: 600; }
.badge-revoked { color: #888; font-size: 12px; }
.btn-revoke { padding: 4px 10px; background: #d62828; color: white; border: 0; border-radius: 4px; cursor: pointer; font-size: 12px; }
.btn-revoke:hover { background: #b22020; }

#modal-new-assignment {
    position: fixed; inset: 0; background: rgba(0,0,0,0.5);
    align-items: center; justify-content: center; z-index: 10000;
}
#modal-new-assignment .modal-content {
    background: white; padding: 24px; border-radius: 8px;
    max-width: 500px; width: 90%; box-shadow: 0 8px 24px rgba(0,0,0,0.2);
}
#modal-new-assignment label { display: block; margin: 12px 0 4px; font-weight: 600; }
#modal-new-assignment input,
#modal-new-assignment select,
#modal-new-assignment textarea {
    width: 100%; padding: 8px; border: 1px solid #ccc;
    border-radius: 4px; font-size: 14px; box-sizing: border-box; font-family: inherit;
}
#modal-new-assignment textarea { min-height: 60px; resize: vertical; }
#modal-new-assignment .modal-actions {
    display: flex; gap: 8px; justify-content: flex-end; margin-top: 20px;
}
