/* ============================================
   AI Security Hub - Style Sheet
   ============================================ */

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

:root {
  --bg-primary: #ffffff;
  --bg-secondary: #f8f9fa;
  --bg-card: #ffffff;
  --bg-code: #1e1e2e;
  --border-color: #e2e8f0;
  --border-hover: #cbd5e1;
  --text-primary: #1a202c;
  --text-secondary: #4a5568;
  --text-muted: #94a3b8;
  --accent: #2563eb;
  --accent-dim: rgba(37, 99, 235, 0.08);
  --accent-hover: #1d4ed8;
  --danger: #dc2626;
  --warning: #d97706;
  --info: #2563eb;
  --success: #16a34a;
  --navbar-height: 56px;
  --transition: 0.25s ease;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.7;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color var(--transition);
}

a:hover {
  color: var(--accent-hover);
}

img {
  max-width: 100%;
}

/* --- Navbar --- */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--navbar-height);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
  display: flex;
  align-items: center;
  padding: 0 24px;
  z-index: 1000;
  gap: 8px;
}

.navbar-logo {
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--accent);
  white-space: nowrap;
  flex-shrink: 0;
  margin-right: 16px;
}

.navbar-logo:hover {
  color: var(--accent-hover);
}

.navbar-menu {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1;
}

.nav-item {
  position: relative;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 14px;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 0.88rem;
  font-family: inherit;
  cursor: pointer;
  border-radius: 6px;
  transition: all var(--transition);
  white-space: nowrap;
}

.nav-link:hover {
  color: var(--text-primary);
  background: rgba(0, 0, 0, 0.03);
}

.nav-link-active {
  color: var(--accent);
}

.nav-link-disabled {
  color: var(--text-muted);
  cursor: default;
  text-decoration: none;
}

.nav-link-disabled:hover {
  color: var(--text-muted);
  background: none;
}

.nav-arrow {
  font-size: 0.7rem;
  transition: transform var(--transition);
}

.dropdown-open > .nav-link .nav-arrow {
  transform: rotate(180deg);
}

.nav-badge {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 10px;
  font-size: 0.6rem;
  font-weight: 700;
  background: var(--accent-dim);
  color: var(--accent);
  margin-left: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* --- Dropdown Panel --- */
.dropdown-panel {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.12);
  padding: 8px;
  min-width: 240px;
  z-index: 1001;
  margin-top: 4px;
}

.dropdown-open > .dropdown-panel {
  display: flex;
  flex-direction: column;
}

/* Mega panel (2 columns) */
.mega-panel {
  flex-direction: row !important;
  min-width: 480px;
  gap: 4px;
}

.dropdown-group {
  flex: 1;
  min-width: 0;
}

.dropdown-group-title {
  font-size: 0.68rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 8px 12px 4px;
  font-weight: 600;
}

.dropdown-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  color: var(--text-secondary);
  font-size: 0.85rem;
  border-radius: 6px;
  transition: all var(--transition);
  white-space: nowrap;
}

.dropdown-link:hover {
  color: var(--text-primary);
  background: rgba(0, 0, 0, 0.03);
}

.dropdown-link-active {
  color: var(--accent);
  background: var(--accent-dim);
}

.dropdown-icon {
  font-size: 1rem;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
}

/* --- Navbar Right (Language) --- */
.navbar-right {
  margin-left: auto;
  flex-shrink: 0;
}

.lang-select-compact {
  padding: 5px 28px 5px 8px;
  background: var(--bg-primary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  font-size: 0.8rem;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10'%3E%3Cpath fill='%23666' d='M5 7L1 3h8z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  transition: border-color var(--transition);
}

.lang-select-compact:hover {
  border-color: var(--accent);
}

.lang-select-compact:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-dim);
}

.navbar-lang-mobile {
  display: none;
}

/* --- Hamburger Toggle --- */
.navbar-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 1.4rem;
  cursor: pointer;
  padding: 8px;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-left: auto;
}

/* --- Main Content --- */
.main-content {
  margin-left: 0;
  padding-top: var(--navbar-height);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.content-wrapper {
  flex: 1;
  padding: 40px;
  max-width: 1100px;
  width: 100%;
}

/* --- Page Header --- */
.page-header {
  margin-bottom: 40px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border-color);
}

.page-header h1 {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text-primary);
}

.page-header .subtitle {
  color: var(--text-secondary);
  font-size: 1.05rem;
}

/* --- Section --- */
.section {
  margin-bottom: 48px;
}

.section h2 {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 10px;
}

.section h2 .section-icon {
  color: var(--accent);
}

.section h3 {
  font-size: 1.15rem;
  font-weight: 600;
  margin: 24px 0 12px;
  color: var(--text-primary);
}

.section p {
  color: var(--text-secondary);
  margin-bottom: 12px;
}

/* --- Cards --- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
  margin-top: 16px;
}

.card-grid-3 {
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 24px;
  transition: all var(--transition);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.06);
}

.card:hover {
  border-color: var(--border-hover);
  transform: translateY(-2px);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.08), 0 4px 10px rgba(0, 0, 0, 0.04);
}

.card-link {
  display: block;
  color: inherit;
}

.card-link:hover {
  color: inherit;
}

.card .card-icon {
  font-size: 2rem;
  margin-bottom: 12px;
}

.card h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text-primary);
}

.card p {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 0;
}

.card .card-tag {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  margin-top: 12px;
}

.tag-critical {
  background: rgba(220, 38, 38, 0.1);
  color: var(--danger);
}

.tag-high {
  background: rgba(217, 119, 6, 0.1);
  color: var(--warning);
}

.tag-medium {
  background: rgba(37, 99, 235, 0.1);
  color: var(--info);
}

.tag-low {
  background: rgba(22, 163, 74, 0.1);
  color: var(--success);
}

/* --- Code Blocks --- */
.code-block {
  background: var(--bg-code);
  border: 1px solid #2d2d3f;
  border-radius: 8px;
  margin: 16px 0;
  overflow: hidden;
}

.code-block-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 16px;
  background: rgba(255, 255, 255, 0.06);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 0.8rem;
  color: #94a3b8;
}

.code-block-header .lang {
  color: #60a5fa;
  font-weight: 600;
}

.code-block pre {
  padding: 16px;
  overflow-x: auto;
  font-family: 'Cascadia Code', 'Fira Code', 'Consolas', monospace;
  font-size: 0.85rem;
  line-height: 1.6;
  color: #e0e0e0;
  tab-size: 2;
}

/* Syntax Highlight Colors */
.code-block .keyword {
  color: #ff79c6;
}

.code-block .string {
  color: #f1fa8c;
}

.code-block .comment {
  color: #6272a4;
  font-style: italic;
}

.code-block .function {
  color: #50fa7b;
}

.code-block .number {
  color: #bd93f9;
}

.code-block .type {
  color: #8be9fd;
}

.code-block .variable {
  color: #ffb86c;
}

/* --- Tables --- */
.table-wrapper {
  overflow-x: auto;
  margin: 16px 0;
  border-radius: 8px;
  border: 1px solid var(--border-color);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

thead {
  background: rgba(0, 0, 0, 0.02);
}

th {
  padding: 12px 16px;
  text-align: left;
  font-weight: 600;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

td {
  padding: 12px 16px;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-color);
}

tr:last-child td {
  border-bottom: none;
}

tr:hover td {
  background: rgba(0, 0, 0, 0.02);
}

/* --- Alerts / Callouts --- */
.callout {
  border-radius: 8px;
  padding: 16px 20px;
  margin: 16px 0;
  border-left: 4px solid;
  font-size: 0.9rem;
}

.callout-danger {
  background: rgba(220, 38, 38, 0.06);
  border-color: var(--danger);
}

.callout-danger .callout-title {
  color: var(--danger);
}

.callout-warning {
  background: rgba(217, 119, 6, 0.06);
  border-color: var(--warning);
}

.callout-warning .callout-title {
  color: var(--warning);
}

.callout-info {
  background: rgba(37, 99, 235, 0.06);
  border-color: var(--info);
}

.callout-info .callout-title {
  color: var(--info);
}

.callout-success {
  background: rgba(22, 163, 74, 0.06);
  border-color: var(--success);
}

.callout-success .callout-title {
  color: var(--success);
}

.callout-title {
  font-weight: 700;
  margin-bottom: 4px;
}

/* --- Checklist --- */
.checklist {
  list-style: none;
  margin: 16px 0;
}

.checklist li {
  padding: 10px 0;
  padding-left: 32px;
  position: relative;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-color);
  font-size: 0.9rem;
}

.checklist li:last-child {
  border-bottom: none;
}

.checklist li::before {
  content: '\u2610';
  position: absolute;
  left: 4px;
  color: var(--accent);
  font-size: 1rem;
}

/* --- Badge --- */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-danger {
  background: rgba(220, 38, 38, 0.1);
  color: var(--danger);
}

.badge-warning {
  background: rgba(217, 119, 6, 0.1);
  color: var(--warning);
}

.badge-info {
  background: rgba(37, 99, 235, 0.1);
  color: var(--info);
}

.badge-success {
  background: rgba(22, 163, 74, 0.1);
  color: var(--success);
}

/* --- Hero Section (Top Page) --- */
.hero {
  text-align: center;
  padding: 60px 20px;
  background: linear-gradient(135deg, #1e3a5f, #2563eb, #1d4ed8);
  margin-bottom: 40px;
  border-radius: 0;
}

.hero h1 {
  font-size: 2.5rem;
  font-weight: 800;
  margin-bottom: 16px;
  color: #ffffff;
}

.hero p {
  font-size: 1.15rem;
  color: rgba(255, 255, 255, 0.85);
  max-width: 600px;
  margin: 0 auto;
}

/* --- Stats Row --- */
.stats-row {
  display: flex;
  justify-content: center;
  gap: 40px;
  margin-top: 32px;
  flex-wrap: wrap;
}

.stat-item {
  text-align: center;
}

.stat-number {
  font-size: 2rem;
  font-weight: 800;
  color: var(--accent);
}

.hero .stat-number {
  color: #ffffff;
}

.stat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.hero .stat-label {
  color: rgba(255, 255, 255, 0.7);
}

/* --- Highlight Cards --- */
.highlight-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  margin-top: 20px;
}

.highlight-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 20px;
  text-align: center;
  transition: all var(--transition);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.06);
}

.highlight-card:hover {
  border-color: var(--accent);
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(37, 99, 235, 0.1);
}

.highlight-card .hl-icon {
  font-size: 2.2rem;
  margin-bottom: 12px;
}

.highlight-card h3 {
  font-size: 1rem;
  margin-bottom: 6px;
  color: var(--text-primary);
}

.highlight-card p {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin: 0;
}

/* --- Card Group Headings (index page) --- */
.card-group-heading {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-top: 28px;
  margin-bottom: 4px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-color);
}

.card-group-heading:first-child {
  margin-top: 0;
}

/* --- Tool Cards --- */
.tool-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 24px;
  transition: all var(--transition);
}

.tool-card:hover {
  border-color: var(--border-hover);
}

.tool-card h3 {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.tool-card .tool-badge {
  font-size: 0.7rem;
  padding: 2px 8px;
  border-radius: 4px;
  background: var(--accent-dim);
  color: var(--accent);
}

.tool-card ul {
  list-style: none;
  margin-top: 12px;
}

.tool-card ul li {
  padding: 4px 0;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.tool-card ul li::before {
  content: '\u2192 ';
  color: var(--accent);
}

/* --- News Items --- */
.news-item {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 16px;
  transition: all var(--transition);
}

.news-item:hover {
  border-color: var(--border-hover);
}

.news-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.news-item h3 {
  margin-bottom: 8px;
}

.news-item p {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

/* --- Tabs --- */
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 24px;
  overflow-x: auto;
}

.tab-btn {
  background: none;
  border: none;
  padding: 10px 20px;
  color: var(--text-muted);
  font-size: 0.9rem;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all var(--transition);
  white-space: nowrap;
}

.tab-btn:hover {
  color: var(--text-primary);
}

.tab-btn.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* --- Accordion --- */
.accordion-item {
  border: 1px solid var(--border-color);
  border-radius: 8px;
  margin-bottom: 8px;
  overflow: hidden;
}

.accordion-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  background: var(--bg-card);
  cursor: pointer;
  transition: background var(--transition);
  border: none;
  width: 100%;
  text-align: left;
  color: var(--text-primary);
  font-size: 1rem;
  font-weight: 600;
}

.accordion-header:hover {
  background: rgba(0, 0, 0, 0.02);
}

.accordion-arrow {
  transition: transform var(--transition);
  color: var(--text-muted);
}

.accordion-item.open .accordion-arrow {
  transform: rotate(180deg);
}

.accordion-body {
  padding: 0 20px;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.35s ease, padding 0.35s ease;
}

.accordion-item.open .accordion-body {
  padding: 0 20px 20px;
  max-height: 2000px;
}

/* --- Footer --- */
.site-footer {
  margin-left: 0;
  border-top: 1px solid var(--border-color);
  padding: 24px 40px;
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.site-footer a {
  color: var(--text-muted);
}

.site-footer a:hover {
  color: var(--accent);
}

/* --- Utility --- */
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.text-accent { color: var(--accent); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-info { color: var(--info); }
.text-success { color: var(--success); }
.text-muted { color: var(--text-muted); }

.flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }
.items-center { align-items: center; }

/* --- Responsive --- */
@media (max-width: 768px) {
  .navbar {
    padding: 0 12px;
  }

  .navbar-menu {
    display: none;
    position: fixed;
    top: var(--navbar-height);
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-secondary);
    flex-direction: column;
    align-items: stretch;
    padding: 12px;
    overflow-y: auto;
    border-top: 1px solid var(--border-color);
    z-index: 999;
    gap: 0;
  }

  .navbar-menu.navbar-menu-open {
    display: flex;
  }

  .navbar-toggle {
    display: flex;
  }

  .navbar-right {
    display: none;
  }

  .navbar-lang-mobile {
    display: block;
    padding: 12px 0;
    border-top: 1px solid var(--border-color);
    margin-top: 8px;
  }

  .navbar-lang-mobile .lang-select-compact {
    width: 100%;
  }

  .nav-item {
    width: 100%;
  }

  .nav-link {
    width: 100%;
    justify-content: space-between;
    padding: 12px 14px;
    border-radius: 8px;
  }

  .dropdown-panel {
    position: static;
    margin-top: 0;
    border: none;
    box-shadow: none;
    background: rgba(0, 0, 0, 0.02);
    border-radius: 8px;
    padding: 4px 0 4px 8px;
  }

  .mega-panel {
    flex-direction: column !important;
    min-width: 0;
  }

  .dropdown-link {
    padding: 10px 12px;
  }

  .nav-link-disabled {
    padding: 12px 14px;
  }

  .main-content {
    padding-top: var(--navbar-height);
  }

  .content-wrapper {
    padding: 24px 16px;
  }

  .hero {
    padding: 40px 16px;
  }

  .hero h1 {
    font-size: 1.8rem;
  }

  .page-header h1 {
    font-size: 1.5rem;
  }

  .card-grid {
    grid-template-columns: 1fr;
  }

  .highlight-cards {
    grid-template-columns: 1fr 1fr;
  }

  .stats-row {
    gap: 24px;
  }

  .tabs {
    gap: 0;
  }

  .tab-btn {
    padding: 8px 14px;
    font-size: 0.8rem;
  }
}

@media (max-width: 480px) {
  .highlight-cards {
    grid-template-columns: 1fr;
  }

  .stats-row {
    flex-direction: column;
    gap: 16px;
  }
}

/* --- Category Badges --- */
.cat-badge {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 3px;
  letter-spacing: 0.3px;
  vertical-align: middle;
}

.cat-badge.cat-ai {
  background: rgba(139, 92, 246, 0.12);
  color: #7c3aed;
}

.cat-badge.cat-infra {
  background: rgba(59, 130, 246, 0.12);
  color: #2563eb;
}

/* --- Category Filter Tabs --- */
.news-category-tabs .tab-btn {
  padding: 6px 16px;
  border-radius: 20px;
  border: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
  font-size: 0.85rem;
}

.news-category-tabs .tab-btn.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  border-bottom-color: var(--accent);
}
