:root {
  --background-color: #ffffff;
  --text-color: #333333;
  --primary-color: #4a90e2;
  --header-bg: #f8f9fa;
  --footer-bg: #343a40;
  --footer-text: #ffffff;
  --input-background: #ffffff;
  --input-border: #cccccc;
  --subtle-bg: #f1f3f5;
  --card-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

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

a {
  color: var(--primary-color);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

.container {
  width: 90%;
  max-width: 1200px; /* Increased max-width for grid layout */
  margin: 0 auto;
  padding: 20px 0;
}

/* Header */
header {
  background-color: var(--header-bg);
  border-bottom: 1px solid var(--input-border);
  padding: 0 20px;
}

header .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 0;
}

.logo {
  font-size: 1.5rem;
  font-weight: bold;
  color: var(--primary-color);
}
.logo:hover {
  text-decoration: none;
}

header nav a {
  color: var(--text-color);
  margin-left: 20px;
  transition: color 0.2s;
}

header nav a:hover {
  color: var(--primary-color);
  text-decoration: none;
}

/* Main Content */
main {
  flex: 1;
}

/* Footer */
footer {
  background-color: var(--footer-bg);
  color: var(--footer-text);
  padding: 20px;
  margin-top: 40px;
}

footer .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

footer nav a {
  color: var(--footer-text);
  margin-left: 20px;
}

/* Homepage specific */
.hero {
  text-align: center;
  padding: 40px 0;
}
.hero h1 {
  font-size: 2.5rem;
}

.cta-button {
  display: inline-block;
  background-color: var(--primary-color);
  color: white;
  padding: 15px 30px;
  border-radius: 5px;
  text-decoration: none;
  font-size: 1.2rem;
  margin-top: 20px;
  transition: background-color 0.2s;
}
.cta-button:hover {
  background-color: #357abd;
  color: white;
  text-decoration: none;
}

/* Form Styles & Inputs */
form {
  display: flex;
  flex-direction: column;
  gap: 15px;
}
form label {
  font-weight: bold;
}
form input[type="text"],
form input[type="email"],
form textarea,
#image-upload {
  padding: 12px;
  border: 1px solid var(--input-border);
  border-radius: 5px;
  background-color: var(--input-background);
  color: var(--text-color);
  font-size: 1rem;
}
#image-preview {
  margin-top: 20px;
  min-height: 200px;
  border: 2px dashed var(--input-border);
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 10px;
}
#image-preview img {
  max-width: 100%;
  max-height: 400px;
  border-radius: 5px;
}

button, #predict-button, #start-button {
  cursor: pointer;
  padding: 12px 20px;
  border-radius: 5px;
  border: 1px solid var(--primary-color);
  background-color: var(--primary-color);
  color: white;
  font-size: 1rem;
}
button:disabled {
  background-color: #ccc;
  border-color: #ccc;
  cursor: not-allowed;
}

/* Ads */
.adsense-ad {
  min-height: 100px;
  margin: 40px auto;
  background-color: var(--subtle-bg);
  display: flex;
  justify-content: center;
  align-items: center;
  text-align: center;
  color: var(--text-color);
  font-size: 0.9rem;
  max-width: 728px;
}

/* Blog Styles */
.page-header {
  text-align: center;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--input-border);
}

.blog-post {
  line-height: 1.8;
  max-width: 800px;
  margin: 0 auto;
}
.blog-header {
  text-align: center;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--input-border);
  margin-bottom: 30px;
}
.byline {
  color: #6c757d;
  font-style: italic;
}
.post-image {
    width: 100%;
    max-height: 400px;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 30px;
}
.blog-post h2 {
  margin-top: 40px;
}

/* THUMBNAIL/GRID STYLES */
.blog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 30px;
}
.blog-card {
  background: var(--subtle-bg);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: var(--card-shadow);
  display: flex;
  flex-direction: column;
}
.blog-card img {
  width: 100%;
  height: 200px;
  object-fit: cover;
}
.blog-card .card-content {
  padding: 20px;
  flex: 1;
  display: flex;
  flex-direction: column;
}
.blog-card h2 {
  margin-top: 0;
  font-size: 1.25rem;
}
.blog-card h2 a {
  color: var(--text-color);
  text-decoration: none;
}
.blog-card h2 a:hover {
  color: var(--primary-color);
}
.card-content p {
  flex-grow: 1;
}

/* Homepage Blog Section */
.latest-posts {
  margin-top: 60px;
  padding-top: 40px;
  border-top: 1px solid var(--input-border);
}
.latest-posts h2 {
  text-align: center;
  margin-bottom: 40px;
}
.post-previews {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 30px;
}
.preview {
  background: var(--subtle-bg);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: var(--card-shadow);
  display: flex;
  flex-direction: column;
}
.preview img {
  width: 100%;
  height: 180px;
  object-fit: cover;
}
.preview h3 {
    margin: 0;
}
.preview h3 a {
  color: var(--text-color);
  text-decoration: none;
}
.preview > div {
    padding: 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
}
.preview p {
    flex-grow: 1;
}

.blog-link-container {
  text-align: center;
  margin-top: 40px;
}


/* Responsive */
@media (max-width: 768px) {
  header .container, footer .container {
    flex-direction: column;
    gap: 15px;
  }
}