/* |--------------------------------------------------------------------------
| BASE WEBSITE STYLES (css/style.css)
|--------------------------------------------------------------------------
| This file contains global variables, core layout, and universal component
| styling used across the entire CheckBodyScore website (homepage, calculators, etc.).
*/

/* --- GLOBAL COLOR AND TYPOGRAPHY DEFINITIONS --- */
:root {
    --font-family: 'Inter', sans-serif;
    --primary-color: #ff5d5d; /* FINALIZED Primary Color: Red */
    --primary-gradient: linear-gradient(90deg, #ff5d5d 0%, #ff8a8a 100%);
    --bg-color: #f4f7f9; 
    --card-bg-color: #ffffff; 
    --text-color: #212529; 
    --text-color-light: #6c757d;
    --border-color: #dee2e6; 
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.1); /* Slightly refined universal shadow */
    --radius: 8px;
    --transition: all 0.3s ease;
    --category-bg: rgba(255, 93, 93, 0.08); /* Light background using primary color tint */
}
body.dark-mode {
    --primary-color: #ff8a8a; /* Slightly lighter red for dark mode contrast */
    --primary-gradient: linear-gradient(90deg, #ff5d5d 0%, #ff8a8a 100%);
    --bg-color: #121212; 
    --card-bg-color: #1e1e1e; 
    --text-color: #e9ecef; 
    --text-color-light: #adb5bd;
    --border-color: #343a40; 
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    --category-bg: rgba(255, 138, 138, 0.1);
}

/* Category-specific Colors (Used on homepage) */
.category-fitness { --category-accent: #2F81F7; }
.category-nutrition { --category-accent: #3FB950; }
.category-pregnancy { --category-accent: #A371F7; }
.category-lifestyle { --category-accent: #F7B53B; }
.category-health { --category-accent: #DB61A2; }

/* --- BASE HTML AND UTILITIES --- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { font-family: var(--font-family); margin: 0; background-color: var(--bg-color); color: var(--text-color); line-height: 1.4; font-size: 15px;}
.page-container { max-width: 1400px; margin: 0 auto; padding: 1rem; }

/* --- HEADER AND NAVIGATION --- */
.main-header { background-color: var(--card-bg-color); box-shadow: var(--shadow); border-bottom: 1px solid var(--border-color); padding: 0 1rem; position: sticky; top: 0; z-index: 1000; }
.header-container { max-width: 1400px; margin: 0 auto; display: flex; justify-content: space-between; align-items: center; height: 55px; }
.logo { font-size: 1.4rem; font-weight: 700; text-decoration: none; color: var(--primary-color); display: flex; align-items: center; gap: 0.4rem; }
.logo img { height: 24px; width: auto; margin-right: 0.4rem; vertical-align: middle; } /* Logo image styling */
.header-right-items { display: flex; align-items: center; gap: 1rem; }
.main-nav ul { list-style: none; padding: 0; margin: 0; display: flex; gap: 1rem; }
.main-nav a { text-decoration: none; color: var(--text-color-light); font-weight: 500; font-size: 0.9rem; transition: var(--transition); }
.main-nav a:hover { color: var(--primary-color); }

/* --- DAY/NIGHT SLIDER --- */
.theme-switch { position: relative; display: inline-block; width: 50px; height: 26px; }
.theme-switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: #ccc; transition: .4s; border-radius: 26px; }
.slider:before { position: absolute; content: ""; height: 20px; width: 20px; left: 3px; bottom: 3px; background-color: white; transition: .4s; border-radius: 50%; }
input:checked + .slider { background-color: var(--primary-color); }
input:checked + .slider:before { transform: translateX(24px); }
.slider i { color: #f4f7f9; position: absolute; top: 50%; transform: translateY(-50%); font-size: 12px; }
.slider .fa-sun { left: 5px; opacity: 1; }
.slider .fa-moon { right: 5px; opacity: 0; }
body.dark-mode .slider .fa-sun { opacity: 0; }
body.dark-mode .slider .fa-moon { opacity: 1; }

/* --- HOMEPAGE SPECIFIC STYLES --- */
.hero-section { text-align: center; padding: 2.5rem 1rem 1.5rem 1rem; }
.hero-section h1 { font-size: 2.2rem; margin: 0 0 0.3rem 0; line-height: 1.2; color: var(--text-color); }
.hero-section .subtitle { font-size: 1.1rem; font-weight: 500; color: var(--text-color-light); margin: 0.1rem 0 1rem 0; }
.trust-badges { display: flex; justify-content: center; gap: 1rem; margin: 1rem 0; flex-wrap: wrap; }
.trust-badge { display: flex; align-items: center; gap: 0.4rem; font-size: 0.8rem; color: var(--text-color-light); font-weight: 500;}
.trust-badge i { color: var(--primary-color); font-size: 0.9rem; }

/* Layout - Sidebar + Main Grid */
.tool-launcher { display: grid; grid-template-columns: 200px 1fr; gap: 1.5rem; margin-top: 1.5rem; }

/* Sidebar Styles */
.category-sidebar ul { list-style: none; padding: 0; margin: 0; position: sticky; top: 70px; }
.category-sidebar li { padding: 0.7rem 1rem; margin-bottom: 0.4rem; border-radius: var(--radius); font-weight: 500; cursor: pointer; transition: var(--transition); background-color: var(--category-bg); font-size: 0.9rem; display: flex; align-items: center; gap: 0.6rem; }
.category-sidebar li:hover { background-color: var(--category-bg-hover); transform: scale(1.02); }
.category-sidebar li.active { background: var(--primary-color); color: white; font-weight: 700; }

/* Tool Grid Display */
.tool-grid-display { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 1rem; align-content: start; }

/* Tool Card Styles */
.tool-card { display: flex; flex-direction: column; background-color: var(--card-bg-color); padding: 1rem; border-radius: var(--radius); text-decoration: none; border: 1px solid var(--border-color); box-shadow: var(--shadow); transition: var(--transition); position: relative; height: 100%; justify-content: flex-start; }
.tool-card:hover { transform: translateY(-3px); box-shadow: 0 5px 15px rgba(0,0,0,0.1); border-color: var(--primary-color); }
.tool-card .icon-wrapper { font-size: 1.5rem; color: var(--category-accent); width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; margin-bottom: 0.75rem; border-radius: 4px; background-color: rgba(0, 86, 179, 0.05); }
.tool-card-text h3 { margin: 0; font-size: 1rem; font-weight: 600; color: var(--text-color); line-height: 1.2; }
.tool-card-text p { margin: 0.4rem 0 0 0; font-size: 0.85rem; color: var(--text-color-light); line-height: 1.3; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }

/* --- FOOTER --- */
.main-footer { padding: 3rem 0 1rem 0; border-top: 1px solid var(--border-color); margin-top: 3rem; background-color: var(--card-bg-color); }
.footer-grid { display: grid; grid-template-columns: 1.5fr repeat(5, 1fr) 1.5fr; gap: 2rem; }
.footer-column h4 { font-size: 1rem; font-weight: 700; margin: 0 0 1rem 0; color: var(--text-color); }
.footer-column ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 0.6rem; }
.footer-column ul li a { text-decoration: none; color: var(--text-color-light); font-size: 0.9rem; transition: var(--transition); }
.footer-column ul li a:hover { color: var(--primary-color); }
.footer-bottom { text-align: center; margin-top: 2rem; padding-top: 1.5rem; border-top: 1px solid var(--border-color); font-size: 0.85rem; color: var(--text-color-light); }

/* REVISED: Suggested Tools Styling for increased spacing */
.suggested-tools h4 {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 0.8rem;
    color: var(--text-color);
}
.suggestion-links {
    display: grid;
    /* Increased minimum width for better fit, adjusted gap */
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); 
    gap: 1rem; /* Increased gap */
    justify-items: center;
    margin: 0 auto;
}
.suggestion-link {
    /* ... rest of link styling remains the same ... */
    padding: 0.7rem 1rem; /* Increased padding */
}



/* |--------------------------------------------------------------------------
| RESPONSIVE LAYOUTS & FOOTER FIXES
|--------------------------------------------------------------------------
*/
@media (min-width: 1200px) {
    /* FOOTER FIX: Ensures health/fitness/nutrition/pregnancy/lifestyle/pages columns are equally spaced */
    .footer-grid {
        grid-template-columns: 1fr repeat(6, 1fr); 
    }
    .footer-column.about {
        grid-column: span 1;
    }
    .footer-column.pages {
        grid-column: span 1;
    }
    .tool-grid-display { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
}

@media (max-width: 992px) { 
    .tool-launcher { grid-template-columns: 1fr; gap: 1.5rem; } 
    .category-sidebar ul { position: relative; top: 0; display: flex; overflow-x: auto; white-space: nowrap; padding-bottom: 0.5rem; gap: 0.5rem; justify-content: flex-start; }
    .category-sidebar li { flex-shrink: 0; flex-grow: 0; width: auto; font-size: 0.85rem; padding: 0.5rem 1rem; }
    .tool-grid-display { gap: 0.75rem; }
    .footer-grid { grid-template-columns: repeat(3, 1fr); } 
    .footer-column.about, .footer-column.pages { grid-column: span 3; }
}
@media (max-width: 768px) { 
    .footer-grid { grid-template-columns: repeat(2, 1fr); } 
}
@media (max-width: 576px) { 
    .hero-section h1 { font-size: 1.8rem; } 
    .tool-grid-display { grid-template-columns: repeat(2, 1fr); gap: 0.5rem; } 
    .tool-card { padding: 0.75rem; } 
    .tool-card-text p { -webkit-line-clamp: 1; } 
    .footer-grid { grid-template-columns: 1fr; } 
}

/* === GLOBAL RESET === */
html, body {
  width: 100%;
  margin: 0;
  padding: 0;
  overflow-x: hidden;
  box-sizing: border-box;
}

*, *::before, *::after {
  box-sizing: inherit;
}

/* === HEADER CONTAINER (same layout, just sticky & spaced) === */
.header-container {
  position: sticky;        /* ✅ keeps header visible on scroll */
  top: 0;
  z-index: 999;            /* ✅ stays above content */
  width: 100%;
  max-width: 100%;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  height: auto;
  padding: 10px 15px;      /* ✅ slightly increased for better breathing space */
  background-color: #fff;  /* ✅ maintain white background */
  box-shadow: 0 1px 4px rgba(0,0,0,0.1); /* subtle depth */
}

/* === CHILD ELEMENTS (same as before) === */
.header-container > * {
  flex-shrink: 1;
  max-width: 100%;
  overflow: hidden;
}

/* === LOGO (keeps proportions, small margin) === */
.header-container .logo img {
  max-height: 48px;
  height: auto;
  width: auto;
  display: block;
}

/* === NAVIGATION === */
.header-container nav {
  flex: 1 1 auto;
  text-align: right;
  min-width: 0;
}

/* === THEME TOGGLE / DAY-NIGHT SLIDER === */
.theme-toggle {
  margin-left: 15px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 4px;
}

/* === MOBILE VIEW === */
@media (max-width: 768px) {
  .header-container {
    flex-direction: column;
    align-items: flex-start;
    padding: 10px 15px;
  }

  .header-container nav {
    width: 100%;
    text-align: left;
    margin-top: 8px;
  }

  .theme-toggle {
    margin-top: 10px;
  }
}


        /* Responsive adjustments */

        /* Rule for TABLETS & LARGE PHONES: 2 columns */
        @media (max-width: 768px) {
            .suggestion-links {
                grid-template-columns: repeat(2, 1fr);
            }
        }
        
        /* Rule for SMALL PHONES: 1 column */
        @media (max-width: 480px) {
             .suggestion-links {
                grid-template-columns: 1fr;
            }
        }
        
        
        
        /* MAKE SURE THIS IS THE ONLY .suggestion-links STYLE */

.suggestion-links {
    display: grid;
    /* Base rule for DESKTOP: 4 columns */
    grid-template-columns: repeat(4, 1fr); 
    gap: 1rem;
    justify-items: center;
    margin: 0 auto;
}

/* Rule for TABLETS & LARGE PHONES: 2 columns */
@media (max-width: 768px) {
    .suggestion-links {
        grid-template-columns: repeat(2, 1fr);
    }
}
 
/* Rule for SMALL PHONES: 1 column */
@media (max-width: 480px) {
    .suggestion-links {
        grid-template-columns: 1fr;
    }
}
