/* --- Shared Base Styles --- */

body {
  font-family: sans-serif;
  background-color: #fafafa;
  color: #222;
  margin: 0;
  padding: 20px;
}

nav {
  margin-bottom: 20px;
}

nav a {
  text-decoration: none;
  color: #0066cc;
  margin-right: 10px;
}

main {
  max-width: 1000px;
  margin: 0 auto;
}

h1, h2 {
  margin-bottom: 15px;
}

/* Summary box (used in index.html) */
#summary {
  background: white;
  border-radius: 8px;
  padding: 20px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.05);
}

/* UL lists (index.html) */
ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

li {
  padding: 10px 0;
  border-bottom: 1px solid #eee;
  display: flex;          /* used globally, overridden in Awesomplete */
  justify-content: space-between;
  font-size: 1.1em;
}

li:last-child {
  border-bottom: none;
}

/* --- Awesomplete dropdown fix --- */
.awesomplete > ul {
  max-height: 180px;
  overflow-y: auto;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
  text-align: left !important;
}

.awesomplete > ul > li {
  display: block !important;
  justify-content: flex-start !important;
  padding: 5px 10px;
}

/* Login overlay (index.html) */
#loginOverlay {
  position: fixed;
  top: 0;
  left: 0;
  right:0;
  bottom:0;
  background: rgba(0,0,0,0.4);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
}

#loginForm {
  background:white;
  padding:30px;
  border-radius:8px;
  box-shadow:0 2px 6px rgba(0,0,0,0.2);
  width:300px;
  text-align:center;
}

#loginForm input {
  width:100%;
  padding:10px;
  margin-bottom:10px;
  border-radius:6px;
  border:1px solid #ccc;
}

#loginForm button {
  width:100%;
  padding:10px;
  border:none;
  border-radius:6px;
  background:#0078d7;
  color:white;
  cursor:pointer;
}

#loginForm button:hover {
  background:#005fa3;
}

#loginError {
  color:red;
  margin-bottom:10px;
}

/* --- Transactions Page Styles --- */

form {
  margin-bottom: 30px;
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 10px 20px;
  background: white;
  padding: 20px;
  border-radius: 8px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.05);
  align-items: center;
}

form label {
  text-align: right;
  font-weight: bold;
}

form input {
  padding: 8px 10px;
  font-size: 1em;
  border-radius: 6px;
  border: 1px solid #ccc;
  width: 100%;
}

form input:focus {
  outline: none;
  border-color: #0078d7;
  box-shadow: 0 0 0 2px rgba(0,120,215,0.2);
}

form button {
  grid-column: 1 / -1;
  background-color: #0078d7;
  color: white;
  border: none;
  cursor: pointer;
  border-radius: 6px;
  padding: 10px;
  font-size: 1em;
  transition: background-color 0.2s;
}

form button:hover {
  background-color: #005fa3;
}

#deleteAllButton {
  background-color: #f44336;
  color: white;
  border: none;
  cursor: pointer;
  border-radius: 6px;
  padding: 10px;
  margin-bottom: 20px;
}

#deleteAllButton:hover {
  background-color: #c62828;
}

/* Table */
table {
  width: 100%;
  border-collapse: collapse;
  background: white;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 6px rgba(0,0,0,0.05);
}

th, td {
  padding: 10px;
  border-bottom: 1px solid #eee;
  text-align: left;
}

th {
  background-color: #f5f5f5;
  font-weight: bold;
}

tr:last-child td {
  border-bottom: none;
}

/* Action buttons */
button.edit, button.delete {
  border: none;
  border-radius: 6px;
  padding: 4px 8px;
  cursor: pointer;
  margin-right: 5px;
  color: white;
}

button.edit {
  background-color: #0078d7;
}
button.edit:hover { background-color: #005fa3; }

button.delete {
  background-color: #f44336;
}
button.delete:hover { background-color: #c62828; }

/* Mobile layout for transactions */
@media (max-width: 600px) {
  form {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  form label {
    text-align: left;
  }

  form button {
    grid-column: 1;
  }
}

/* --- Accounts / Pods Page Styles --- */

/* Pod container */
.pod {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 40px;
  border-bottom: 1px solid #ddd;
  background: white;
  border-radius: 8px;
  padding: 20px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.05);
}

.pod-summary {
  flex: 1;
  max-width: 45%;
}

.pod-chart {
  flex: 1;
  max-width: 50%;
}

canvas {
  width: 100% !important;
  height: 250px !important;
}

.year-list {
  margin-top: 10px;
}

.year-details {
  display: none;
  margin-left: 20px;
  margin-top: 8px;
}

.year-details ul {
  list-style-type: none;
  padding-left: 0;
  margin-left: 0;
}

.year-details li {
  margin: 4px 0;
  font-size: 0.9em;
}

.year-toggle {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.85em;
  margin-right: 6px;
}

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

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

/* Mobile layout for pods */
@media (max-width: 600px) {
  .pod {
    flex-direction: column;
  }
  
  .pod-summary,
  .pod-chart {
    max-width: 100%;
  }
}
