/* ----------------------------------------
   Flexbox Base to Keep Footer at Bottom
---------------------------------------- */
html, body {
  height: 100%;
  margin: 0;
  padding: 0;
}

body {
  display: flex;
  flex-direction: column;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(135deg, #fdfbfb, #ebedee);
  color: #333;
}

/* ----------------------------------------
   Dark-mode toggle effect
---------------------------------------- */
body.fancy-effect {
  background: linear-gradient(135deg, #333, #111);
  color: #FF7043;
}
body.fancy-effect .container { background: #444; }
body.fancy-effect footer { color: #aaa; background: #222; }

/* ----------------------------------------
   Centered container styling
---------------------------------------- */
.container {
  flex: 1;
  display: flex;
  flex-direction: column;
  max-width: 960px;
  margin: 30px auto;
  padding: 20px;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 8px 20px rgba(0,0,0,0.1);
}

/* ----------------------------------------
   Main heading
---------------------------------------- */
h1 {
  text-align: center;
  color: #FF7043;
  margin-bottom: 20px;
}

/* ----------------------------------------
   Controls (search input + buttons)
---------------------------------------- */
.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  margin-bottom: 20px;
}
.controls input,
.controls button {
  padding: 10px 14px;
  font-size: 14px;
  border: 1px solid #ccc;
  border-radius: 6px;
  transition: 0.2s;
}
.controls input:focus {
  border-color: #FF7043;
  outline: none;
}
.controls button {
  background: #FF7043;
  color: #fff;
  border: none;
  cursor: pointer;
}
.controls button:hover {
  background: #E64A19;
}

/* ----------------------------------------
   Contact counter text
---------------------------------------- */
#contactCounter {
  text-align: center;
  font-weight: bold;
  margin-bottom: 15px;
}

/* ----------------------------------------
   Header row
---------------------------------------- */
.contact-header {
  display: grid;
  grid-template-columns: 1fr 3fr 3fr 1.5fr;
  list-style: none;
  padding: 0;
  margin: 1rem 0 0.5rem;
  background: #FF7043;
  color: #fff;
  font-weight: bold;
}
.contact-header li {
  padding: 10px;
}

/* ----------------------------------------
   Contact list items
---------------------------------------- */
.contact-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.contact-list li {
  display: grid;
  grid-template-columns: 1fr 3fr 3fr 1.5fr;
  align-items: center;
  background: #fff;
  border-radius: 6px;
  padding: 10px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
  gap: 0.5rem;
}
.contact-list li img {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid #FF7043;
}
.contact-list li .name,
.contact-list li .phone,
.contact-list li .actions {
  padding: 5px;
}

/* Hover highlight */
.contact-list li.hovered {
  background-color: #fde3e3;
}

/* Actions */
.contact-list li .actions {
  display: flex;
  gap: 0.5rem;
}
.contact-list li .actions button {
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  transition: color 0.2s;
}
.contact-list li .actions button:hover {
  color: #FF7043;
}

/* ----------------------------------------
   No-contacts message
---------------------------------------- */
#noContactsMsg {
  text-align: center;
  font-style: italic;
  margin-top: 20px;
}

/* ----------------------------------------
   Popup form overlay
---------------------------------------- */
.popup {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
.popup form {
  background: #fff;
  padding: 20px;
  border-radius: 8px;
  width: 90%;
  max-width: 320px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: 0 6px 18px rgba(0,0,0,0.15);
}
.popup input,
.popup textarea {
  padding: 8px 10px;
  font-size: 14px;
  border: 1px solid #ccc;
  border-radius: 4px;
}
.popup-buttons {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
}
.popup-buttons button {
  padding: 8px 12px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-weight: bold;
}
.popup-buttons button[type="submit"] {
  background: #FF7043;
  color: #fff;
}
.popup-buttons button[type="button"] {
  background: #ccc;
}
.popup-buttons button:hover {
  opacity: 0.9;
}
.dark-card {
  background-color: #000000;
  color: #000000;
  border: 1px solid #291515;
  box-shadow: 0 0 10px rgba(0,0,0,0.5);
  transition: 0.3s ease;
}

/* ----------------------------------------
   Utility: hide elements
---------------------------------------- */
.hidden {
  display: none;
}

/* ----------------------------------------
   Footer at bottom of page
---------------------------------------- */
footer {
  text-align: center;
  font-size: 14px;
  color: #666;
  padding: 15px;
  background: #f4f4f4;
}

/* ----------------------------------------
   Responsive (Mobile)
---------------------------------------- */
@media (max-width: 600px) {
  .contact-list li {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .contact-list li .actions {
    justify-self: center;
  }
}

/* ----------------------------------------
   Favourite star button
---------------------------------------- */
button.favourite {
  font-size: 20px;
  color: gray;
  background: none;
  border: none;
  cursor: pointer;
}
button.favourite.active {
  color: gold;
}
