﻿body {
  font-family: Arial, sans-serif;
  background: #f4f6f8;
  margin: 0;
  padding: 20px;
  color: #222;
}

@media (prefers-color-scheme: dark) {
  body {
    background: #1a1a1a;
    color: #e0e0e0;
  }

  .totalBox {
    background: #1a1a1a;
    color: #e8e8e8;
    border: 1px solid #3a3a3a;
  }

  .itemRow {
    background: #252525;
    border: 1px solid #3a3a3a;
  }

  .itemRow input,
  .itemRow select,
  select {
    background: #333;
    color: #e0e0e0;
    border: 1px solid #444;
  }

  .itemRow input::placeholder {
    color: #999;
  }

  .removeBtn {
    color: #ff6b6b;
  }

  #singleItemBtn,
  #addHomeItemsBtn,
  #addOfficeItemsBtn,
  #addFutureItemsBtn {
    background: #4a5568;
  }

  #singleItemBtn:hover,
  #addHomeItemsBtn:hover,
  #addOfficeItemsBtn:hover,
  #addFutureItemsBtn:hover {
    background: #6c92b3;
  }

  .addItemRow {
    background: #2d5a3d;
  }

  .addItemRow:hover {
    background: #1e7e34;
  }
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 2rem;
  background: #fff;
  /* Optional: give header a background if needed, else consisten with body */
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  /* Optional: slight separation */
  margin-bottom: 20px;
}

.header-left,
.header-right {
  flex: 1;
  display: flex;
  align-items: center;
}

.header-left {
  justify-content: flex-start;
  gap: 15px;
  /* Space between Logo and Name */
}

.header-right {
  justify-content: flex-end;
  gap: 10px;
}

.header-center {
  flex: 2;
  /* Give more space to center if needed */
  display: flex;
  align-items: center;
  justify-content: center;
}

.site-name {
  font-size: 1.5rem;
  font-weight: bold;
  color: #222;
}

.header-center nav {
  display: flex;
  gap: 15px;
}

.nav-link {
  text-decoration: none;
  color: #666;
  font-weight: 500;
  font-size: 1rem;
}

.nav-link:hover {
  color: #222;
}

.hero-text {
  text-align: center;
  margin-bottom: 54px;
  margin-top: 54px;
  padding: 0 20px;
}

.hero-text h2 {
  font-size: 1.8rem;
  margin: 0 0 10px 0;
  color: #333;
}

.hero-text p {
  font-size: 1.1rem;
  color: #666;
  margin: 0;
}

/* Dark mode adjustments for new elements */
@media (prefers-color-scheme: dark) {
  header {
    background: #1a1a1a;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  }

  .site-name {
    color: #e0e0e0;
  }

  .nav-link {
    color: #aaa;
  }

  .nav-link:hover {
    color: #fff;
  }

  .hero-text h2 {
    color: #e0e0e0;
  }

  .hero-text p {
    color: #aaa;
  }
}

.selectors {
  /* margin-top removed as it is now flex aligned */
  margin-top: 0;
}

select {
  padding: 6px;
  margin: 0;
  /* managed by gap in header-right */
}

.totalBox {
  text-align: center;
  background: #fafbfc;
  color: #1a1a1a;
  padding: 20px;
  border-radius: 10px;
  margin-bottom: 20px;
  border: 1px solid #e0e0e0;
  /* Ensure it has some prominence if needed */
}

#grandTotal {
  font-size: 32px;
  font-weight: bold;
  margin-top: 10px;
}

#addItemBtn {
  display: block;
  margin: 20px auto;
  padding: 10px 25px;
  font-size: 16px;
}

.buttonGroup {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin: 15px 0;
}

.buttonGroup button {
  padding: 10px 20px;
  font-size: 16px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  color: white;
  transition: background 0.3s;
}

#singleItemBtn,
#addHomeItemsBtn,
#addOfficeItemsBtn,
#addFutureItemsBtn {
  background: #9ca3af;
}

#singleItemBtn:hover,
#addHomeItemsBtn:hover,
#addOfficeItemsBtn:hover,
#addFutureItemsBtn:hover {
  background: #6c92b3;
}

#singleItemBtn.active,
#addHomeItemsBtn.active,
#addOfficeItemsBtn.active,
#addFutureItemsBtn.active {
  background: #6c92b3;
  box-shadow: 0 0 0 2px #4a6279;
}

#itemsContainer {
  max-width: 800px;
  margin: 20px auto;
  padding: 0 20px;
}

.addItemRow {
  display: block;
  padding: 10px 25px;
  font-size: 16px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  background: #28a745;
  color: white;
  font-weight: 600;
  transition: background 0.3s;
}

.addItemRow:hover {
  background: #1e7e34;
}

.addItemRow.show {
  display: block;
}

.itemActions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  max-width: 800px;
  margin: 4px auto 0;
  padding: 0 20px;
}

.clearAllBtn {
  padding: 4px 0;
  font-size: 0.8rem;
  border: none;
  background: none;
  cursor: pointer;
  color: #aaa;
  transition: all 0.2s ease;
}

.clearAllBtn:hover {
  color: #e74c3c;
  text-decoration: underline;
}

@media (prefers-color-scheme: dark) {
  .clearAllBtn {
    color: #555;
  }

  .clearAllBtn:hover {
    color: #e74c3c;
  }
}

.itemRow {
  display: flex;
  gap: 10px;
  margin-bottom: 2px;
  background: #fafbfc;
  padding: 3px 6px;
  border-radius: 8px;
  align-items: center;
}

.itemRow input,
.itemRow select {
  padding: 6px;
  background: #fafbfc;
  color: #1a1a1a;
  border: 1px solid #e0e0e0;
  box-sizing: border-box;
}

/* Hide native number input spinners but keep keyboard arrow increment/decrement */
input[type=number]::-webkit-outer-spin-button,
input[type=number]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

input[type=number] {
  -moz-appearance: textfield;
  appearance: textfield;
}

/* Symmetrical column widths */
.nameInput {
  flex: 3 1 0;
  min-width: 0;
}

.costInput,
.durationInput {
  flex: 1.5 1 0;
  min-width: 0;
}

.unitSelect {
  flex: 1.5 1 0;
  min-width: 0;
}

.rowDailyCost {
  flex: 1.5 1 0;
  min-width: 0;
}

.removeBtn {
  cursor: pointer;
  font-weight: bold;
  color: red;
  flex-shrink: 0;
}

.rowDailyCost {
  font-size: 0.75rem;
  font-weight: 600;
  color: #888;
  white-space: nowrap;
  flex-shrink: 0;
  text-align: right;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.rowDailyCost.has-value {
  opacity: 1;
}

@media (prefers-color-scheme: dark) {
  .rowDailyCost {
    color: #8ecf9a;
  }
}

/* Branding styles for header (logo + title) replaced by .header-left/center/right */
.site-logo {
  width: 90px;
  height: auto;
  display: block;
}

/* Mobile responsive styles */
@media (max-width: 768px) {
  header {
    flex-wrap: wrap;
    flex-direction: row;
    padding: 10px;
    gap: 10px 0;
    /* Vertical gap 10px, Horizontal 0 (controlled by justify-content) */
    justify-content: space-between;
  }

  /* Row 1: Left (Logo+Name) and Center (Nav) sharing the row */
  .header-left {
    width: auto;
    flex: 0 1 auto;
    justify-content: flex-start;
  }

  .header-center {
    width: auto;
    flex: 0 1 auto;
    justify-content: flex-end;
  }

  /* Row 2: Right (Selectors) takes full width */
  .header-right {
    width: 100%;
    justify-content: center;
    order: 3;
    /* Force to end/next line */
    margin-top: 5px;
    padding-top: 5px;
    border-top: 1px solid #f0f0f0;
  }

  .site-name {
    font-size: 1.2rem;
  }

  .site-logo {
    width: 40px;
  }

  .header-center nav {
    gap: 10px;
  }

  .nav-link {
    font-size: 0.95rem;
  }


  .hero-text h2 {
    font-size: 1.4rem;
  }

  .hero-text p {
    font-size: 1rem;
  }

  .selectors select {
    flex: 1;
    margin: 0;
  }

  .buttonGroup {
    gap: 6px;
  }

  .buttonGroup button {
    padding: 8px 12px;
    font-size: 13px;
    flex: 1;
  }

  #itemsContainer {
    padding: 0 10px;
  }

  .itemRow {
    gap: 6px;
    padding: 8px;
  }

  .itemRow input,
  .itemRow select {
    font-size: 12px;
    padding: 4px;
    min-width: 50px;
  }

  .removeBtn {
    font-size: 12px;
  }

  #addItemBtn {
    font-size: 13px;
    padding: 8px 16px;
  }

  .totalBox {
    padding: 12px;
  }

  #grandTotal {
    font-size: 24px;
  }
}

@media (max-width: 480px) {
  body {
    padding: 10px;
  }

  header {
    padding: 0.5rem;
    margin-bottom: 15px;
  }

  .hero-text h2 {
    font-size: 1.2rem;
  }

  .hero-text p {
    font-size: 0.9rem;
  }

  .site-logo {
    width: 50px;
    height: 32px;
    flex: 0 0 32px;
  }

  .selectors select {
    font-size: 11px;
    padding: 3px;
  }

  .buttonGroup {
    gap: 4px;
    margin: 10px 0;
  }

  .buttonGroup button {
    padding: 6px 10px;
    font-size: 11px;
  }

  #itemsContainer {
    padding: 0 5px;
  }

  .itemRow {
    padding: 6px;
    gap: 4px;
  }

  .itemRow input,
  .itemRow select {
    font-size: 11px;
    padding: 3px;
    min-width: 40px;
  }

  .removeBtn {
    font-size: 11px;
    padding: 2px 4px;
  }

  #addItemBtn {
    font-size: 11px;
    padding: 6px 12px;
  }

  #grandTotal {
    font-size: 20px;
  }

  .totalBox h2 {
    font-size: 14px;
    margin: 0 0 8px 0;
  }

  /* Make items container use full available width on small screens */
  #itemsContainer {
    max-width: 100%;
    margin: 8px auto;
    padding: 0 8px;
  }
}

/* no JS/CSS fallback to hide .totalBox; total stays visible on small screens */

/* Ensure .totalBox dark-mode styles override default rules (placed at end) */
@media (prefers-color-scheme: dark) {
  .totalBox {
    background: #1a1a1a;
    color: #e8e8e8;
    border: 1px solid #3a3a3a;
  }
}

/* Force item rows and their controls to dark background inside the items container */
@media (prefers-color-scheme: dark) {
  #itemsContainer .itemRow {
    background: #1a1a1a;
    border: 1px solid #3a3a3a;
  }

  #itemsContainer .itemRow input,
  #itemsContainer .itemRow select {
    background: #151515;
    color: #e8e8e8;
    border: 1px solid #333;
  }
}

.whyInlineBtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: none;
  border: 1.5px solid #aaa;
  color: #888;
  font-size: 0.8rem;
  font-weight: bold;
  cursor: pointer;
  margin-left: 6px;
  vertical-align: middle;
  position: relative;
  top: -2px;
  transition: all 0.2s ease;
  line-height: 1;
}

.whyInlineBtn:hover {
  background: #6c92b3;
  border-color: #6c92b3;
  color: #fff;
}

@media (prefers-color-scheme: dark) {
  .whyInlineBtn {
    border-color: #666;
    color: #aaa;
  }

  .whyInlineBtn:hover {
    background: #6c92b3;
    border-color: #6c92b3;
    color: #fff;
  }
}

.printBtn {
  background: none;
  border: 1px solid #ccc;
  padding: 6px 12px;
  border-radius: 20px;
  cursor: pointer;
  color: inherit;
  font-size: 0.9rem;
  transition: all 0.2s ease;
}

.whyBtn:hover,
.printBtn:hover {
  background-color: #f0f0f0;
  border-color: #bbb;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  backdrop-filter: blur(2px);
}

.hidden {
  display: none;
}

.modalContent {
  background: white;
  padding: 25px;
  border-radius: 12px;
  max-width: 400px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  position: relative;
  color: #333;
}

footer {
  text-align: center;
  padding: 20px;
  font-size: 0.9rem;
  color: #666;
  margin-top: 40px;
  border-top: 1px solid #e0e0e0;
}

footer a {
  color: #666;
  text-decoration: none;
  margin: 0 5px;
}

footer a:hover {
  color: #222;
  text-decoration: underline;
}

@media (prefers-color-scheme: dark) {
  footer {
    border-top: 1px solid #333;
    color: #999;
  }

  footer a {
    color: #999;
  }

  footer a:hover {
    color: #fff;
  }
}

/* Page Content Styles */
.content-container {
  max-width: 800px;
  margin: 40px auto;
  padding: 0 20px;
  line-height: 1.6;
  color: #333;
}

.about-section {
  margin-bottom: 40px;
}

.about-section h3 {
  font-size: 1.5rem;
  color: #222;
  margin-bottom: 15px;
  border-bottom: 2px solid #eee;
  padding-bottom: 10px;
}

.about-section p {
  font-size: 1.1rem;
  color: #555;
  margin-bottom: 15px;
}

.meta-info {
  font-size: 0.9rem;
  color: #777;
  margin-top: 50px;
  border-top: 1px solid #eee;
  padding-top: 20px;
}

/* Utilities */
.text-center {
  text-align: center;
}

/* Professional About Modal Styles (Legacy/Ref code if needed, otherwise this block starts here) */
.aboutModalContent {
  max-width: 500px;
  width: 90%;
  padding: 0;
  overflow: hidden;
  /* For header radius */
  display: flex;
  flex-direction: column;
}

.aboutHeader {
  background: #f4f6f8;
  padding: 30px 20px 20px;
  text-align: center;
  border-bottom: 1px solid #eee;
}

.aboutLogo {
  width: 60px;
  height: auto;
  margin-bottom: 10px;
}

.aboutHeader h3 {
  margin: 0;
  color: #333;
  font-size: 1.5rem;
}

.aboutBody {
  padding: 25px;
}

.aboutSection {
  margin-bottom: 25px;
  text-align: center;
}

.aboutSection h4 {
  color: #6c92b3;
  /* Brand color */
  text-transform: uppercase;
  letter-spacing: 1px;
  font-size: 0.85rem;
  margin-bottom: 10px;
}

.aboutSection p {
  color: #555;
  line-height: 1.6;
  margin: 0 0 5px;
}

.studioName {
  color: #888;
  font-size: 0.9rem;
}

.aboutFooter {
  border-top: 1px solid #eee;
  padding-top: 15px;
  text-align: center;
  font-size: 0.8rem;
  color: #aaa;
}

.closeModalBtn {
  display: block;
  width: 100%;
  padding: 15px;
  background: #f4f6f8;
  border: none;
  border-top: 1px solid #eee;
  font-size: 1rem;
  font-weight: bold;
  color: #555;
  cursor: pointer;
  transition: background 0.2s;
}

.closeModalBtn:hover {
  background: #e8eaec;
  color: #222;
}

/* About Dark Mode */
@media (prefers-color-scheme: dark) {
  .aboutModalContent {
    background: #1e1e1e;
  }

  .aboutHeader {
    background: #252525;
    border-bottom: 1px solid #333;
  }

  .aboutHeader h3 {
    color: #e0e0e0;
  }

  .aboutSection h4 {
    color: #8ab4d5;
  }

  .aboutSection p {
    color: #ccc;
  }

  .closeModalBtn {
    background: #252525;
    border-top: 1px solid #333;
    color: #aaa;
  }

  .closeModalBtn:hover {
    background: #333;
    color: #fff;
  }
}

/* Dark Mode Overrides for Page Content */
@media (prefers-color-scheme: dark) {
  .content-container {
    color: #e0e0e0;
  }

  .about-section h3 {
    color: #e0e0e0;
    border-bottom: 2px solid #333;
  }

  .about-section p {
    color: #ccc;
  }

  .meta-info {
    color: #999;
    border-top: 1px solid #333;
  }
}


.nav-link.active {
  color: #222;
  border-bottom: 2px solid #6c92b3;
  /* Active color from #singleItemBtn:hover */
}

@media (prefers-color-scheme: dark) {
  .nav-link.active {
    color: #fff;
    border-bottom: 2px solid #6c92b3;
  }
}

/* Dark Mode Overrides for Buttons and Modal */
@media (prefers-color-scheme: dark) {

  .whyBtn,
  .printBtn {
    border-color: #555;
    color: #e0e0e0;
  }

  .whyBtn:hover,
  .printBtn:hover {
    background-color: #333;
    border-color: #777;
    color: #fff;
  }

  .modalContent {
    background: #1e1e1e;
    color: #e0e0e0;
    border: 1px solid #333;
  }
}

.floatingTotal {
  position: fixed;
  bottom: 20px;
  right: 20px;
  min-width: 96px;
  /* Approx 1 inch */
  height: 48px;
  /* Approx 0.5 inch */
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  font-size: 1.2rem;
  font-weight: bold;
  padding: 0 10px;
  z-index: 1000;
  backdrop-filter: blur(4px);
  pointer-events: none;
  /* Allows clicking through if it covers something important, though bottom-right is usually safe. User said "Does not block typing or buttons". If it covers a button, this helps. */
}

.printBtn {
  background: none;
  border: 1px solid #ccc;
  padding: 6px 12px;
  border-radius: 20px;
  cursor: pointer;
  margin-left: 5px;
}

@media print {

  /* Hide non-essential elements */
  .header-center,
  .header-right,
  .hero-text,
  .buttonGroup,
  #addItemBtn,
  .floatingTotal,
  footer,
  .removeBtn,
  .modal {
    display: none !important;
  }

  /* Ensure Layout is clean */
  body {
    background: white;
    color: black;
    padding: 0;
    margin: 0;
  }

  header {
    box-shadow: none;
    margin-bottom: 20px;
    padding: 0;
    justify-content: center;
    /* Center the logo/name if desired, or keep left */
  }

  .header-left {
    justify-content: center;
    /* Center logo and name for print */
    width: 100%;
    flex: none;
  }

  /* Input fields should look like text */
  .itemRow input,
  .itemRow select {
    border: none;
    background: transparent;
    padding: 0;
    color: black;
    /* Optional: Replace select arrow? It usually prints as text or box depending on browser. */
    -webkit-appearance: none;
    appearance: none;
  }

  /* Remove placeholders if empty? Hard to do with CSS only, user usually prints filled items. */

  .totalBox {
    border: 2px solid #000;
    /* distinct border for total */
    background: white;
    color: black;
  }

  #itemsContainer {
    margin: 0;
    padding: 0;
    max-width: 100%;
  }

  .itemRow {
    border: none;
    border-bottom: 1px solid #eee;
    background: white !important;
  }
}

/* Search Box Styling */
.search-box {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  margin: 30px 0;
  flex-wrap: wrap;
  /* Allow wrapping on small screens */
}

.search-box input {
  padding: 12px 15px;
  border: 1px solid #ccc;
  border-radius: 25px;
  /* Rounded corners */
  font-size: 1rem;
  width: 250px;
  /* Uniform width */
  outline: none;
  transition: border-color 0.3s;
}

.search-box input:focus {
  border-color: #6c92b3;
}

.search-box button {
  padding: 12px 25px;
  background-color: #6c92b3;
  /* Brand color */
  color: white;
  border: none;
  border-radius: 25px;
  font-size: 1rem;
  font-weight: bold;
  cursor: pointer;
  transition: background-color 0.3s, transform 0.1s;
}

.search-box button:hover {
  background-color: #5a7a95;
  /* Darker shade */
}

.search-box button:active {
  transform: scale(0.98);
}

/* Dark Mode Support for Search */
@media (prefers-color-scheme: dark) {
  .search-box input {
    background-color: #333;
    border-color: #555;
    color: #e0e0e0;
  }

  .search-box input:focus {
    border-color: #8ab4d5;
  }
}

.affiliate-buttons {
  margin-top: 20px;
}

.affiliate-btn {
  display: inline-block;
  margin: 10px;
  padding: 12px 20px;
  background-color: #2c6efd;
  color: white;
  text-decoration: none;
  border-radius: 6px;
}

.affiliate-btn:hover {
  opacity: 0.9;
}

.disclaimer {
  font-size: 12px;
  margin-top: 20px;
  color: #666;
}