/* ============================================================
   GramsToCups - Main Stylesheet
   Font: Poppins (loaded via Google Fonts in header)
   Framework: Materialize CSS 1.0.0
   ============================================================ */

:root {
    --primary:      #00897b; /* teal darken-1 */
    --primary-dark: #00695c; /* teal darken-3 */
    --primary-light:#b2dfdb; /* teal lighten-4 */
    --accent:       #ff5722; /* deep-orange */
    --text:         #212121;
    --text-muted:   #757575;
    --bg-light:     #f5f5f5;
    --white:        #ffffff;
    --radius:       8px;
    --shadow:       0 2px 8px rgba(0,0,0,.10);
    --shadow-lg:    0 4px 20px rgba(0,0,0,.14);
    --transition:   all .2s ease;
}

/* ── Base ──────────────────────────────────────────────────── */
* { box-sizing: border-box; }

body {
    font-family: 'Poppins', 'Roboto', sans-serif;
    color: var(--text);
    background: #fafafa;
    line-height: 1.65;
    display: flex;
    min-height: 100vh;
    flex-direction: column;
}

main#main-content {
    flex: 1 0 auto;
    margin-top: 0 !important;
    padding-top: 0 !important;
}

.hero-section {
    margin-top: 0 !important;
}


h1, h2, h3, h4, h5, h6 {
    font-family: 'Poppins', sans-serif;
    font-weight: 600;
}

a { color: var(--primary); transition: var(--transition); }
a:hover { color: var(--primary-dark); }

/* ── Navbar ────────────────────────────────────────────────── */
.nav-main {
    box-shadow: none !important;
    border-bottom: none !important;
    position: sticky;
    top: 0;
    z-index: 999;
}

.nav-main .brand-logo {
    display: flex;
    align-items: center;
    font-weight: 700;
    font-size: 1.25rem;
    letter-spacing: -0.3px;
}

.brand-name { font-family: 'Poppins', sans-serif; }

nav ul a {
    font-size: 0.9rem;
    font-weight: 500;
    letter-spacing: 0.2px;
    transition: var(--transition);
}

nav ul li.active a,
nav ul a:hover { background: rgba(255,255,255,.15) !important; }

/* ── Static / Legal Page Prose ─────────────────────────────── */
.static-content.prose {
    max-width: 780px;
    color: #333;
    font-size: 1rem;
    line-height: 1.8;
}

.static-content.prose .lead {
    font-size: 1.15rem;
    color: #555;
    line-height: 1.9;
    margin-bottom: 28px;
    border-left: 4px solid #80cbc4;
    padding-left: 16px;
}

.static-content.prose h1 {
    font-size: 2.2rem;
    font-weight: 700;
    color: #00695c;
    margin: 0 0 8px;
    border-bottom: 3px solid #b2dfdb;
    padding-bottom: 10px;
}

.static-content.prose h2 {
    font-size: 1.35rem;
    font-weight: 700;
    color: #00897b;
    margin: 32px 0 10px;
    padding-bottom: 4px;
    border-bottom: 1px solid #e0f2f1;
}

.static-content.prose h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: #333;
    margin: 20px 0 6px;
}

.static-content.prose p {
    margin: 0 0 16px;
    color: #444;
}

.static-content.prose ul,
.static-content.prose ol {
    margin: 0 0 16px 24px;
    padding: 0;
}

.static-content.prose li {
    margin-bottom: 6px;
    color: #444;
}

.static-content.prose a {
    color: #00897b;
    text-decoration: underline;
    text-underline-offset: 2px;
}

/* Buttons inside prose must keep their own white text */
.static-content.prose a.btn,
.static-content.prose a.btn-flat,
.static-content.prose a.btn-large {
    color: #fff !important;
    text-decoration: none !important;
}

.static-content.prose a:not(.btn):not(.btn-flat):not(.btn-large):hover { color: #00695c; }

.static-content.prose strong { color: #212121; }

.static-content.prose table {
    width: 100%;
    border-collapse: collapse;
    margin: 16px 0 24px;
    font-size: 0.9rem;
}

.static-content.prose table th {
    background: #e0f2f1;
    color: #00695c;
    font-weight: 700;
    padding: 10px 14px;
    text-align: left;
    border-bottom: 2px solid #b2dfdb;
}

.static-content.prose table td {
    padding: 9px 14px;
    border-bottom: 1px solid #f0f0f0;
    vertical-align: top;
}

.static-content.prose table tr:nth-child(even) td { background: #fafafa; }

.static-content.prose blockquote {
    border-left: 4px solid #80cbc4;
    background: #f9fffe;
    margin: 16px 0;
    padding: 12px 20px;
    font-style: italic;
    color: #555;
}

/* ── Breadcrumb ────────────────────────────────────────────── */
.breadcrumb-bar {
    border-bottom: 1px solid #e0e0e0;
    padding: 6px 0;
    font-size: 0.82rem;
}

.breadcrumb-wrapper {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px;
    padding: 2px 0;
}

.breadcrumb-item {
    color: var(--text-muted);
    text-decoration: none;
    transition: var(--transition);
}

.breadcrumb-item:hover { color: var(--primary); }
.breadcrumb-item.active { color: var(--text); font-weight: 500; }
.breadcrumb-sep { color: #bdbdbd; margin: 0 2px; }

/* Override Materialize's built-in coral breadcrumb color */
nav .breadcrumb,
.breadcrumb-bar .breadcrumb,
.breadcrumb-bar a,
.breadcrumb-bar span {
    color: #757575;
}
.breadcrumb-bar a:hover { color: var(--primary); }
.breadcrumb-bar .active { color: #212121; font-weight: 500; }

/* Responsive ingredient card grid */
@media (max-width: 600px) {
    [style*="grid-template-columns:repeat(3,1fr)"] {
        grid-template-columns: 1fr !important;
    }
}
@media (min-width: 601px) and (max-width: 992px) {
    [style*="grid-template-columns:repeat(3,1fr)"] {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

/* ── Hero Section ──────────────────────────────────────────── */
.hero-section {
    padding: 60px 0 50px;
    background: linear-gradient(135deg, #00695c 0%, #00897b 50%, #26a69a 100%);
}

.hero-section h1 { font-size: 2.4rem; text-shadow: 0 1px 3px rgba(0,0,0,.2); }

/* ── Calculator ────────────────────────────────────────────── */
#calculator-widget {
    padding: 0;
}

.direction-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.direction-btn {
    font-size: 0.85rem !important;
    padding: 0 16px !important;
    height: 34px !important;
    line-height: 34px !important;
    border-radius: 20px !important;
    box-shadow: none !important;
    transition: var(--transition) !important;
}

.calc-result-box {
    margin-top: 16px;
    padding: 16px 20px;
    background: linear-gradient(135deg, #e0f2f1, #b2dfdb);
    border-left: 4px solid var(--primary);
    border-radius: var(--radius);
    animation: fadeIn .35s ease;
}

.result-main {
    font-size: 1.35rem;
    font-weight: 600;
    color: var(--primary-dark);
}

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

/* ── Cards ─────────────────────────────────────────────────── */
.card {
    border-radius: var(--radius) !important;
    box-shadow: var(--shadow) !important;
    transition: var(--transition) !important;
}

.card:hover { box-shadow: var(--shadow-lg) !important; }

.card .card-title { font-weight: 600 !important; }

/* Ingredient stat cards */
.ingredient-card {
    text-align: center;
    padding: 16px 12px;
    border-radius: var(--radius);
    background: var(--white);
    box-shadow: var(--shadow);
    transition: var(--transition);
    border-top: 3px solid var(--primary);
    cursor: default;
}

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

.ingredient-card .gpc-value {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--primary);
    display: block;
}

/* ── Tables ─────────────────────────────────────────────────── */
.conversion-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

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

.conversion-table th {
    background: var(--primary);
    color: #fff;
    padding: 10px 14px;
    text-align: left;
    font-weight: 600;
    font-size: 0.9rem;
}

.conversion-table td {
    padding: 9px 14px;
    border-bottom: 1px solid #e0e0e0;
    font-size: 0.9rem;
}

.conversion-table tbody tr:nth-child(even) td { background: #f5f5f5; }
.conversion-table tbody tr:hover td { background: #e0f2f1; }
.conversion-table .highlight td {
    background: #b2dfdb !important;
    font-weight: 600;
    color: var(--primary-dark);
}

/* ── Section headings ──────────────────────────────────────── */
.section-heading {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--primary-dark);
    margin-bottom: 20px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--primary-light);
}

.section { padding: 40px 0; }
.section-alt { background: #f9f9f9; }

/* ── FAQ Collapsible ───────────────────────────────────────── */
.collapsible.faq-collapsible {
    border: none !important;
    box-shadow: none !important;
}

.faq-collapsible li {
    margin-bottom: 10px;
    border-radius: var(--radius) !important;
    overflow: hidden;
    border: 1px solid #e0e0e0 !important;
    box-shadow: var(--shadow) !important;
}

.faq-collapsible .collapsible-header {
    font-weight: 600;
    font-size: 0.95rem;
    background: #fff;
    border: none;
    padding: 14px 16px;
}

.faq-collapsible .collapsible-header:hover { background: #f5f5f5; }

.faq-collapsible .collapsible-header i {
    color: var(--primary);
    margin-right: 10px;
}

.faq-collapsible .collapsible-body {
    border: none;
    background: #fafafa;
    padding: 14px 16px;
    font-size: 0.9rem;
    color: var(--text-muted);
    line-height: 1.7;
}

/* ── Related Links (chip grid) ──────────────────────────────── */
.related-links-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.related-link-chip {
    display: inline-block;
    padding: 6px 14px;
    background: #e0f2f1;
    color: var(--primary-dark);
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
    text-decoration: none;
    transition: var(--transition);
    border: 1px solid #b2dfdb;
}

.related-link-chip:hover {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
    transform: translateY(-1px);
}

/* ── Tool Cards ────────────────────────────────────────────── */
.tool-card {
    text-align: center;
    padding: 24px 16px;
    border-radius: var(--radius);
    background: #fff;
    box-shadow: var(--shadow);
    transition: var(--transition);
    text-decoration: none;
    display: block;
    color: var(--text);
}

.tool-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-3px);
    color: var(--primary);
}

.tool-card i.material-icons {
    font-size: 2.4rem;
    color: var(--primary);
    margin-bottom: 8px;
    display: block;
}

/* ── Result conversion table (mini) ────────────────────────── */
.result-mini-table { margin-top: 12px; }

.result-mini-table table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.result-mini-table th {
    background: rgba(0,137,123,.15);
    padding: 6px 10px;
    color: var(--primary-dark);
    font-weight: 600;
}

.result-mini-table td {
    padding: 5px 10px;
    border-bottom: 1px solid #e0f2f1;
}

.result-mini-table tr.current td {
    background: rgba(0,137,123,.1);
    font-weight: 600;
}

/* ── Result highlight box ───────────────────────────────────── */
.result-highlight {
    background: linear-gradient(135deg, #00897b, #26a69a);
    border-radius: var(--radius);
    padding: 24px;
    text-align: center;
    color: #fff;
    margin-bottom: 24px;
}

.result-highlight .result-value {
    font-size: 3rem;
    font-weight: 700;
    display: block;
    line-height: 1.2;
}

.result-highlight .result-unit {
    font-size: 1.1rem;
    opacity: 0.85;
    display: block;
    margin-top: 4px;
}

.result-highlight .result-formula {
    font-size: 0.9rem;
    opacity: 0.75;
    margin-top: 10px;
    font-family: monospace;
}

/* ── Cookie Consent ─────────────────────────────────────────── */
.cookie-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #263238;
    color: #eceff1;
    padding: 14px 20px;
    z-index: 9999;
    box-shadow: 0 -2px 10px rgba(0,0,0,.25);
}

.cookie-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    font-size: 0.88rem;
}

.cookie-content a { color: #80cbc4; }

/* ── Footer ─────────────────────────────────────────────────── */
.page-footer { flex-shrink: 0; }

.page-footer ul { list-style: none !important; padding: 0 !important; }

/* ── Materialize overrides ──────────────────────────────────── */
input:not([type]), input[type=text], input[type=number], input[type=email],
input[type=password], input[type=url], textarea.materialize-textarea {
    font-family: 'Poppins', sans-serif !important;
}

.btn, .btn-large {
    font-family: 'Poppins', sans-serif !important;
    font-weight: 600 !important;
    letter-spacing: 0.3px !important;
    border-radius: var(--radius) !important;
}

select { font-family: 'Poppins', sans-serif !important; }

/* ── Quick conversions grid ─────────────────────────────────── */
.quick-conv-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 10px;
    margin-top: 16px;
}

.quick-conv-item {
    background: #fff;
    border-radius: var(--radius);
    padding: 12px 10px;
    text-align: center;
    box-shadow: var(--shadow);
    text-decoration: none;
    color: var(--text);
    transition: var(--transition);
    border-top: 2px solid var(--primary-light);
    font-size: 0.88rem;
}

.quick-conv-item:hover {
    background: #e0f2f1;
    color: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.quick-conv-item .qc-grams {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--primary);
    display: block;
}

/* ── Admin styles ────────────────────────────────────────────── */
.admin-sidebar {
    width: 240px;
    position: fixed;
    top: 0; left: 0;
    height: 100vh;
    overflow-y: auto;
    z-index: 100;
    transition: var(--transition);
}

.admin-content {
    margin-left: 240px;
    padding: 24px;
    min-height: 100vh;
}

@media (max-width: 992px) {
    .admin-sidebar { display: none; }
    .admin-content { margin-left: 0; }
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    color: rgba(255,255,255,.82);
    text-decoration: none;
    border-left: 3px solid transparent;
    transition: var(--transition);
    font-size: 0.9rem;
    font-weight: 500;
}

.sidebar-link:hover, .sidebar-link.active {
    background: rgba(255,255,255,.12);
    color: #fff;
    border-left-color: #fff;
}

.sidebar-brand {
    padding: 20px 20px 14px;
    font-size: 1.1rem;
    font-weight: 700;
    color: #fff;
    border-bottom: 1px solid rgba(255,255,255,.15);
    margin-bottom: 8px;
}

.stat-card {
    background: #fff;
    border-radius: var(--radius);
    padding: 20px 24px;
    box-shadow: var(--shadow);
    border-left: 4px solid var(--primary);
}

.stat-card .stat-value {
    font-size: 2.2rem;
    font-weight: 700;
    color: var(--primary);
    display: block;
}

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

.flash-message {
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 20px;
    font-weight: 500;
}

.flash-success { background: #e8f5e9; color: #2e7d32; border-left: 4px solid #4caf50; }
.flash-error   { background: #ffebee; color: #c62828; border-left: 4px solid #f44336; }

/* ── Search result dropdown ──────────────────────────────────── */
.search-dropdown {
    position: absolute;
    background: #fff;
    box-shadow: var(--shadow-lg);
    border-radius: var(--radius);
    min-width: 320px;
    z-index: 1000;
    max-height: 380px;
    overflow-y: auto;
    top: 100%;
    left: 0;
}

.search-result-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    text-decoration: none;
    color: var(--text);
    border-bottom: 1px solid #f5f5f5;
    transition: var(--transition);
    font-size: 0.88rem;
}

.search-result-item:hover { background: #f5f5f5; color: var(--primary); }

.search-result-item i { color: var(--primary); font-size: 1.1rem; }

/* ── Responsive utilities ────────────────────────────────────── */
@media (max-width: 600px) {
    .hero-section h1 { font-size: 1.7rem !important; }
    .result-highlight .result-value { font-size: 2.2rem; }
    .section { padding: 28px 0; }
    .section-heading { font-size: 1.2rem; }
    .conversion-table th, .conversion-table td { padding: 7px 10px; font-size: 0.82rem; }
    .quick-conv-grid { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); }
}

/* ── Print ───────────────────────────────────────────────────── */
@media print {
    .nav-main, .page-footer, .cookie-banner, .calc-direction-toggle,
    #calculator-form, .related-links-grid { display: none !important; }
    .result-highlight { background: #e0f2f1 !important; color: #000 !important; }
    body { background: #fff !important; }
}
