/**
 * Material Design 3 (MD3) Design System for Gemini API
 * Reference: https://github.com/skydashnet/material-design-3-ui-skill
 * Full-Site Coverage: Homepage, Console, Keys, Settings & Subpages
 * Designed for api.sesley.eu.cc
 */

:root,
html.light,
html.dark,
body {
  /* MD3 Core Color Tokens - Google Blue Palette */
  --md-sys-color-primary: #0b57d0 !important;
  --md-sys-color-on-primary: #ffffff !important;
  --md-sys-color-primary-hover: #0842a0 !important;
  --md-sys-color-primary-container: #d3e3fd !important;
  --md-sys-color-on-primary-container: #041e49 !important;
  --md-sys-color-secondary: #00639b !important;
  --md-sys-color-surface: #ffffff !important;
  --md-sys-color-surface-dim: #f2f4f8 !important;
  --md-sys-color-surface-container: #f0f4f9 !important;
  --md-sys-color-surface-container-high: #e9eef6 !important;
  --md-sys-color-surface-container-highest: #dde3ea !important;
  --md-sys-color-on-surface: #1f1f1f !important;
  --md-sys-color-on-surface-variant: #444746 !important;
  --md-sys-color-outline: #747775 !important;
  --md-sys-color-outline-variant: #c4c7c5 !important;
  --md-sys-color-surface-tint: #0b57d0 !important;

  /* Typography */
  --md-sys-typescale-font: 'Google Sans', 'Roboto', 'Noto Sans SC', system-ui, -apple-system, sans-serif !important;

  /* Elevation Shadows */
  --md-sys-elevation-1: 0 1px 2px rgba(0, 0, 0, 0.08), 0 1px 3px 1px rgba(0, 0, 0, 0.05);
  --md-sys-elevation-2: 0 1px 2px rgba(0, 0, 0, 0.08), 0 2px 6px 2px rgba(0, 0, 0, 0.06);
  --md-sys-elevation-3: 0 1px 3px rgba(0, 0, 0, 0.1), 0 4px 8px 3px rgba(0, 0, 0, 0.08);

  /* Shape Tokens */
  --md-sys-shape-corner-small: 8px;
  --md-sys-shape-corner-medium: 12px;
  --md-sys-shape-corner-large: 16px;
  --md-sys-shape-corner-extra-large: 24px;
  --md-sys-shape-corner-full: 9999px;

  /* Force Fixed Theme (Override Tailwind & Dark Mode completely) */
  --background: 210 20% 98% !important;
  --foreground: 0 0% 12% !important;
  --card: 0 0% 100% !important;
  --card-foreground: 0 0% 12% !important;
  --popover: 0 0% 100% !important;
  --popover-foreground: 0 0% 12% !important;
  --primary: 217 90% 43% !important;
  --primary-foreground: 0 0% 100% !important;
  --secondary: 210 40% 96.1% !important;
  --secondary-foreground: 217 90% 43% !important;
  --muted: 210 40% 96.1% !important;
  --muted-foreground: 215 16% 47% !important;
  --accent: 210 40% 96.1% !important;
  --accent-foreground: 217 90% 43% !important;
  --destructive: 0 84.2% 60.2% !important;
  --destructive-foreground: 210 40% 98% !important;
  --border: 214.3 31.8% 91.4% !important;
  --input: 214.3 31.8% 91.4% !important;
  --ring: 217 90% 43% !important;
  --radius: 1.25rem !important;

  /* Sidebar Tokens for Console */
  --sidebar-background: 210 25% 97% !important;
  --sidebar-foreground: 0 0% 15% !important;
  --sidebar-primary: 217 90% 43% !important;
  --sidebar-primary-foreground: 0 0% 100% !important;
  --sidebar-accent: 214 80% 93% !important;
  --sidebar-accent-foreground: 217 90% 25% !important;
  --sidebar-border: 214 20% 90% !important;
  --sidebar-ring: 217 90% 43% !important;
}

/* Global Font and Base Styling */
body, button, input, select, textarea, [data-radix-popper-content-wrapper] {
  font-family: var(--md-sys-typescale-font) !important;
  -webkit-font-smoothing: antialiased;
}

/* Hide theme toggles to guarantee the site-wide fixed MD3 theme */
button[aria-label*="theme" i],
button[aria-label*="Theme" i],
[data-slot="theme-toggle"],
.theme-toggle-btn {
  display: none !important;
}

/* =================================================== */
/* 1. Header & Navigation (Homepage & Global)         */
/* =================================================== */
header nav {
  background-color: rgba(255, 255, 255, 0.92) !important;
  backdrop-filter: blur(16px) !important;
  -webkit-backdrop-filter: blur(16px) !important;
  border-radius: var(--md-sys-shape-corner-full) !important;
  border: 1px solid rgba(196, 199, 197, 0.5) !important;
  box-shadow: 0 2px 12px rgba(11, 87, 208, 0.04) !important;
  margin-top: 12px !important;
  transition: all 0.25s cubic-bezier(0.2, 0, 0, 1) !important;
}

/* Nav & Sidebar Brand Logos */
.gemini-nav-logo {
  height: 28px !important;
  width: auto !important;
  max-width: 32px !important;
  object-fit: contain !important;
  display: inline-block !important;
  vertical-align: middle !important;
  border-radius: 6px !important;
  margin-right: 8px !important;
}

/* =================================================== */
/* 2. Console (Dashboard / Keys / Settings) Styling   */
/* =================================================== */
aside, 
[data-sidebar="sidebar"],
[class*="sidebar"] {
  background-color: var(--md-sys-color-surface-container) !important;
  border-right: 1px solid var(--md-sys-color-outline-variant) !important;
}

/* Console Header Brand Area in Sidebar */
aside header,
[data-sidebar="header"],
aside [class*="header"] {
  padding: 16px 20px !important;
  border-bottom: 1px solid var(--md-sys-color-outline-variant) !important;
}

aside header a,
[data-sidebar="header"] a {
  font-family: 'Google Sans', sans-serif !important;
  font-size: 18px !important;
  font-weight: 600 !important;
  color: var(--md-sys-color-on-surface) !important;
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
  text-decoration: none !important;
}

/* Console Sidebar Menu Items - Google Pill Highlighting */
aside button,
aside a,
[data-sidebar="menu-button"] {
  border-radius: var(--md-sys-shape-corner-full) !important;
  font-size: 14px !important;
  font-weight: 500 !important;
  transition: background-color 0.15s ease, color 0.15s ease !important;
}

aside button[data-active="true"],
aside a[aria-current="page"],
[data-sidebar="menu-button"][data-active="true"] {
  background-color: var(--md-sys-color-primary-container) !important;
  color: var(--md-sys-color-on-primary-container) !important;
  font-weight: 600 !important;
}

aside button:hover,
aside a:hover,
[data-sidebar="menu-button"]:hover {
  background-color: var(--md-sys-color-surface-container-high) !important;
}

/* Tables in Console (e.g. Keys, Logs, Channels) */
table {
  border-collapse: separate !important;
  border-spacing: 0 !important;
}

th {
  background-color: var(--md-sys-color-surface-container) !important;
  color: var(--md-sys-color-on-surface-variant) !important;
  font-size: 13px !important;
  font-weight: 600 !important;
  text-transform: uppercase !important;
  letter-spacing: 0.5px !important;
  border-bottom: 1px solid var(--md-sys-color-outline-variant) !important;
}

td {
  border-bottom: 1px solid var(--md-sys-color-outline-variant) !important;
  font-size: 14px !important;
}

/* =================================================== */
/* 3. Hero Section Custom Banner (Homepage)           */
/* =================================================== */
.gemini-hero-banner-container {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  margin-bottom: 24px;
  width: 100%;
}

.gemini-hero-logo-img {
  max-width: 440px;
  width: 100%;
  height: auto;
  object-fit: contain;
  filter: drop-shadow(0 4px 16px rgba(11, 87, 208, 0.12));
  transition: transform 0.3s cubic-bezier(0.2, 0, 0, 1);
}

.gemini-hero-logo-img:hover {
  transform: scale(1.015);
}

/* =================================================== */
/* 4. Global Buttons & Badges                         */
/* =================================================== */
button, 
a.inline-flex[class*="rounded"],
a[class*="bg-primary"],
button[class*="bg-primary"] {
  border-radius: var(--md-sys-shape-corner-full) !important;
  transition: all 0.2s cubic-bezier(0.2, 0, 0, 1) !important;
  font-weight: 500 !important;
}

button[class*="bg-primary"],
a[class*="bg-primary"] {
  background-color: var(--md-sys-color-primary) !important;
  color: var(--md-sys-color-on-primary) !important;
  box-shadow: 0 1px 3px rgba(11, 87, 208, 0.2) !important;
}

button[class*="bg-primary"]:hover,
a[class*="bg-primary"]:hover {
  background-color: var(--md-sys-color-primary-hover) !important;
  box-shadow: 0 2px 6px rgba(11, 87, 208, 0.3) !important;
  transform: translateY(-1px);
}

button[class*="border"],
a[class*="border"] {
  border-radius: var(--md-sys-shape-corner-full) !important;
  border-color: var(--md-sys-color-outline-variant) !important;
}

button[class*="border"]:hover,
a[class*="border"]:hover {
  background-color: var(--md-sys-color-surface-container) !important;
  border-color: var(--md-sys-color-outline) !important;
}

/* Card & Modal Containers */
[class*="rounded-3xl"],
[class*="rounded-2xl"],
[class*="rounded-xl"] {
  border-radius: var(--md-sys-shape-corner-extra-large) !important;
}

/* Code Preview Window in Hero (Google AI Studio Look) */
div:has(> div > span:contains("200 OK")),
div:has(> [class*="border-border"]) {
  border-radius: var(--md-sys-shape-corner-extra-large) !important;
  border: 1px solid var(--md-sys-color-outline-variant) !important;
  box-shadow: 0 4px 24px rgba(11, 87, 208, 0.06) !important;
  background-color: #ffffff !important;
}

/* Badges / Chips */
[class*="badge"],
[class*="rounded-full"][class*="px-"] {
  border-radius: var(--md-sys-shape-corner-full) !important;
  font-weight: 500 !important;
}

/* Footer */
footer {
  background-color: var(--md-sys-color-surface-container) !important;
  border-top: 1px solid var(--md-sys-color-outline-variant) !important;
}

.gemini-footer-logo {
  height: 26px !important;
  width: auto !important;
  object-fit: contain !important;
  vertical-align: middle !important;
  margin-right: 8px !important;
  border-radius: 4px !important;
}

/* =================================================== */
/* 5. Mobile Responsive Adjustments                   */
/* =================================================== */
@media (max-width: 768px) {
  header nav {
    margin-top: 6px !important;
    padding: 0 12px !important;
  }
  .gemini-hero-banner-container {
    justify-content: flex-start;
    margin-bottom: 16px;
  }
  .gemini-hero-logo-img {
    max-width: 280px;
  }
  h1 {
    font-size: 2rem !important;
    line-height: 1.22 !important;
    letter-spacing: -0.02em;
  }
  a[class*="inline-flex"],
  button[class*="inline-flex"] {
    font-size: 13.5px !important;
    padding-left: 14px !important;
    padding-right: 14px !important;
  }
}
