/* ==========================================================================
   1. Base & Global Styles
   ========================================================================== */
:root {
  --primary-color: #1b365d;   /* Deep Navy Blue */
  --secondary-color: #008080; /* Space Coast Teal */
  --accent-color: #0076a8;    /* Ocean Blue */
  --bg-color: #f4f7f9;
  --card-bg: #ffffff;
  --text-color: #2c3e50;
  --text-muted: #596978;
  --border-radius: 8px;
  --box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  --transition: all 0.3s ease;
}

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

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  line-height: 1.6;
  background-color: var(--bg-color);
  color: var(--text-color);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ==========================================================================
   2. Screen-Switching Mechanics (SPA Logic)
   ========================================================================== */
.screen {
  display: none; /* Hide all screens by default */
  max-width: 1100px;
  margin: 2rem auto;
  padding: 0 1.5rem;
  width: 100%;
}

.screen.active {
  display: block; /* Show active screen */
  animation: fadeIn 0.4s ease-in-out;
}

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

/* ==========================================================================
   3. Header & Navigation
   ========================================================================== */
header {
  background-color: var(--primary-color);
  color: white;
  text-align: center;
  padding: 2.5rem 1rem;
}

header h1 {
  font-size: 2.2rem;
  margin-bottom: 0.5rem;
}

header p {
  font-size: 1.1rem;
  opacity: 0.9;
  max-width: 750px;
  margin: 0 auto;
}

nav {
  background-color: #0f2139;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

nav button {
  background: transparent;
  color: white;
  border: none;
  padding: 0.6rem 1.2rem;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  border-radius: 4px;
  transition: var(--transition);
}

nav button:hover {
  background-color: var(--secondary-color);
  transform: translateY(-1px);
}

/* Generic Button Style */
button {
  background-color: var(--accent-color);
  color: white;
  border: none;
  padding: 0.6rem 1.2rem;
  font-size: 0.95rem;
  border-radius: var(--border-radius);
  cursor: pointer;
  transition: var(--transition);
}

button:hover {
  background-color: #005a82;
}

/* ==========================================================================
   4. Modules & Content Components
   ========================================================================== */

/* Hero Section */
.hero {
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  color: white;
  padding: 3rem 2rem;
  border-radius: var(--border-radius);
  text-align: center;
  margin-bottom: 2rem;
  box-shadow: var(--box-shadow);
}

.hero h2 {
  font-size: 2rem;
  margin-bottom: 0.75rem;
}

.hero p {
  font-size: 1.15rem;
  margin-bottom: 1.5rem;
  max-width: 650px;
  margin-left: auto;
  margin-right: auto;
}

.hero button {
  background-color: white;
  color: var(--primary-color);
  font-weight: bold;
  padding: 0.75rem 1.75rem;
}

.hero button:hover {
  background-color: #f1f1f1;
}

/* Search Bar Section */
.search {
  background: var(--card-bg);
  padding: 2rem;
  border-radius: var(--border-radius);
  box-shadow: var(--box-shadow);
  text-align: center;
  margin-bottom: 2.5rem;
}

.search h2 {
  margin-bottom: 1rem;
  color: var(--primary-color);
}

.search input[type="text"] {
  width: 60%;
  max-width: 500px;
  padding: 0.75rem 1rem;
  font-size: 1rem;
  border: 1px solid #ccc;
  border-radius: var(--border-radius);
  outline: none;
  margin-right: 0.5rem;
}

.search input[type="text"]:focus {
  border-color: var(--accent-color);
}

/* Category Cards Layout */
.categories {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2.5rem;
}

.card {
  background: var(--card-bg);
  padding: 1.5rem;
  border-radius: var(--border-radius);
  box-shadow: var(--box-shadow);
  text-align: center;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: var(--transition);
}

.card:hover {
  transform: translateY(-5px);
}

.card h3 {
  margin-bottom: 0.5rem;
  font-size: 1.2rem;
  color: var(--primary-color);
}

.card p {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-bottom: 1.25rem;
}

/* Detailed Resources Section */
.resources {
  margin-bottom: 2.5rem;
}

.resources h2 {
  margin-bottom: 1rem;
  color: var(--primary-color);
}

.resource {
  background: var(--card-bg);
  padding: 1.5rem;
  border-radius: var(--border-radius);
  box-shadow: var(--box-shadow);
  margin-bottom: 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.resource h3 {
  font-size: 1.15rem;
  color: var(--primary-color);
  margin-bottom: 0.25rem;
}

.resource p {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-bottom: 0.25rem;
}

.resource code {
  background-color: #eef2f5;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: bold;
}

/* AI Chat Box Section */
.chat {
  background: var(--card-bg);
  padding: 2rem;
  border-radius: var(--border-radius);
  box-shadow: var(--box-shadow);
  margin-bottom: 2rem;
}

.chat h2 {
  color: var(--primary-color);
  margin-bottom: 0.5rem;
}

.chat p {
  margin-bottom: 1rem;
  color: var(--text-muted);
}

.chat textarea {
  width: 100%;
  height: 90px;
  padding: 0.75rem;
  border: 1px solid #ccc;
  border-radius: var(--border-radius);
  font-size: 1rem;
  font-family: inherit;
  resize: vertical;
}

#chatOutput {
  background-color: #eef4f8;
  padding: 1rem;
  border-radius: var(--border-radius);
  border-left: 4px solid var(--secondary-color);
  font-size: 0.95rem;
  color: var(--text-color);
}

/* ==========================================================================
   5. Footer & Responsive Layout
   ========================================================================== */
footer {
  margin-top: auto;
  background-color: var(--primary-color);
  color: white;
  text-align: center;
  padding: 1.5rem;
  font-size: 0.9rem;
}

/* Mobile Adjustments */
@media (max-width: 768px) {
  nav button {
    padding: 0.5rem 0.8rem;
    font-size: 0.85rem;
  }

  .search input[type="text"] {
    width: 100%;
    margin-bottom: 0.75rem;
  }

  .resource {
    flex-direction: column;
    align-items: flex-start;
  }

  .resource button {
    align-self: flex-start;
  }
}