/* public/stylesheets/style.css */

/* Import Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700&family=Poppins:wght@600;700;800&display=swap');

/* Color Palette */
:root {
    --hero-color:       #2E8B57;  /* SeaGreen */
    --highlight-color:  #98FB98;  /* PaleGreen */
    --bg-color:         #F0FFF0;  /* Honeydew */
    --text-color:       #004200;  /* Dark Green */
    --border-color:     #A2CDA2;  /* Soft Green */
    --page-bg:          #E8F5E9;  /* Light Green Tint */
    --card-bg:          #F5FBF5;  /* Off-White Green Hint */
    --error-color:      #8b0000;  /* Dark red for errors (unchanged) */
    --white:            #FFFFFF;  /* Pure white (unchanged) */
    --critical-error-color: #D8000C; /* Bright red for critical error indicators (unchanged) */
  }
/* Reset */
* {
  box-sizing: border-box;
}
html {
  font-size: 16px;
}
body {
  margin: 0;
  padding: 0;
  font-family: 'Roboto', sans-serif;
  background-color: var(--page-bg);
  color: var(--text-color);
  line-height: 1.6;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Container */
.container {
  width: 90%;
  max-width: 600px;
  margin: 40px auto;
  padding: 30px;
  background-color: var(--card-bg);
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.05);
  flex-grow: 1;
  position: relative;
}

@media (min-width: 1024px) {
  .container {
    max-width: 800px;
  }
}
.container.rating-container,
.thank-you-container,
.signin-container,
.signup-form {
  text-align: center;
}
.thank-you-container {
  padding: 20px 0;
}

.done-container h1 {
  color: var(--hero-color);
}

/* Rating Page Heading */
.container.rating-container h1 {
  font-family: 'Poppins', sans-serif;
  font-weight: 800;
  font-size: 2.5rem;
  color: var(--hero-color);
  margin-bottom: 1rem;
  text-shadow: 1px 1px 2px rgba(0,0,0,0.05);
}
.container.rating-container h1::after {
  content: '';
  display: block;
  width: 40px;
  height: 3px;
  background-color: var(--hero-color);
  margin: 8px auto 0;
  border-radius: 2px;
}

/* Global Headings */
h2 {
  font-size: 1.75rem;
  margin-bottom: 1rem;
}
h3 {
  font-size: 1.5rem;
  margin-bottom: 1rem;
}

/* Hero Section */
.hero {
  background: linear-gradient(135deg, #F0FFF0, #D8EAD8); /* Honeydew to a soft green */
  padding: 60px 20px;
  text-align: center;
  border-radius: 8px;
  animation: fadeIn 0.8s ease-out both;
  margin-bottom: 60px;
}
.hero--small {
    padding: 8x 12px;      /* half of 60px top/bottom */
    margin-bottom: 8px;     /* half of 60px */
}
.hero--small .hero-title {
  font-size: 2.0rem;
}
.hero--small .hero-subtitle {
  font-size: 0.90rem;
}

@media (max-width: 767px) {
  .container {
    padding: 25px;
    margin: 30px auto;
  }
  .hero--small {
    padding-top: 12px;
    padding-bottom: 12px; /* Typo fixed */
    margin-bottom: 12px;
  }
  .hero--small .hero-title {
    font-size: 2.0rem;
  }
  .hero--small .hero-subtitle {
    font-size: 0.90rem;
  }
  .current-name {
    font-size: 1.8rem; /* Further reduce font size for very small screens */
    margin-bottom: 0.75em; /* Further adjust margin */
  }
  /* Styles for .rating-form and .rating-button in 320px are here */
}

/* Consolidated styles for screen widths up to 480px */
@media (max-width: 480px) {
  .container {
    width: 95%;
    padding: 20px;
    margin: 20px auto; /* Optionally reduce top/bottom margin too */
  }
  .hero--small {
    padding-top: 8px;
    padding-bottom: 8px;
    margin-bottom: 8px;
  }
  .hero--small .hero-title {
    font-size: 1.5rem;
  }
  .hero--small .hero-subtitle {
    font-size: 0.8rem;
  }
  .current-name {
    font-size: 2.2rem; /* Reduced from 3rem */
    margin-bottom: 1em; /* Adjusted from 1.5em for tighter spacing */
  }
  .rear-view {
    font-size: 0.85rem;
    margin-bottom: 10px;
  }
  .rater-info {
    font-size: 0.85rem;
    margin-top: 15px;
  }
  .rater-info a {
    padding: 7px 10px; /* Slightly reduce padding for smaller links */
    margin: 4px;
  }
}

/* Styles for elements on Rating Page */
.rear-view {
  font-size: 0.9rem;
  margin-bottom: 15px;
  color: var(--text-color);
  word-wrap: break-word; /* Ensure long text wraps */
}

.rater-info {
  font-size: 0.9rem;
  margin-top: 20px;
  margin-bottom: 15px; /* Added for spacing below */
}

.rater-info p { /* Assuming the text/links might be in a p tag */
  margin-bottom: 0.5em;
}

.rater-info a {
  display: inline-block;
  padding: 8px 12px;
  margin: 5px;
  text-decoration: underline;
  color: var(--hero-color); /* Ensure link color consistency */
  border-radius: 4px; /* Slight rounding for better tap target feel */
  transition: background-color 0.2s ease;
}

.rater-info a:hover {
  background-color: var(--highlight-color);
  text-decoration: none; /* Remove underline on hover if bg changes */
}


.hero-title {
  font-family: 'Poppins', sans-serif;
  font-weight: 800;
  font-size: 3rem;
  color: var(--hero-color);
  margin-bottom: 0.5em;
}
.hero-subtitle {
  font-size: 1.25rem;
  max-width: 700px;
  margin: 0 auto 1.5em;
}

/* Section Divider */
.section-divider {
  border: none;
  border-top: 1px dashed var(--border-color);
  margin: 60px auto;
  width: 60%;
}

/* Alternate Background */
.alt-bg {
  background-color: var(--page-bg);
  padding: 40px 20px;
  border-radius: 8px;
  margin-bottom: 40px;
}

/* Steps Layout */
.steps {
  display: flex;
  flex-direction: column;
  gap: 2rem;
  margin: 20px auto;
  max-width: 600px;
}
.step {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
}
.step-icon {
  width: 2.5rem;
  height: 2.5rem;
  stroke: var(--hero-color);
  fill: none;
  stroke-width: 2;
  flex-shrink: 0;
  margin-top: 0.1em;
}
.step-text h3 {
  margin: 0 0 0.3em;
  font-size: 1.1rem;
  color: var(--text-color);
}
.step-text p {
  margin: 0;
  font-size: 1rem;
}
@media (min-width: 768px) {
  .how-it-works .steps {
    flex-direction: row;
    justify-content: space-around;
    gap: 1rem;
    max-width: none;
  }
  .how-it-works .step {
    flex-direction: column;
    align-items: center;
    text-align: center;
    flex-basis: 23%;
    gap: 0.75rem;
  }
  .how-it-works .step-icon {
    margin-top: 0;
  }
  .how-it-works h2 {
    text-align: center;
  }
}

/* “Current Name” Pill */
.current-name {
  font-family: 'Poppins', sans-serif;
  font-weight: 700;
  font-size: 3rem;
  display: inline-block;
  background-color: var(--highlight-color);
  color: var(--hero-color);
  padding: 0.25em 0.6em;
  border-radius: 999px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.05);
  margin: 0.5em auto 1.5em;
  animation: popInName 0.5s ease-out both;
}

/* Paragraphs & Text */
p {
  margin: 0 0 1em;
}
.subtitle {
  font-size: 1.05rem;
  margin-bottom: 25px;
  color: var(--text-color);
}

/* Links */
a {
  color: var(--hero-color);
  text-decoration: none;
  transition: text-decoration 0.2s ease;
}
a:hover {
  text-decoration: underline;
}

/* Form Elements */
.form-group {
  margin-bottom: 20px;
}
.form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
}
input[type="text"],
input[type="email"],
input[type="password"],
select {
  width: 100%;
  padding: 10px 15px;
  border: 1px solid var(--border-color);
  border-radius: 5px;
  font-size: 1rem;
  font-family: inherit;
  margin-bottom: 15px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
input:focus,
select:focus {
  outline: none;
  border-color: var(--hero-color);
  box-shadow: 0 0 0 3px rgba(46, 139, 87, 0.25); /* Updated to hero-color (SeaGreen) with alpha */
}
::placeholder {
  color: #999;
}

/* Checkbox Groups */
.form-group-checkbox {
  display: flex;
  align-items: center;
  margin-bottom: 25px;
}
.form-group-checkbox input[type="checkbox"] {
  margin-right: 10px;
  width: 1.1em;
  height: 1.1em;
}

/* Error Messages */
.error-summary {
  background-color: var(--bg-color);
  border-left: 5px solid var(--hero-color);
  color: var(--error-color);
  padding: 16px 20px;
  border-radius: 6px;
  margin-bottom: 24px;
}
.error-summary h3 {
  margin: 0 0 0.5em;
}
.error-summary ul {
  margin: 0.5em 0 0 1.2em;
}
.error-message {
  background-color: var(--bg-color);
  border: 1px solid var(--hero-color);
  color: var(--error-color);
  padding: 10px 14px;
  border-radius: 4px;
  margin: 6px 0;
  font-size: 0.95rem;
}
input.input-error {
  border-color: var(--error-color) !important;
  box-shadow: 0 0 0 1px var(--error-color);
}

/* === BUTTONS === */

/* Base Button Styles */
button,
.btn {
  font-family: inherit;
  border-radius: 5px;
  cursor: pointer;
  display: inline-block;
  text-align: center;
  font-weight: 500;
  line-height: 1.5;
  padding: 0.6rem 1.2rem;
  font-size: 1rem;
  text-decoration: none;
  border: 1px solid transparent;
  transition: background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
}

/* Primary Action Button Style */
.btn-primary {
  background-color: var(--hero-color);
  color: var(--white);
  border-color: var(--hero-color);
  padding: 0.75rem 1.5rem;
  font-size: 1.1rem;
  font-weight: 600;
}

.btn-primary:hover {
  background-color: #256d42;
  border-color: #205d38;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0,0,0,0.1);
  text-decoration: none;
  color: var(--white);
}

.btn-primary:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(46, 139, 87, 0.35);
}

.btn-primary:active {
  background-color: #205d38;
  border-color: #1b4e2f;
  transform: translateY(0);
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Rating Buttons */
.rating-button {
  background-color: var(--hero-color);
  color: var(--white);
  border: none;
  font-weight: 600;
  width: 100%;
  max-width: 280px;
  padding: 0.9rem 0;
  border-radius: 8px;
  font-size: 1.1rem;
  box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.rating-button:hover {
  box-shadow: 0 6px 12px rgba(0,0,0,0.15);
  transform: translateY(-2px);
}

.rating-button:active {
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  transform: translateY(0);
  opacity: 0.9;
}

.rating-form .rating-button {
  /* This selector is kept for specificity if .rating-button styles need to be different ONLY within .rating-form */
  /* However, most styles are now on .rating-button directly. */
}

@media (max-width: 320px) {
  .rating-form .rating-button {
    padding: 0.7rem 0;
    font-size: 1rem;
  }
}

/* Sign-in Button */
.signin-button {
  background-color: var(--hero-color);
  color: var(--white);
  border: none;
  font-weight: 600;
  padding: 0.9375rem 1.875rem; /* 15px 30px */
  font-size: 1.2rem;
  min-width: 180px;
}

.signin-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.signin-button.secondary:hover {
  background-color: var(--hero-color);
}

/* "Buy Me a Coffee" Button */
.bmc-btn {
  padding: 0.6rem 1.4rem;
  background-color: var(--highlight-color);
  color: #333;
  border-color: var(--highlight-color);
  border-radius: 6px;
  font-weight: 600;
}

.bmc-btn:hover {
  background-color: #88e888;
  border-color: #78d878;
  color: #333;
  text-decoration: none;
}

/* --- End of Button Section --- */

/* Support Section */
.support {
  text-align: center;
  padding: 40px 20px;
  border-top: 1px solid var(--border-color);
  margin-top: 40px;
}

/* Link Section */
.link-section {
  margin: 30px 0;
  padding: 25px;
  background-color: var(--page-bg);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}
.link-label {
  font-weight: 500;
  display: block;
  margin-bottom: 15px;
}
.unique-link-display {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 15px;
}
.instructions {
  margin-top: 30px;
  font-size: 1.05rem;
  line-height: 1.6;
}
.instructions ul {
  list-style: none;
  padding: 0;
}

/* Footer */
footer {
  width: 100%;
  padding: 20px 0;
  text-align: center;
  background-color: var(--white);
  border-top: 1px solid var(--border-color);
  margin-top: auto;
}
.footer-links {
  display: flex;
  justify-content: center;
  gap: 2rem;
  margin-bottom: 0.5em;
}
.footer-links a {
  color: var(--text-color);
  font-size: 0.95rem;
}
.footer-links a:hover {
  text-decoration: underline;
}
.footer-copy {
  font-size: 0.85rem;
  color: var(--text-color);
}

/* Utilities */
.text-center {
  text-align: center;
}
.honeypot {
  display: none !important;
}

/* Toast Modal */
.toast-modal {
  position: fixed;
  top: 1rem;
  left: 50%;
  transform: translateX(-50%) translateY(-200%);
  background-color: var(--white);
  padding: 1rem 1.5rem;
  border-radius: 0.5rem;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  transition: transform 0.4s ease-out;
  z-index: 1000;
}
.toast-modal.show {
  transform: translateX(-50%) translateY(0);
}

/* Animations */
@keyframes fadeInDown {
  from { opacity: 0; transform: translateY(-20px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes popInName {
  from { opacity: 0; transform: scale(0.8); }
  to   { opacity: 1; transform: scale(1); }
}

/* Utility class to disable animations */
.no-animation {
  animation: none !important;
}

/* --- Sign-in Page --- */

/* .signin-container styling moved to common rule */
  
  .signin-options {
    margin-top: 30px;
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
  }
  
  /* .signin-button is now defined in the new Button CSS structure */
  
  .signin-note {
    margin-top: 30px;
    font-size: 0.9rem;
    color: #777;
  }
/* --- Thank You Page --- */

.thank-you-container {
    background-color: var(--card-bg); /* Simplified from linear-gradient */
    box-shadow: 0 6px 20px rgba(0,0,0,0.1);
    padding: 40px 20px;
  }

  .thank-you-container .link-section {
    background-color: var(--card-bg); /* Override from default .link-section */
    /* border: 1px solid var(--border-color); */ /* Already in global .link-section */
    max-width: 90%; /* Specific to thank-you page version */
    margin: 30px auto; /* Specific to thank-you page version, global is 30px 0 */
  }

  .thank-you-container .unique-link {
    background-color: var(--white);
    padding: 0.5rem 0.75rem;
    border-radius: 4px;
    display: inline-block;
    margin-right: 0.5rem;
  }
  
  .success-icon,
  .error-icon {
    width: 3rem;
    height: 3rem;
    margin: 0 auto 15px;
    display: block;
    flex-shrink: 0;
  }
  
  .success-icon {
    stroke: var(--hero-color);
    fill: none;
  }
  
  .error-icon {
    stroke: var(--critical-error-color);
    fill: none;
  }
  
  .error-page-title {
    color: var(--critical-error-color);
  }
  
/* 
  .link-section { // This was a redundant/conflicting definition
    margin: 30px auto;
    padding: 25px;
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    max-width: 90%;
  }
*/
  
  .thank-you-container .instructions {
    margin: 30px auto;
    text-align: center;
  }
  
  .thank-you-container .instructions ul {
    display: inline-block;
    text-align: left;
    /* padding: 0; already in global .instructions ul */
    margin: 0;
    /* list-style: none; already in global .instructions ul */
  }
  
  .thank-you-container .instructions li {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
    font-size: 1.05rem; /* Corrected from em to rem */
    color: var(--text-color); /* Corrected from --accent-color */
  }
  
  .thank-you-container .instructions li .step-icon {
    width: 1.5rem;
    height: 1.5rem;
    stroke: var(--hero-color);
    fill: none; /* Added from global .step-icon for consistency */
    stroke-width: 2; /* Added from global .step-icon for consistency */
    flex-shrink: 0;
  }
  
  /* The global .step-icon rule is defined earlier and remains unchanged for other contexts */
  
  .signup-form {
    /* text-align: center; */ /* Moved to common rule */
  }
  
  .signup-form .form-group {
    max-width: 500px;
    margin: 0 auto 1.5em;
    text-align: left;
  }

  .signup-form .form-text {
    font-style: italic;
    font-size: 92%;
  }
  
  .signup-form .form-actions {
    display: flex;
    justify-content: center;
  }
  
  .signup-form .form-text.checkbox-note {
    display: block;
    margin-top: 0.5em;
  }

/* IoT Log Page Styles */
/* Selector changed to be generic */
.table-responsive-wrapper {
  overflow-x: auto;
  width: 100%; /* Ensure it tries to use available width */
  margin: 0 auto; /* Center the table wrapper if page is wider */
  max-width: 1200px; /* Optional: constrain max width for very wide screens */
}

body.iot-logs-page {
  font-family: 'Roboto', sans-serif; /* Consistent font with the rest of the site */
  margin: 2em; /* Specific margin for this page */
  background-color: var(--page-bg); /* Ensure page background is consistent */
  color: var(--text-color); /* Ensure text color is consistent */
}

.iot-logs-page h1 {
  font-family: 'Poppins', sans-serif; /* Consistent heading font */
  color: var(--hero-color);
  text-align: center;
  margin-bottom: 1.5em; /* Space below heading */
  font-size: 2.2rem; /* Adjust size as needed */
}

.iot-logs-page table {
  border-collapse: collapse;
  width: 100%;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05); /* Subtle shadow for the table */
}

.iot-logs-page th,
.iot-logs-page td {
  border: 1px solid var(--border-color); /* Themed border */
  padding: 0.75em 0.75em; /* Increased padding for better readability */
  text-align: right;
  vertical-align: middle; /* Align text vertically in the middle */
}

.iot-logs-page th {
  background-color: var(--bg-color); /* Themed background for header */
  font-weight: 600; /* Emphasize header text */
  border-bottom: 2px solid var(--border-color); /* Stronger border for header row */
  color: var(--text-color); /* Ensure good contrast */
}

/* Align "Logged At" column to the left */
.iot-logs-page th:first-child,
.iot-logs-page td:first-child {
  text-align: left;
}

/* View Ratings Page Specific Styles */
.view-ratings-form-actions {
  margin-top: 30px;
  justify-content: center;
  display: flex;
  gap: 10px;
}

/* EJS Error Page Specific Styles */
body.error-page-ejs {
  font-family: Arial, sans-serif; /* Specific font for this page */
  margin: 40px; /* Specific margin for this page */
  /* Inherits other global body styles like background-color, color from style.css */
}

.error-page-ejs h1 {
  color: var(--critical-error-color); /* Themed error color */
}

.error-page-ejs pre {
  background-color: var(--card-bg); /* Themed background */
  border: 1px solid var(--border-color); /* Themed border */
  padding: 10px;
  overflow-x: auto; /* Added */
  white-space: pre-wrap; /* Added */
  word-break: break-all; /* Added */
}

/* Styles for content pages (FAQ, Privacy, Contact) */
/* General .container h1, h2, p styles are designed to be overridden by more specific ones if needed */
.container h1 {
  margin-bottom: 20px; /* Add some space below the main heading */
}

.container h2 {
  margin-top: 30px; /* Add space above section headings */
  margin-bottom: 15px; /* Add space below section headings */
}

.container p {
  line-height: 1.6; /* Improve readability of paragraphs */
  margin-bottom: 15px; /* Add space below paragraphs, global is 1em, this is similar */
}

/* General list styling within .container */
.container ul {
  list-style-position: inside;
  padding-left: 20px; /* Indent lists */
  margin-bottom: 15px; /* Add space below lists */
}

.container ul li {
  margin-bottom: 8px; /* Space out list items */
}

/* Links within .container will use the global hero color for consistency */
.container a {
  color: var(--hero-color); /* Match existing global link color */
  /* text-decoration: none; is global */
}

/* .container a:hover is covered by global a:hover */