/* ===== BASE STYLES ===== */
:root {
  /* Header & Footer Colors */
  --header-bg-start: #3f51b5; /* Deeper blue for gradient start */
  --header-bg-end: #673ab7;   /* Purple for gradient end */
  --header-text-color: #ffffff;
  --footer-bg-color: #2c3e50; /* Dark blue-grey */
  --footer-text-color: #cccccc;
  --footer-link-color: #eeeeee;

  /* Specific to Passport Photo Maker Page */
  --body-bg-gradient-start: #667eea;
  --body-bg-gradient-end: #764ba2;
  --body-text-color: #333;
  --header-bg: #fff; /* For page header */
  --header-shadow: rgba(0, 0, 0, 0.1);
  --upload-border: #4a90e2;
  --upload-bg: #fff;
  --upload-icon-color: #4a90e2;
  --upload-text-color: #333;
  --upload-subtext-color: #777;
  --preview-output-bg: #fff;
  --preview-output-shadow: rgba(0, 0, 0, 0.1);
  --image-container-bg: #f1f1f1;
  --canvas-border: #ddd;
  --btn-default-bg: #4a90e2;
  --btn-default-hover-bg: #357ABD;
  --btn-blue-bg: #007bff; /* Specific blue button */

  /* Section specific colors */
  --section-bg: #ffffff;
  --section-shadow: rgba(0, 0, 0, 0.08);
  --section-h2-color: #1c3d5a;
  --section-p-color: #333333;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Segoe UI', sans-serif;
  background: linear-gradient(135deg, var(--body-bg-gradient-start), var(--body-bg-gradient-end));
  color: var(--body-text-color);
  min-height: 100vh;
  display: flex;
  flex-direction: column; /* Stack header, main, footer vertically */
}

/* ===== HEADER STYLES ===== */
.main-header {
  background: linear-gradient(135deg, var(--header-bg-start), var(--header-bg-end));
  padding: 15px 30px;
  color: var(--header-text-color);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
  position: sticky;
  top: 0;
  z-index: 1000;
  width: 100%;
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 1200px;
  margin: 0 auto;
}

.logo-section {
  display: flex;
  align-items: center;
}

.header-logo-img {
  width: 40px;
  height: 40px;
  margin-right: 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.918);
  padding: 2px;
}

.site-title {
  font-size: 24px;
  font-weight: bold;
}

.main-nav ul {
  list-style: none;
  display: flex;
  gap: 25px;
}

.main-nav ul li a {
  color: var(--header-text-color);
  text-decoration: none;
  font-size: 17px;
  font-weight: 500;
  transition: opacity 0.3s ease;
}

.main-nav ul li a:hover {
  opacity: 0.8;
}

.hamburger-menu {
  display: none;
  flex-direction: column;
  cursor: pointer;
  gap: 6px;
}

.hamburger-menu .bar {
  width: 25px;
  height: 3px;
  background-color: var(--header-text-color);
  border-radius: 2px;
  transition: all 0.3s ease;
}

.mobile-nav {
  display: none;
  background: var(--header-bg-end);
  width: 100%;
  position: absolute;
  top: 70px; /* Height of header + padding */
  left: 0;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
  transform: translateY(-100%);
  transition: transform 0.3s ease-in-out;
  z-index: 999;
}

.mobile-nav.active {
  display: block;
  transform: translateY(0);
}

.mobile-nav ul {
  list-style: none;
  padding: 10px 0;
  text-align: center;
}

.mobile-nav ul li {
  padding: 12px 20px;
}

.mobile-nav ul li a {
  color: var(--header-text-color);
  text-decoration: none;
  font-size: 18px;
  display: block;
}

.mobile-nav ul li a:hover {
  background-color: rgba(255, 255, 255, 0.1);
  border-radius: 5px;
}

/* Hamburger animation */
.hamburger-menu.active .bar:nth-child(1) {
  transform: translateY(9px) rotate(45deg);
}
.hamburger-menu.active .bar:nth-child(2) {
  opacity: 0;
}
.hamburger-menu.active .bar:nth-child(3) {
  transform: translateY(-9px) rotate(-45deg);
}

/* ===== MAIN CONTENT WRAPPER ===== */
.content-wrapper {
  flex-grow: 1; /* Allows main content to take available space */
  width: 100%;
  max-width: 1200px; /* Consistent max-width for main content */
  margin: 0 auto; /* Center the wrapper */
  padding: 20px; /* Overall padding for the content area */
  display: flex;
  flex-direction: column;
  align-items: center; /* Center the container and sections */
  box-sizing: border-box;
}

/* ===== CONTAINER STYLES (for the tool itself) ===== */
.container {
  width: 100%; /* Take full width of content-wrapper */
  max-width: 900px; /* Adjust max-width as needed for the tool */
  margin-bottom: 2rem; /* Space before sections */
}

.page-header { /* Renamed from .header to avoid conflict */
  text-align: center;
  background: var(--header-bg);
  padding: 30px;
  border-radius: 20px;
  box-shadow: 0 10px 30px var(--header-shadow);
  margin-bottom: 20px; /* Added space below header */
}

.page-header h1 {
  margin-bottom: 10px;
  color: var(--section-h2-color); /* Use consistent color for headings */
}

.page-header p {
  color: var(--section-p-color); /* Use consistent color for text */
}

.upload-section {
  width: 100%; /* Ensure section takes full width */
}

.upload-container {
  background: var(--upload-bg);
  border: 3px dashed var(--upload-border);
  padding: 60px;
  margin-top: 5%; /* Keep original margin */
  border-radius: 20px;
  position: relative;
  text-align: center;
}

.file-input {
  position: absolute;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  top: 0; /* Ensure it covers the whole container */
  left: 0;
}

.file-label {
  display: block; /* Make label occupy full space */
  cursor: pointer;
  padding: 10px; /* Add some padding for click area */
}

.file-label i {
  font-size: 3rem;
  color: var(--upload-icon-color);
  margin-bottom: 10px; /* Space between icon and text */
}

.upload-text {
  display: block; /* Ensure text breaks line after icon */
  font-size: 1.3rem;
  font-weight: bold;
  color: var(--upload-text-color);
}

.upload-subtext {
  display: block;
  font-size: 0.9rem;
  color: var(--upload-subtext-color);
}

.hidden {
  display: none;
}

.preview-section,
.output-section {
  background: var(--preview-output-bg);
  padding: 30px;
  margin-top: 20px;
  border-radius: 20px;
  box-shadow: 0 10px 30px var(--preview-output-shadow);
  width: 100%; /* Ensure sections take full width of container */
}

.preview-container {
  display: flex;
  gap: 20px;
  justify-content: space-around; /* Distribute space more evenly */
  flex-wrap: wrap; /* Allow wrapping on smaller screens */
}

.image-container {
  background: var(--image-container-bg);
  padding: 15px; /* Increased padding */
  border-radius: 10px;
  text-align: center;
  flex: 1; /* Allow containers to grow and shrink */
  min-width: 250px; /* Minimum width before wrapping */
}

.image-container h3 {
  margin-bottom: 10px;
  color: var(--section-h2-color); /* Consistent heading color */
}

.image-container img {
  max-width: 100%;
  height: auto;
  border-radius: 10px;
  display: block; /* Remove extra space below image */
  margin: 0 auto; /* Center image */
}

.btn {
  padding: 12px 25px; /* Slightly larger buttons */
  background: var(--btn-default-bg);
  color: white;
  border: none;
  border-radius: 8px; /* More rounded corners */
  cursor: pointer;
  margin: 10px;
  font-size: 1em; /* Consistent font size */
  transition: background 0.3s ease, transform 0.2s ease;
}

.btn:hover {
  background-color: var(--btn-default-hover-bg);
  transform: translateY(-2px);
}

.btn:active {
  transform: translateY(0);
}

.btn-blue {
  background-color: var(--btn-blue-bg);
}

.btn-blue:hover {
  background-color: darken(var(--btn-blue-bg), 10%); /* Darken on hover */
}

.canvas-container {
  text-align: center;
  margin: 20px 0;
  overflow-x: auto; /* Allow horizontal scrolling for large canvas */
}

#previewCanvasSingle {
  background: white;
  border-radius: 10px;
  border: 2px solid var(--canvas-border);
  max-width: 100%;
  height: auto; /* Maintain aspect ratio */
  display: block; /* Remove extra space below canvas */
  margin: 0 auto; /* Center canvas */
}

.actions {
  text-align: center;
  margin-top: 20px;
}

/* ===== INFO SECTION STYLES ===== */
.info-section { /* Renamed from 'section' to avoid conflict */
  background: var(--section-bg);
  margin: 30px auto;
  padding: 25px;
  max-width: 850px; /* Adjusted max-width for consistency */
  width: 100%; /* Ensure it uses full width of content-wrapper */
  border-radius: 12px;
  box-shadow: 0 0 15px var(--section-shadow);
  color: initial; /* Reset section text color to default black */
}

.info-section h2 {
  color: var(--section-h2-color);
  margin-bottom: 12px;
  font-size: 24px;
  text-align: left; /* Default alignment for section headings */
}

.info-section h3 { /* Added for potential subheadings in sections */
  color: var(--section-h2-color);
  font-size: 20px;
  margin-top: 20px;
  margin-bottom: 10px;
  text-align: left;
}

.info-section p, .info-section li {
  color: var(--section-p-color);
  font-size: 16px;
  line-height: 1.8;
  text-align: justify;
}

.info-section ol, .info-section ul { /* Added ul for consistency */
  padding-left: 20px;
  margin-top: 10px;
}

.info-section ul {
  list-style: disc; /* Default for unordered lists */
}

/* ===== FOOTER STYLES ===== */
.main-footer {
  background-color: var(--footer-bg-color);
  color: var(--footer-text-color);
  padding: 40px 20px 20px;
  margin-top: auto; /* Pushes footer to the bottom */
  width: 100%;
}

.footer-content {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 30px;
  max-width: 1200px;
  margin: 0 auto;
  padding-bottom: 30px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.footer-section {
  padding: 10px;
  text-align: left;
}

.footer-logo-section {
  display: flex;
  align-items: center;
  margin-bottom: 15px;
}

.footer-logo-img {
  width: 35px;
  height: 35px;
  margin-right: 10px;
  border-radius: 0.5rem;
  background: #fefeff;
  padding: 2px;
}

.footer-site-title {
  font-size: 20px;
  font-weight: bold;
  color: var(--footer-link-color);
}

.footer-section h3 {
  color: var(--footer-link-color);
  font-size: 18px;
  margin-bottom: 15px;
}

.footer-section p {
  font-size: 15px;
  line-height: 1.6;
  text-align: left;
  margin-bottom: 0;
  color: var(--footer-text-color);
}

.footer-section ul {
  list-style: none;
  padding: 0;
}

.footer-section ul li {
  margin-bottom: 8px;
}

.footer-section ul li a {
  color: var(--footer-text-color);
  text-decoration: none;
  font-size: 15px;
  transition: color 0.3s ease;
}

.footer-section ul li a:hover {
  color: var(--footer-link-color);
}

.footer-bottom {
  text-align: center;
  padding-top: 20px;
  font-size: 14px;
  color: var(--footer-text-color);
}

/* ===== STICKY CHAT ICON STYLES ===== */
.sticky-chat-icon {
  display: inline-block;
  text-decoration: none;
  position: fixed;
  bottom: 30px;
  right: 30px;
  z-index: 9999;
  cursor: pointer;
}

.sticky-chat-icon > div:first-child { /* The inner circle */
  width: 50px;
  height: 50px;
  background-color: #8800f8;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  transition: transform 0.3s ease;
}

.sticky-chat-icon svg { /* The SVG icon */
  width: 25px;
  height: 25px;
  fill: white;
}

.sticky-chat-icon > div:last-child { /* The wave effect */
  position: absolute;
  width: 80px;
  height: 80px;
  background: #8800f8;
  border-radius: 50%;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: -1;
  opacity: 0.4;
  animation: wave 2s infinite linear;
}

@keyframes wave {
  0% {
    transform: translate(-50%, -50%) scale(0.8);
    opacity: 0.4;
  }
  70% {
    transform: translate(-50%, -50%) scale(1.3);
    opacity: 0.1;
  }
  100% {
    transform: translate(-50%, -50%) scale(1.4);
    opacity: 0;
  }
}

/* ===== RESPONSIVE ADJUSTMENTS ===== */
@media (max-width: 768px) {
  .main-header {
    padding: 10px 20px;
  }

  .main-nav {
    display: none; /* Hide desktop nav on mobile */
  }

  .hamburger-menu {
    display: flex; /* Show hamburger on mobile */
  }

  .site-title {
    font-size: 20px;
  }

  .header-logo-img {
    width: 35px;
    height: 35px;
  }

  /* Main content wrapper padding adjustment */
  .content-wrapper {
    padding: 20px 15px;
  }

  .page-header {
    padding: 20px;
  }

  .page-header h1 {
    font-size: 1.8em;
  }

  .upload-container {
    padding: 40px;
  }

  .file-label i {
    font-size: 2.5rem;
  }

  .upload-text {
    font-size: 1.1rem;
  }

  .upload-subtext {
    font-size: 0.8rem;
  }

  .preview-section,
  .output-section {
    padding: 20px;
  }

  .preview-container {
    flex-direction: column; /* Stack image containers vertically */
    gap: 15px;
  }

  .image-container {
    min-width: unset; /* Remove min-width when stacked */
    width: 100%; /* Take full width */
  }

  .btn {
    padding: 10px 20px;
    font-size: 0.9em;
  }

  /* Info section adjustments */
  .info-section {
    padding: 20px;
    margin: 10px auto;
  }
  .info-section h2 {
    font-size: 22px;
    text-align: center;
  }
  .info-section h3 {
    font-size: 18px;
  }
  .info-section p, .info-section li {
    font-size: 14px;
    text-align: left;
  }

  /* Footer responsiveness */
  .footer-content {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .footer-section {
    padding: 15px 0;
  }

  .footer-logo-section {
    justify-content: center;
  }

  .footer-section p, .footer-section ul {
    text-align: center;
  }
  .footer-section ul {
    align-items: center;
  }

  /* Sticky chat icon responsive adjustments */
  .sticky-chat-icon {
    bottom: 20px !important;
    right: 20px !important;
  }

  .sticky-chat-icon > div:first-child {
    width: 45px !important;
    height: 45px !important;
  }

  .sticky-chat-icon svg {
    width: 22px !important;
    height: 22px !important;
  }

  .sticky-chat-icon > div:last-child {
    width: 65px !important;
    height: 65px !important;
  }
}

@media (max-width: 480px) {
  .page-header h1 {
    font-size: 1.5em;
  }

  .upload-container {
    padding: 30px;
  }

  .file-label i {
    font-size: 2rem;
  }

  .upload-text {
    font-size: 1em;
  }

  .upload-subtext {
    font-size: 0.75rem;
  }

  .info-section h2 {
    font-size: 20px;
  }
  .info-section h3 {
    font-size: 16px;
  }
}