/**
 * Grams to Cups Converter - Modern Materialize CSS Enhancements
 * Color Palette: Teal, Amber, Slate Blue, Crisp White
 */

:root {
  --primary-color: #00897b;
  --primary-dark: #00695c;
  --primary-light: #e0f2f1;
  --secondary-color: #ff8f00;
  --secondary-dark: #e65100;
  --secondary-light: #fff8e1;
  --text-main: #263238;
  --text-muted: #546e7a;
  --bg-light: #f8fafc;
  --card-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  --card-shadow-hover: 0 8px 30px rgba(0, 0, 0, 0.12);
  --border-radius: 12px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--text-main);
  background-color: var(--bg-light);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main {
  flex: 1 0 auto;
}

/* --------------------------------------------------------------------------
   Navigation & Header
--------------------------------------------------------------------------- */
nav.nav-extended,
nav {
  background: #ffffff;
  color: var(--text-main);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

nav .brand-logo {
  display: flex;
  align-items: center;
  height: 100%;
}

nav .brand-logo img {
  height: 48px;
  vertical-align: middle;
}

nav ul a {
  color: var(--text-main);
  font-weight: 500;
  font-size: 0.95rem;
  transition: color 0.2s ease;
}

nav ul a:hover {
  color: var(--primary-color);
  background-color: var(--primary-light);
}

nav .nav-search {
  position: relative;
  max-width: 280px;
  margin-right: 15px;
}

.search-results-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: #ffffff;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  max-height: 350px;
  overflow-y: auto;
  z-index: 1000;
  display: none;
}

.search-results-dropdown a {
  display: block;
  padding: 10px 15px;
  color: var(--text-main);
  border-bottom: 1px solid #edf2f7;
  font-size: 0.9rem;
  line-height: 1.4;
}

.search-results-dropdown a:hover {
  background-color: var(--primary-light);
  color: var(--primary-dark);
}

/* --------------------------------------------------------------------------
   Hero Section
--------------------------------------------------------------------------- */
.hero-section {
  background: linear-gradient(135deg, #00897b 0%, #004d40 100%);
  color: #ffffff;
  padding: 40px 0 60px;
  position: relative;
  overflow: hidden;
}

.hero-section h1 {
  font-size: 2.5rem;
  font-weight: 800;
  margin-bottom: 15px;
  letter-spacing: -0.5px;
}

.hero-section p.lead {
  font-size: 1.2rem;
  opacity: 0.92;
  max-width: 720px;
  margin: 0 auto;
}

/* --------------------------------------------------------------------------
   Main Calculator Widget
--------------------------------------------------------------------------- */
.calculator-card {
  background: #ffffff;
  border-radius: var(--border-radius);
  box-shadow: var(--card-shadow);
  padding: 30px;
  margin-top: -35px;
  position: relative;
  z-index: 10;
  border-top: 4px solid var(--secondary-color);
  transition: box-shadow 0.3s ease;
}

.calculator-card:hover {
  box-shadow: var(--card-shadow-hover);
}

.calculator-card .card-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 25px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.swap-btn {
  background-color: var(--secondary-color) !important;
  transition: transform 0.3s ease;
}

.swap-btn:hover {
  background-color: var(--secondary-dark) !important;
  transform: rotate(180deg);
}

.chip-presets {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip-preset {
  cursor: pointer;
  background-color: #f1f5f9;
  color: var(--text-muted);
  border-radius: 16px;
  padding: 4px 12px;
  font-size: 0.82rem;
  font-weight: 600;
  transition: all 0.2s ease;
  user-select: none;
}

.chip-preset:hover,
.chip-preset.active {
  background-color: var(--primary-color);
  color: #ffffff;
}

/* Calculator Result Box */
.calc-result-box {
  background: linear-gradient(135deg, #e0f2f1 0%, #b2dfdb 100%);
  border-radius: 12px;
  padding: 24px;
  text-align: center;
  margin-top: 20px;
  border: 1px solid #80cbc4;
  position: relative;
}

.calc-result-main {
  font-size: 2.2rem;
  font-weight: 800;
  color: #004d40;
  line-height: 1.2;
}

.calc-result-fraction {
  display: inline-block;
  background-color: #ffffff;
  color: var(--secondary-dark);
  font-weight: 700;
  padding: 4px 14px;
  border-radius: 20px;
  margin-top: 10px;
  font-size: 1.05rem;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.calc-breakdown {
  display: flex;
  justify-content: space-around;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px dashed #80cbc4;
  font-size: 0.9rem;
  color: #004d40;
}

.calc-breakdown-item strong {
  display: block;
  font-size: 1.1rem;
  font-weight: 700;
}

/* --------------------------------------------------------------------------
   Conversion Tables & Cards
--------------------------------------------------------------------------- */
.content-card {
  background: #ffffff;
  border-radius: var(--border-radius);
  box-shadow: var(--card-shadow);
  padding: 26px;
  margin-bottom: 30px;
}

.content-card h2 {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text-main);
  margin-top: 0;
  margin-bottom: 20px;
  border-bottom: 2px solid #e2e8f0;
  padding-bottom: 10px;
}

.content-card h3 {
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--text-main);
  margin-top: 25px;
  margin-bottom: 15px;
}

table.conversion-table {
  width: 100%;
  border-collapse: collapse;
}

table.conversion-table th {
  background-color: #f1f5f9;
  color: var(--text-main);
  font-weight: 700;
  font-size: 0.95rem;
  padding: 12px 16px;
}

table.conversion-table td {
  padding: 12px 16px;
  font-size: 0.92rem;
  border-bottom: 1px solid #e2e8f0;
}

table.conversion-table tr.highlight-row {
  background-color: var(--secondary-light) !important;
  font-weight: 700;
  color: var(--secondary-dark);
}

table.conversion-table tr:hover {
  background-color: #f8fafc;
}

/* --------------------------------------------------------------------------
   Popular Grid & Cards
--------------------------------------------------------------------------- */
.badge-category {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 4px;
  background-color: #eceff1;
  color: #455a64;
}

.ingredient-card {
  background: #ffffff;
  border-radius: var(--border-radius);
  box-shadow: var(--card-shadow);
  padding: 18px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border-left: 4px solid var(--primary-color);
}

.ingredient-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--card-shadow-hover);
}

.ingredient-card .ing-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 6px;
}

.ingredient-card .ing-density {
  font-size: 0.85rem;
  color: var(--primary-dark);
  font-weight: 600;
  margin-bottom: 12px;
}

/* --------------------------------------------------------------------------
   FAQ Section
--------------------------------------------------------------------------- */
.collapsible.faq-collapsible {
  border: none;
  box-shadow: none;
}

.collapsible.faq-collapsible li {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  margin-bottom: 10px;
  overflow: hidden;
}

.collapsible.faq-collapsible .collapsible-header {
  font-weight: 600;
  font-size: 1.05rem;
  color: var(--text-main);
  padding: 16px 20px;
  border: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.collapsible.faq-collapsible .collapsible-header i {
  color: var(--primary-color);
}

.collapsible.faq-collapsible .collapsible-body {
  border-top: 1px solid #f1f5f9;
  padding: 18px 20px;
  color: var(--text-muted);
  line-height: 1.6;
  background-color: #fafbfc;
}

/* --------------------------------------------------------------------------
   Related Links Grid
--------------------------------------------------------------------------- */
.related-links-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}

.related-link-chip {
  display: block;
  padding: 10px 14px;
  background-color: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  color: var(--text-main);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 500;
  transition: all 0.2s ease;
  text-align: center;
}

.related-link-chip:hover {
  background-color: var(--primary-light);
  border-color: var(--primary-color);
  color: var(--primary-dark);
}

/* --------------------------------------------------------------------------
   Footer
--------------------------------------------------------------------------- */
footer.page-footer {
  background-color: #1e293b;
  color: #94a3b8;
  margin-top: 50px;
  padding-top: 40px;
}

footer.page-footer h5 {
  color: #ffffff;
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 18px;
}

footer.page-footer a {
  color: #cbd5e1;
  transition: color 0.2s ease;
}

footer.page-footer a:hover {
  color: var(--secondary-color);
}

footer.page-footer .footer-copyright {
  background-color: #0f172a;
  color: #64748b;
  font-size: 0.85rem;
}

/* --------------------------------------------------------------------------
   Admin Panel Styles
--------------------------------------------------------------------------- */
.admin-sidebar {
  background-color: #1e293b;
  min-height: calc(100vh - 64px);
  padding: 20px 0;
}

.admin-sidebar a {
  display: flex;
  align-items: center;
  padding: 14px 24px;
  color: #94a3b8;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.2s ease;
}

.admin-sidebar a i {
  margin-right: 12px;
}

.admin-sidebar a:hover,
.admin-sidebar a.active {
  background-color: #334155;
  color: #ffffff;
  border-left: 4px solid var(--primary-color);
}

.stat-card {
  border-radius: var(--border-radius);
  padding: 24px;
  color: #ffffff;
  box-shadow: var(--card-shadow);
}

.stat-card .stat-number {
  font-size: 2.4rem;
  font-weight: 800;
  line-height: 1.1;
}

.stat-card .stat-label {
  font-size: 0.95rem;
  opacity: 0.9;
  font-weight: 500;
}

/* --------------------------------------------------------------------------
   Responsive Fixes
--------------------------------------------------------------------------- */
@media only screen and (max-width: 600px) {
  .hero-section h1 {
    font-size: 1.8rem;
  }
  .calculator-card {
    padding: 18px;
  }
  .calc-result-main {
    font-size: 1.6rem;
  }
  .calc-breakdown {
    flex-direction: column;
    gap: 8px;
  }
  table.conversion-table th, 
  table.conversion-table td {
    padding: 8px 10px;
    font-size: 0.85rem;
  }
}
