body {
  font-family: Arial, sans-serif;
  margin: 20px;
  background: #f9f9f9;
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0 15px;
  margin-bottom: 15px;
}

th,
td {
  border: 1px solid #ddd;
  padding: 10px;
  text-align: center;
}

th {
  background-color: #4CAF50;
  color: white;
}

.total {
  font-weight: bold;
  background-color: #f0f0f0;
}

.delete-btn {
  background-color: #e74c3c;
  color: white;
  border: none;
  padding: 6px 10px;
  cursor: pointer;
  border-radius: 4px;
}

.delete-btn:hover {
  background-color: #c0392b;
}

input[type="text"],
input[type="number"] {
  width: 100%;
  padding: 6px;
  box-sizing: border-box;
  border: 1px solid #ccc;
  border-radius: 4px;
}

.add-candidate {
  padding: 10px 20px;
  background-color: #3498db;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  margin-top: 10px;
}

.add-candidate:hover {
  background-color: #2980b9;
}

.stats {
  margin-top: 10px;
  font-size: 1.1rem;
}

/* Modal Styles */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 999;
  align-items: center;
  justify-content: center;
  padding: 20px;
  box-sizing: border-box;
}

.modal-box {
  background: white;
  padding: 20px;
  border-radius: 8px;
  width: 100%;
  max-width: 320px;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
  text-align: center;
  box-sizing: border-box;
}

.confirm-btn,
.cancel-btn {
  padding: 8px 16px;
  border: none;
  border-radius: 4px;
  margin: 5px;
  cursor: pointer;
}

.confirm-btn {
  background-color: #e74c3c;
  color: white;
}

.cancel-btn {
  background-color: #ccc;
  color: #333;
}

.confirm-btn:hover {
  background-color: #c0392b;
}

.cancel-btn:hover {
  background-color: #b3b3b3;
}

/* Responsive Styles - Tablet */

@media (max-width: 767px) {
  table,
  thead,
  tbody,
  th,
  td,
  tr {
    display: block;
  }

  thead tr {
    display: none;
  }

  tr {
    margin-bottom: 15px;
    border: 1px solid #ccc;
    border-radius: 5px;
  }

  td {
    text-align: right;
    padding-left: 50%;
    position: relative;
  }

  td::before {
    content: attr(data-label);
    position: absolute;
    left: 10px;
    width: 45%;
    padding-left: 10px;
    font-weight: bold;
    text-align: left;
  }
}

/* Responsive Styles - Mobile */

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

  table {
    border: none;
  }

  thead {
    display: block;
    margin: 0 -10px 10px -10px;
    padding: 0;
    background-color: transparent;
  }

  thead tr {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    margin: 10px;
  }

  thead th {
    flex: 1 1 100%;
    text-align: center;
    padding: 8px;
    background-color: #4CAF50;
    color: white;
    border-bottom: 1px solid white;
  }

  tbody {
    display: flex;
    flex-direction: column;
    gap: 15px;
  }

  tbody tr {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 6px;
    background: #fff;
  }

  tbody td {
    display: block;
    border: none;
    padding: 0;
  }

  td[data-label]::before {
    display: none;
  }

  .delete-btn {
    width: 100%;
    margin-top: 5px;
  }

  .add-candidate {
    width: 100%;
    padding: 12px;
    font-size: 1rem;
    font-weight: bold;
    margin-top: 15px;
  }

  .stats {
    padding-top: 10px;
    font-size: 0.9rem;
  }
}
