/* ===== Global Styles ===== */
body {
  font-family: Arial, sans-serif;
  background: #f8f8f8;
  margin: 0;
  padding-bottom: 150px; /* Increased padding-bottom to account for both sticky footers */
}

/* ===== Page Container ===== */
#dashboard {
  padding: 20px;
}

/* ===== Headings ===== */
h1 {
  text-align: center;
}

/* ===== Sign-In Styles ===== */
#signin-container {
  max-width: 400px;
  margin: auto;
  text-align: center;
}

/* ===== Popups ===== */
.popup {
  max-width: 300px;
  margin: 10px auto;
  text-align: center;
  padding: 10px;
  border-radius: 8px;
  font-weight: bold;
}

.hidden {
  display: none;
}

#success-popup {
  background-color: #c8e6c9;
  color: #2e7d32;
}

#access-denied-popup {
  background-color: #ffcdd2;
  color: #c62828;
}

/* ===== Buttons & Controls ===== */
button {
  margin: 5px;
  padding: 10px 15px;
  border: none;
  background-color: #333;
  color: white;
  cursor: pointer;
  border-radius: 4px;
}

button:hover {
  background-color: #7e7e7e; /* Contact Card button hover color */
}

/* ===== Top Navigation Bar ===== */
#top-nav {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px;
  background: #222;
  color: white; /* Clock color */
  width: 100%;
  box-sizing: border-box;
  position: sticky;
  top: 0;
  z-index: 1000;
}

#nav-controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 10px;
  width: 100%;
  margin-top: 10px;
}

#nav-controls button,
.dropdown-container {
  padding: 8px 12px;
  font-size: 1rem;
  border-radius: 4px;
  background-color: #333;
  color: white;
  cursor: pointer;
  text-align: center;
  flex-grow: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  max-width: 150px;
}

#nav-controls button:hover,
.dropdown-container:hover {
  background-color: #555;
}

#sort-dropdown {
  background: none;
  border: none;
  color: white;
  font-size: 1rem;
  padding: 0;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  width: 100%;
  height: 100%;
  cursor: pointer;
}

#sort-dropdown:focus {
  outline: none;
}

#search-input {
  flex-grow: 3;
  padding: 8px 12px;
  min-width: 250px;
}

#calendar-icon {
  padding: 8px 12px;
  font-size: 1rem;
  border-radius: 4px;
  background-color: #333;
  color: white;
  cursor: pointer;
  text-align: center;
  white-space: nowrap;
  flex-grow: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  max-width: 100px;
}

#calendar-icon:hover {
  background-color: #555;
}

#datetime-display {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  font-size: 0.9rem;
  width: 100%;
}

#current-date {
  font-weight: bold;
  font-size: larger;
}

#clocks {
  display: flex;
  gap: 30px;
  flex-wrap: wrap;
  justify-content: center;
  font-size: medium;
}

/* ===== Contact Cards ===== */
#contacts-container {
  display: flex;
  flex-direction: column;
  gap: 20px;
  align-items: center;
  padding: 20px 0;
  margin-top: 20px;
}

.contact-card {
  width: 95%;
  max-width: 900px;
  min-height: 140px;
  background: white;
  padding: 20px;
  border-radius: 8px;
  box-shadow: 0px 0px 8px rgba(0, 0, 0, 0.15);
  display: flex;
  flex-direction: column;
  justify-content: center;
  text-align: center;
  border: 1px solid #ddd;
  position: relative; /* Added for positioning the edit icon */
}

.contact-card.even {
  background-color: #d3d3d3;
}

.contact-card.odd {
  background-color: #ffffff;
}

/* Style for the edit icon */
.edit-icon {
  position: absolute;
  top: 10px;
  right: 10px;
  font-size: 1.5em;
  cursor: pointer;
  color: #888;
  background-color: rgba(255, 255, 255, 0.7);
  border-radius: 50%;
  padding: 5px;
  width: 30px; /* Make it a circle */
  height: 30px; /* Make it a circle */
  display: flex;
  justify-content: center;
  align-items: center;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
  transition: background-color 0.2s ease-in-out, color 0.2s ease-in-out;
}

.edit-icon:hover {
  background-color: #eee; /* PENCIL BACKGROUND COLOR */
  color: #333333;
}

.notes-textarea {
  resize: vertical;
}

#auto-dialer {
  background-color: #f9f9f9;
  padding: 15px;
  border: 1px solid #ccc;
  border-radius: 6px;
  margin-bottom: 30px;
}

.call-button {
  display: inline-block;
  padding: 10px 15px;
  background-color: #28a745;
  color: white;
  text-decoration: none;
  border-radius: 4px;
  font-weight: bold;
}

.call-button:hover {
  background-color: #218838;
}

/* Sticky footer styling for Auto Dialer */
.sticky-footer {
  position: fixed;
  bottom: 0; /* Adjust the heigh of Call button footer. Default is 0. 65px is perfectly above instructions button. */
  left: 0;
  width: 100%;
  background-color: #ffffff;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 16px;
  padding: 16px;
  box-shadow: 0 -2px 6px rgba(0, 0, 0, 0.1);
  z-index: 1000;
}

.sticky-footer a.call-button,
.sticky-footer button {
  padding: 8px 18px;
  font-size: 16px;
  border: none;
  border-radius: 8px;
  background-color: #4CD964;
  color: white;
  cursor: pointer;
  text-decoration: none;
}

.sticky-footer a.call-button:hover,
.sticky-footer button:hover {
  background-color: #80db8f;
}

#current-contact-name {
  margin: 0;
  padding: 0;
  font-size: 1.2em;
  font-weight: bold;
  color: #333;
}

/* New styles for the Dashboard Footer */
#dashboard-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  background-color: #333; /* Dark background similar to top nav */
  padding: 10px 0;
  display: flex;
  justify-content: center;
  align-items: center;
  box-shadow: 0 -2px 6px rgba(0, 0, 0, 0.2);
  z-index: 999; /* Slightly lower z-index than auto-dialer footer if both are active */
}

#dashboard-footer button {
  background-color: #555; /* Slightly lighter button in footer */
  color: white;
  padding: 10px 20px;
  border-radius: 4px;
  border: none;
  cursor: pointer;
  font-size: 1em;
}

#dashboard-footer button:hover {
  background-color: #777;
}

/* --- Schedule Modal Styles --- */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.6);
  display: flex; /* Default display when visible */
  justify-content: center;
  align-items: center;
  z-index: 2000; /* Above all other content */
}

/* Crucial fix: Ensure 'hidden' class overrides 'display: flex' */
.modal-overlay.hidden {
  display: none;
}

.modal-content {
  background-color: #fff;
  padding: 25px;
  border-radius: 10px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
  width: 90%;
  max-width: 450px;
  position: relative;
  text-align: center;
}

.close-modal-btn {
  position: absolute;
  top: 10px;
  right: 15px;
  font-size: 1.8em;
  cursor: pointer;
  color: #888;
}

.close-modal-btn:hover {
  color: #333;
}

.modal-content h2 {
  margin-top: 0;
  color: #333;
  font-size: 1.5em;
  margin-bottom: 20px;
}

.calendar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
  font-size: 1.1em;
  font-weight: bold;
  color: #444;
}

.calendar-header button {
  background-color: #f0f0f0;
  color: #333;
  border: 1px solid #ddd;
  padding: 8px 12px;
  border-radius: 5px;
  cursor: pointer;
}

.calendar-header button:hover {
  background-color: #e0e0e0;
}

.calendar-grid-container {
  border: 1px solid #ddd;
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 20px;
}

.calendar-weekdays,
.calendar-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
  background-color: #eee; /* Grid lines */
}

.calendar-weekdays div {
  background-color: #f5f5f5;
  padding: 10px 5px;
  font-weight: bold;
  font-size: 0.9em;
  color: #555;
}

.calendar-days div {
  background-color: #fff;
  padding: 10px 5px;
  cursor: pointer;
  min-height: 30px; /* Ensure consistent cell height */
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 0.95em;
  transition: background-color 0.2s ease-in-out;
}

.calendar-days div:hover:not(.empty):not(.selected) {
  background-color: #e6f7ff; /* Light blue on hover */
}

.calendar-days div.empty {
  background-color: #f9f9f9;
  cursor: default;
}

.calendar-days div.selected {
  background-color: #4CAF50; /* Green for selected date */
  color: white;
  font-weight: bold;
  border: 1px solid #4CAF50;
}

.calendar-days div.today {
  border: 2px solid #2196F3; /* Blue border for today */
}

.time-picker {
  margin-bottom: 20px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
}

.time-picker label {
  font-weight: bold;
  color: #333;
}

.time-picker select {
  padding: 8px 10px;
  border-radius: 5px;
  border: 1px solid #ccc;
  font-size: 1em;
  background-color: #fcfcfc;
}

#confirm-schedule-btn {
  background-color: #28a745; /* Green confirm button */
  color: white;
  padding: 12px 25px;
  border-radius: 5px;
  font-size: 1.1em;
  font-weight: bold;
  border: none;
  cursor: pointer;
  transition: background-color 0.2s ease-in-out;
}

#confirm-schedule-btn:hover {
  background-color: #218838;
}

.edit-icon {
  position: absolute;
  top: 10px;
  right: 10px;
  font-size: 1.5em;
  cursor: pointer;
  color: #888;
  background-color: rgba(255, 255, 255, 0.7);
  border-radius: 50%;
  padding: 5px;
  width: 30px; /* Make it a circle */
  height: 30px; /* Make it a circle */
  display: flex;
  justify-content: center;
  align-items: center;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
  transition: background-color 0.2s ease-in-out, color 0.2s ease-in-out;
}

.edit-icon:hover {
  background-color: #eee;
  color: #333;
}

.equal-height-btn {
  height: 40px;
  box-sizing: border-box;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px; /* Adds space between the icon and the text */
}

