/* Global styles */
body {
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  min-height: 100vh;
  background-color: #f5f7fa;
}

.container {
  padding-bottom: 2rem;
}

@media (max-width: 768px) {
  .container {
    padding-left: 0.5rem;
    padding-right: 0.5rem;
  }

  .col-md-10.offset-md-1 {
    padding: 0;
  }
}

/* Card styles */
.card {
  max-width: 100%;
  margin-bottom: 20px;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.1);
  border-radius: 12px;
  overflow: hidden;
  transition: all 0.3s ease;
  border: none;
}

.card.login {
  max-width: 500px;
  margin: 2rem auto;
}

.card:hover {
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  transform: translateY(-2px);
}

/* Card header styling */
.card-header {
  padding: 1.5rem;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.card-header.bg-primary {
  background: #f7df1e !important;
}

.card-body {
  padding: 2rem;
}

/* Login form */
.login > .card-header h3 {
  margin: auto;
  text-align: center;
}

/* Form layout with grid */
form {
  display: grid;
  grid-template-columns: 1fr;
  grid-gap: 1.5rem;
}

/* Improve form group spacing and layout */
.form-group {
  display: flex;
  flex-direction: column;
  margin-bottom: 0.5rem;
}

/* Add proper spacing between label and input */
.form-group label {
  font-weight: 600;
  color: #495057;
}

/* Make inputs consistent */
.form-control {
  border-radius: 8px;
  padding: 0.75rem 1rem;
  border: 1px solid #dde0e5;
  transition: all 0.2s ease-in-out;
}

/* Special styling for checkbox container */
.form-check {
  display: flex;
  align-items: center;
  margin: 0.5rem 0;
}

.form-check-input {
  margin-right: 0.5rem;
  margin-left: 0;
}

.form-check-label {
  margin-bottom: 0;
}

/* Login button styling */
#login-button,
#add-transaction-button {
  width: 100%;
  padding: 0.75rem;
  font-weight: 600;
  background: #f7df1e;
  border: none;
}

#login-button:hover,
#add-transaction-button:hover {
  cursor: pointer;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(108, 92, 231, 0.2);
}

/* Error message styling */
.alert-danger {
  border-radius: 8px;
  background-color: rgba(231, 76, 60, 0.1);
  border: 1px solid rgba(231, 76, 60, 0.2);
  color: #e74c3c;
}

.invalid-feedback {
  display: none;
  width: 100%;
  margin-top: 0.25rem;
  font-size: 80%;
  color: #e74c3c;
}

/* Table styling */
.table {
  width: 100%;
  margin-bottom: 1rem;
  border-collapse: separate;
  border-spacing: 0;
}

.table th,
.table td {
  padding: 1rem;
  vertical-align: middle;
}

.table thead th {
  background-color: #f8f9fa;
  border-bottom: 2px solid #dee2e6;
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.85rem;
  letter-spacing: 0.5px;
  color: #495057;
}

.table tbody tr {
  transition: background-color 0.2s ease;
}

.table tbody tr:hover {
  background-color: rgba(0, 123, 255, 0.05);
}

.table-striped tbody tr:nth-of-type(odd) {
  background-color: rgba(0, 0, 0, 0.02);
}

/* Text styling */
.text-success {
  color: #38b06e !important;
  font-weight: 600;
}

.text-danger {
  color: #e74c3c !important;
  font-weight: 600;
}

#balance {
  font-size: 2.25rem;
  font-weight: 700;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.1);
}

/* Transactions page specific styles */
#name-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.btn {
  border-radius: 8px;
  padding: 0.625rem 1.25rem;
  font-weight: 500;
  letter-spacing: 0.5px;
  transition: all 0.2s ease;
}

.btn-light {
  background-color: rgba(255, 255, 255, 0.2);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.btn-light:hover {
  background-color: rgba(255, 255, 255, 0.3);
}

.btn-danger {
  background-color: #e74c3c;
  border-color: #e74c3c;
}

.btn-danger:hover {
  background-color: #bb2d3b;
  border-color: #b02a37;
}

/* Table cell with description (potentially long text) */
.table td:nth-child(3) {
  max-width: 200px;
  white-space: pre-wrap;
  word-break: break-word;
}

/* Responsive styles */
@media (max-width: 992px) {
  .row {
    flex-direction: column;
  }

  .col-md-6 {
    width: 100%;
    padding: 0;
    margin-bottom: 1.5rem;
  }

  .col-md-6:last-child {
    margin-bottom: 0;
  }
}

@media (max-width: 768px) {
  .card-header {
    flex-direction: column;
    align-items: flex-start !important;
  }

  .card-header div {
    margin-top: 1rem;
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
  }

  .table {
    display: block;
    overflow-x: auto;
  }

  #balance {
    font-size: 1.75rem;
  }

  .btn {
    padding: 0.5rem 1rem;
  }
}

@media (max-width: 576px) {
  .card {
    margin: 1rem 0;
    max-width: none;
  }

  .card-body {
    padding: 1.5rem;
  }

  .table th,
  .table td {
    padding: 0.75rem 0.5rem;
    font-size: 0.9rem;
  }

  .card-header h3 {
    font-size: 1.25rem;
  }
}

/* Ensure validation looks right */
input.is-invalid,
textarea.is-invalid,
select.is-invalid {
  border-color: #e74c3c;
  padding-right: calc(1.5em + 0.75rem);
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' width='12' height='12' fill='none' stroke='%23dc3545'%3e%3ccircle cx='6' cy='6' r='4.5'/%3e%3cpath stroke-linejoin='round' d='M5.8 3.6h.4L6 6.5z'/%3e%3ccircle cx='6' cy='8.2' r='.6' fill='%23dc3545' stroke='none'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right calc(0.375em + 0.1875rem) center;
  background-size: calc(0.75em + 0.375rem) calc(0.75em + 0.375rem);
}

input.is-invalid ~ .invalid-feedback,
textarea.is-invalid ~ .invalid-feedback,
select.is-invalid ~ .invalid-feedback {
  display: block;
}
