/* Reset and base */
* {
  margin: 0; padding: 0; box-sizing: border-box;
}
body {
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background: #f5f7fa;
  color: #333;
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  padding: 1rem;
}

/* Container */
.container {
  background: white;
  max-width: 900px;
  width: 100%;
  border-radius: 10px;
  box-shadow: 0 0 25px rgba(0,0,0,0.1);
  padding: 2rem;
  display: flex;
  flex-direction: column;
}

/* Header */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
}
header h2 {
  font-weight: 700;
  font-size: 1.6rem;
  color: #0a5f66;
}
#logoutBtn {
  background-color: #ff5c5c;
  border: none;
  color: white;
  padding: 7px 14px;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.3s ease;
}
#logoutBtn:hover {
  background-color: #e04e4e;
}

/* Form styling */
.form {
  display: grid;
  grid-template-columns: repeat(auto-fit,minmax(220px,1fr));
  gap: 1rem 2rem;
  margin-bottom: 2rem;
  align-items: flex-start;
}

.form label {
  font-weight: 600;
  margin-bottom: .2rem;
  display: block;
  color: #0a5f66;
}
.form select,
.form input[type="text"],
.form input[type="number"] {
  width: 100%;
  padding: 10px;
  border-radius: 6px;
  border: 1px solid #d1d9e6;
  font-size: 1rem;
  transition: border-color 0.3s ease;
}
.form select:focus,
.form input[type="text"]:focus,
.form input[type="number"]:focus {
  border-color: #0a5f66;
  outline: none;
}
.form button {
  grid-column: 1 / -1;
  width: 160px;
  justify-self: start;
  background-color: #0a5f66;
  color: white;
  border: none;
  font-weight: 700;
  padding: 12px 0;
  border-radius: 10px;
  cursor: pointer;
  user-select: none;
  transition: background-color 0.2s ease;
}
.form button:hover {
  background-color: #067575;
}

/* Main tabs nav */
.main-tabs {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.5rem;
  border-bottom: 2px solid #0a5f66;
}
.main-tabs .tab-btn {
  background: transparent;
  border: none;
  padding: 0.8rem 2rem;
  cursor: pointer;
  border-radius: 30px 30px 0 0;
  font-weight: 700;
  color: #0a5f66;
  border-bottom: 3px solid transparent;
  transition: all 0.3s ease;
  user-select: none;
}
.main-tabs .tab-btn.active {
  background-color: #0a5f66;
  color: white;
  border-bottom-color: #0a5f66;
  box-shadow: 0 4px 8px rgb(10 95 102 / 0.3);
}

/* Tab contents */
.tab-content {
  display: none;
}
.tab-content.active {
  display: block;
}

/* Filter buttons inside list tab */
.list-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1rem;
}
.filter-btn {
  cursor: pointer;
  padding: 0.5rem 1.2rem;
  background-color: #e6f0f0;
  border: none;
  border-radius: 30px;
  font-weight: 600;
  color: #0a5f66;
  transition: background-color 0.3s ease;
  user-select: none;
}
.filter-btn.active,
.filter-btn:hover {
  background-color: #0a5f66;
  color: white;
  box-shadow: 0 4px 8px rgb(10 95 102 / 0.25);
}

/* Export buttons */
.export-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.export-buttons button {
  padding: 10px 24px;
  font-weight: 600;
  color: #0a5f66;
  background: transparent;
  border: 2px solid #0a5f66;
  border-radius: 30px;
  cursor: pointer;
  transition: all 0.3s ease;
}
.export-buttons button:hover {
  background-color: #0a5f66;
  color: white;
  box-shadow: 0 5px 15px rgba(10,95,102,0.35);
}

/* Table container for horizontal scroll */
#table-container {
  overflow-x: auto;
  border-radius: 8px;
  box-shadow: 0 3px 8px rgba(10,95,102,0.1);
}

/* Table style */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  min-width: 700px;
}
thead {
  background-color: #0a5f66;
  color: white;
}
th, td {
  padding: 12px 20px;
  text-align: left;
  border-bottom: 1px solid #eef3f5;
}
tbody tr:hover {
  background-color: #e6f0f0;
  transition: background-color 0.2s ease;
}
th:first-child, td:first-child {
  width: 40px;
}
button[onclick*="editEntry"],
button[onclick*="deleteEntry"] {
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 1.1rem;
  color: #0a5f66;
  transition: color 0.3s ease;
  user-select: none;
}
button[onclick*="editEntry"]:hover {
  color: #2aa198;
}
button[onclick*="deleteEntry"]:hover {
  color: #ff5c5c;
}

/* Summary section */
#summary-container, #categorySummary {
  margin-top: 1rem;
  font-size: 1rem;
  font-weight: 600;
  color: #0a5f66;
  white-space: pre-line;
}

/* Responsive Media Queries */
@media (max-width: 720px) {
  .form {
    grid-template-columns: 1fr;
  }
  table {
    min-width: 100%;
    font-size: 0.85rem;
  }
  #summary-container, #categorySummary {
    font-size: 0.9rem;
  }
}
@media (max-width: 400px) {
  header h2 {
    font-size: 1.3rem;
  }

  .form button {
    width: 100%;
  }
  .export-buttons {
    flex-direction: column;
  }
}
