/* HomiesUnlocked main stylesheet */

/* Global transitions */
html, body {
  transition: background-color 0.4s ease, color 0.4s ease;
}

.layout-container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding-left: 1.5rem;
  padding-right: 1.5rem;
}

@media (max-width: 768px) {
  .layout-container {
    padding-left: 1rem;
    padding-right: 1rem;
  }
}

@media (max-width: 480px) {
  .layout-container {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
  }
}

/* Tagline Spark Effect */
@keyframes sparkEffect {
  0% { text-shadow: 0 0 2px rgba(255,255,255,0.2); }
  50% { text-shadow: 0 0 10px rgba(255,255,255,0.8); }
  100% { text-shadow: 0 0 2px rgba(255,255,255,0.2); }
}

.sparked {
  animation: sparkEffect 2s ease-out;
}

/* Button hover effect */
.btn-hover {
  transition: transform 0.2s ease, filter 0.2s ease;
}

.btn-hover:hover {
  transform: scale(1.03);
  filter: brightness(1.1);
}

#get-id-btn {
  background-color: #6b46c1;
  color: #ffffff;
}

#get-id-btn:hover {
  filter: brightness(1.15);
}

#add-user-btn {
  background-color: var(--button-bg);
  color: var(--text-color);
}

#generate-btn {
  background-color: #3182ce;
  color: #ffffff;
}

#screenshot-btn {
  background-color: #38a169;
  color: #ffffff;
}

#combined-routine h2,
#combined-routine table {
  color: var(--text-color);
}

#combined-routine th {
  border: 1px solid var(--table-border);
}

@media (max-width: 640px) {
  .input-row {
    flex-direction: column;
    gap: 0.5rem;
  }

  .name-row {
    display: flex;
    flex-direction: row;
    gap: 0.25rem;
    align-items: stretch;
  }

  .routine-row {
    display: flex;
    width: 100%;
  }
}

/* Acknowledgements card */
.acknowledgements {
  margin: 1.5rem auto;
  padding: 1rem;
  max-width: 600px;
  text-align: center;
  background-color: var(--card-bg);
  border-radius: 0.5rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  font-size: 0.9rem;
  line-height: 1.5;
  border: 1px solid var(--table-border);
}

.ack-header {
  padding: 0.5rem;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: background-color 0.3s ease;
}

.ack-header:hover {
  background-color: var(--input-card-bg);
}

.ack-content {
  max-height: 0;
  opacity: 0;
  padding: 0 1rem;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}

.ack-content.active {
  max-height: 500px;
  opacity: 1;
  padding: 1rem;
}

.arrow {
  transition: transform 0.3s ease;
  margin-left: 1rem;
}

.arrow.active {
  transform: rotate(180deg);
}

/* Modal styles */
.modal-overlay {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 50;
}

.modal {
  background-color: var(--card-bg);
  color: var(--text-color);
  padding: 1rem 1.25rem;
  border-radius: 0.5rem;
  max-width: 500px;
  width: 90%;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-close {
  cursor: pointer;
  font-size: 1.5rem;
  line-height: 1;
}

/* Keyboard key styling */
kbd {
  display: inline-block;
  padding: 0.2rem 0.4rem;
  margin: 0 0.2rem;
  font-size: 0.85rem;
  line-height: 1.4;
  font-family: monospace;
  border-radius: 0.25rem;
}

.notice kbd {
  background-color: #000;
  color: #fff;
  border: 1px solid #000;
}

/* Theme variables */
:root {
  --bg-color: #1a202c;
  --text-color: #e2e8f0;
  --header-bg: #2a4365;
  --card-bg: #2d3748;
  --routine-bg: #34495e;
  --button-bg: #4a5568;
  --button-hover: #718096;
  --table-border: #4a5568;
  --input-card-bg: #334155;
  --input-card-text: #e2e8f0;
  --footer-bg: #1a202c;
  --notice-bg: #f59e0b;
  --notice-text: #1a202c;
  --input-border: #4a5568;
  /* Customizable variables for routine-entry */
  --routine-entry-padding: 0.25rem 0.5rem;
  --routine-entry-font-size: 0.75rem;
  --routine-entry-line-height: 1;
  --routine-entry-min-height: auto;
  /* Updated routine entry padding variables for all 4 sides */
  --routine-entry-padding-top: 5px;
  --routine-entry-padding-right: 8px;
  --routine-entry-padding-bottom: 4px;
  --routine-entry-padding-left: 8px;
}

[data-theme="light"] {
  --bg-color: #f0f0f0;
  --text-color: #333333;
  --header-bg: #d9edf7;
  --card-bg: #ffffff;
  --routine-bg: #ffffff;
  --button-bg: #e2e8f0;
  --button-hover: #d1dce0;
  --table-border: #cccccc;
  --input-card-bg: #f8f8f8;
  --input-card-text: #333333;
  --footer-bg: #f0f0f0;
  --notice-bg: #f59e0b;
  --notice-text: #1a202c;
  --input-border: #cccccc;
}

[data-theme="pink"] {
  --bg-color: #ffe1f0;
  --text-color: #000000;
  --header-bg: #ff73c3;
  --card-bg: #fff0f5;
  --routine-bg: #ffe6f2;
  --routine-entry-text-color: #000000;
  --button-bg: #ff69b4;
  --button-hover: #ff85b3;
  --table-border: #ff69b4;
  --input-card-bg: #fff0f5;
  --input-card-text: #000000;
  --footer-bg: #ffe1f0;
  --notice-bg: #f59e0b;
  --notice-text: #1a202c;
  --input-border: #ff85b3;
}

body {
  font-family: 'Inter', sans-serif;
  background-color: var(--bg-color);
  color: var(--text-color);
}

/* Header */
header {
  background-color: var(--header-bg);
  padding: 1.5rem 1rem;
}

.logo-title {
  font-family: 'Orbitron', sans-serif;
  font-weight: 700;
  font-size: 1.8rem;
}

@media (min-width: 768px) {
  .logo-title {
    font-size: 3rem;
  }
}

[data-theme="pink"] .logo-title {
  font-size: 3.1rem;
  font-family: 'Lobster', cursive;
  text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
  color: #ffffff !important;
}

.bracket {
  color: var(--text-color);
  transition: color 0.3s ease;
}

[data-theme="pink"] .bracket {
  display: none;
}

.unlocked {
  font-style: normal;
}

[data-theme="dark"] .unlocked,
[data-theme="light"] .unlocked {
  font-style: italic;
}

/* Input section card */
.input-card {
  background-color: var(--card-bg);
  border: 1px solid var(--table-border);
  border-radius: 0.5rem;
  padding: 0.75rem;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
  margin-bottom: 0.5rem;
}

/* User inputs container - Grid layout for desktop */
#user-inputs {
  display: grid;
  gap: 1rem;
  grid-template-columns: 1fr; /* Single column on mobile by default */
}

/* Desktop: 2-column grid */
@media (min-width: 769px) {
  #user-inputs {
    grid-template-columns: 1fr 1fr; /* 2 columns on desktop */
    gap: 1.5rem;
  }
}

/* Large desktop: Keep 2-column but with better spacing */
@media (min-width: 1200px) {
  #user-inputs {
    gap: 2rem;
  }
}

/* Individual user input card styling */
#user-inputs > .input-card {
  margin-bottom: 0; /* Remove margin since we're using grid gap */
  width: 100%; /* Ensure cards fill their grid cells */
}

/* Flex container for side-by-side inputs */
.input-row {
  display: flex;
  gap: 0.5rem;
  align-items: stretch;
  position: relative;
}

/* Name row (contains name input) */
.name-row {
  display: flex;
  gap: 0.5rem;
  align-items: stretch;
  flex: 1;
}

/* Routine row (contains routine input) */
.routine-row {
  display: flex;
  flex: 1;
}

/* Trash button container - responsive positioning */
.trash-btn-container {
  position: absolute;
  right: 0;
  top: 0;
  height: 2.5rem;
  display: flex;
  align-items: center;
  z-index: 1;
}

/* Mobile: Position trash button on name row */
@media (max-width: 768px) {
  .input-row {
    flex-direction: column;
    gap: 0.25rem;
  }

  .trash-btn-container {
    position: absolute;
    right: 0;
    top: 0;
    height: 2.5rem;
  }

  .name-row {
    padding-right: 3rem; /* Make space for trash button */
  }
}

/* Desktop: Position trash button on routine row */
@media (min-width: 769px) {
  .input-row {
    flex-direction: column;
    gap: 0.5rem;
  }

  .trash-btn-container {
    position: absolute;
    right: 0;
    top: 3rem; /* Position at routine row level */
    height: 2.5rem;
  }

  .routine-row {
    padding-right: 3rem; /* Make space for trash button */
  }
}

/* Input container for positioning */
.input-container {
  position: relative;
  flex: 1;
}

.input-field {
  flex: 1;
  width: 100%;
  line-height: 1.5;
  height: 2.5rem;
  background-color: var(--input-card-bg);
  color: var(--input-card-text);
  border: 1px solid var(--input-border);
  border-radius: 0.375rem;
  padding: 0.4rem 0.6rem;
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.3s ease;
  margin-bottom: 0.5rem;
}

.input-field:focus {
  border-color: var(--button-hover);
  box-shadow: 0 0 0 2px rgba(66, 153, 225, 0.4);
}

input.input-field {
  height: 2.5rem;
}

textarea.input-field {
  resize: vertical;
}

/* Trash button styling */
.trash-btn {
  background: none !important;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 2.5rem;
  height: 2.5rem;
  transition: transform 0.1s ease;
  flex-shrink: 0;
}

.trash-btn:hover {
  transform: scale(1.1);
}

.trash-btn:active {
  transform: scale(0.9);
}

.trash-btn i {
  font-size: 1rem;
}

/* Mobile adjustments for trash button */
@media (max-width: 768px) {
  .trash-btn {
    min-width: 2rem;
    height: 2rem;
    padding: 0.25rem;
    flex-shrink: 0;
  }

  .trash-btn i {
    font-size: 0.875rem;
  }
}

/* Routine entry styling - consolidated */
.routine-entry {
  /* Base styling using CSS custom properties with fallbacks */
  padding-top: var(--routine-entry-padding-top, 0.25rem);
  padding-right: var(--routine-entry-padding-right, 0.25rem);
  padding-bottom: var(--routine-entry-padding-bottom, 0.25rem);
  padding-left: var(--routine-entry-padding-left, 0.25rem);
  font-size: var(--routine-entry-font-size, 0.7rem);
  line-height: var(--routine-entry-line-height, 1.2);
  min-height: var(--routine-entry-min-height);

  /* Additional properties */
  margin-bottom: 0.2rem;
  border-radius: 0.25rem;
  text-align: center;
  display: block;
  width: 100%;
  box-sizing: border-box;
  white-space: nowrap;
  overflow: visible;
  text-overflow: clip;
  min-width: max-content;
  color: var(--routine-entry-text-color, #ffffff);
}

/* Routine Card styling */
#combined-routine {
  background-color: var(--routine-bg);
}

#combined-routine h2 {
  color: var(--text-color);
}

/* Notice styling */
.notice {
  text-align: center;
  font-size: 0.9rem;
  padding: 0.5rem 0;
  margin: 0;
  background-color: var(--notice-bg);
  color: var(--notice-text);
}

/* Footer */
footer {
  background-color: var(--footer-bg);
  color: var(--text-color);
  min-height: 30px;
  padding: 0.5rem 0;
  transition: background-color 0.4s ease, color 0.4s ease;
}

/* Theme Switcher Button Styles */
.theme-switcher {
  height: 42px;
  width: 100px; /* fixed width on desktop */
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 1.5rem;
  border-radius: 2rem;
  border: none;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  background: linear-gradient(135deg, var(--button-bg), var(--button-hover));
}

.theme-icon {
  font-size: 1.1rem;
}

.theme-text {
  margin-left: 0.5rem;
}

/* Custom Alert */
.custom-alert {
  transition: opacity 0.5s;
}

/* Responsive adjustments for mobile */
@media (max-width: 640px) {
  /* Make input cards and buttons more compact */
  .input-card {
    padding: 0.5rem !important;
    margin: 0.2rem !important;
  }

  .btn-hover {
    padding: 0.5rem 0.75rem !important;
    font-size: 0.8rem !important;
  }

  /* Arrange action buttons side by side */
  .action-buttons {
    flex-direction: row !important;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
  }

  /* Hide theme button text on mobile */
  .theme-text {
    display: none;
  }
}

@media (min-width: 641px) {
  /* On desktop, ensure the theme button stays fixed in size */
  .theme-switcher {
    width: 100px;
    padding: 0;
  }
}

/* Screenshot mode styles */
.screenshot-mode {
  width: 100% !important;
  max-width: 1800px !important;
  margin: 0 auto !important;
  background-color: var(--routine-bg) !important;
  padding: 30px !important;
  border-radius: 8px !important;
  box-shadow: none !important;
}

.screenshot-mode table {
  width: 100% !important;
  table-layout: auto !important;
  border-collapse: collapse !important;
  white-space: nowrap !important;
}

.screenshot-mode td,
.screenshot-mode th {
  border: 2px solid var(--table-border) !important;
  padding: 12px 8px !important;
  text-align: center !important;
  vertical-align: middle !important;
  white-space: nowrap !important;
  overflow: visible !important;
  text-overflow: clip !important;
  min-width: max-content !important;
}

/* Time column in screenshot mode */
.screenshot-mode td:first-child,
.screenshot-mode th:first-child {
  font-weight: bold !important;
  background-color: rgba(255, 255, 255, 0.1) !important;
  min-width: 120px !important;
  font-size: 14px !important;
}

/* Day header cells in screenshot mode */
.screenshot-mode th:not(:first-child) {
  font-weight: bold !important;
  background-color: rgba(255, 255, 255, 0.1) !important;
  font-size: 16px !important;
  min-width: 140px !important;
}

/* Content cells in screenshot mode */
.screenshot-mode td:not(:first-child) {
  min-width: 140px !important;
  max-width: none !important;
}

.screenshot-mode .routine-entry {
  min-height: 35px !important;
  max-height: none !important;
  font-size: 11px !important;
  line-height: 1.3 !important;
  margin: 2px 0 !important;
  padding: 8px 6px !important;
  white-space: nowrap !important;
  word-break: keep-all !important;
  overflow: visible !important;
  text-overflow: clip !important;
  border-radius: 4px !important;
  font-weight: 500 !important;
  display: block !important;
  width: auto !important;
  min-width: max-content !important;
}

/* Ensure screenshot captures properly sized table */
.screenshot-mode .table-container {
  overflow: visible !important;
  width: auto !important;
  min-width: 100% !important;
}

/* Responsive table container */
.table-container {
  width: 100%;
  overflow-x: auto;
}

/* Base table styling - PREVENT ALL WRAPPING */
#combined-routine table {
  width: auto;
  min-width: 100%;
  table-layout: auto;
  border-collapse: collapse;
  white-space: nowrap;
}

/* Responsive table cells - NEVER WRAP CONTENT */
#combined-routine th,
#combined-routine td {
  border: 1px solid var(--table-border);
  padding: 0.5rem;
  text-align: center;
  vertical-align: top;
  white-space: nowrap;
  overflow: visible;
  text-overflow: clip;
  min-width: max-content;
}

/* Time column - let it size naturally */
#combined-routine th:first-child,
#combined-routine td:first-child {
  min-width: max-content;
  font-size: 0.8rem;
}

/* Day columns - let them size naturally */
#combined-routine th:not(:first-child),
#combined-routine td:not(:first-child) {
  min-width: max-content;
}

/* Mobile responsive adjustments */
@media (max-width: 768px) {
  #combined-routine {
    padding: 0.5rem;
    margin: 0.5rem;
  }

  #combined-routine th,
  #combined-routine td {
    padding: 0.25rem;
    font-size: 0.75rem;
  }

  #combined-routine th:first-child,
  #combined-routine td:first-child {
    width: 15%;
    min-width: 60px;
    font-size: 0.7rem;
  }

  #combined-routine th:not(:first-child),
  #combined-routine td:not(:first-child) {
    width: 12.14%; /* (100% - 15%) / 7 days */
  }

  .routine-entry {
    font-size: 0.6rem;
    padding: 0.2rem;
    line-height: 1.1;
    margin-bottom: 0.1rem;
  }
}

/* Extra small screens */
@media (max-width: 480px) {
  #combined-routine th,
  #combined-routine td {
    padding: 0.15rem;
    font-size: 0.7rem;
  }

  #combined-routine th:first-child,
  #combined-routine td:first-child {
    width: 18%;
    min-width: 50px;
    font-size: 0.65rem;
  }

  #combined-routine th:not(:first-child),
  #combined-routine td:not(:first-child) {
    width: 11.71%; /* (100% - 18%) / 7 days */
  }

  .routine-entry {
    font-size: 0.55rem;
    padding: 0.15rem;
    line-height: 1;
    margin-bottom: 0.1rem;
  }
}

/* Add user button responsive text */
#add-user-btn .btn-text-desktop {
  display: none;
}

#add-user-btn .btn-text-mobile {
  display: inline;
}

@media (min-width: 769px) {
  #add-user-btn .btn-text-desktop {
    display: inline;
  }

  #add-user-btn .btn-text-mobile {
    display: none;
  }
}