/* Reset */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* Body */
body {
  font-family: "Segoe UI", sans-serif;
  background: #f4f4f4;
}

/* HERO */
.hero {
  background: url("https://images.unsplash.com/photo-1524492449090-1c3f5a2f8c6b") center/cover;
  height: 320px;
  color: white;
}

@media (max-width: 768px) {
  .hero {
    height: 240px;
  }
}

.overlay {
  background: linear-gradient(135deg, #8B0000 0%, #a52a2a 100%);
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.overlay h1 {
  font-size: 32px;
  font-weight: 700;
  margin-bottom: 15px;
}

@media (max-width: 768px) {
  .overlay h1 {
    font-size: 22px;
    margin-bottom: 10px;
    text-align: center;
  }
}

.logo {
  font-size: 14px;
  letter-spacing: 3px;
  margin-bottom: 10px;
  opacity: 0.8;
}

.subtitle {
  margin-bottom: 15px;
  font-size: 16px;
}

@media (max-width: 768px) {
  .logo {
    font-size: 12px;
    margin-bottom: 8px;
  }

  .subtitle {
    font-size: 13px;
    margin-bottom: 12px;
  }
}

/* NAV */
nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
}

nav a {
  color: white;
  margin: 0;
  text-decoration: none;
  padding: 10px 16px;
  border-radius: 25px;
  font-size: 14px;
  white-space: nowrap;
  border: 2px solid rgba(255,255,255,0.3);
  transition: all 0.3s ease;
}

nav a.active,
nav a:hover {
  background: rgba(255,255,255,0.2);
  border-color: white;
}

@media (max-width: 768px) {
  nav {
    gap: 10px;
    padding: 0 10px;
  }

  nav a {
    padding: 8px 14px;
    font-size: 13px;
    flex: 1;
    min-width: 140px;
    text-align: center;
    border-radius: 20px;
  }
}

/* INTRO */
.intro {
  margin-bottom: 40px;
  text-align: center;
}

.intro h2 {
  color: #8B0000;
  margin-bottom: 15px;
  font-size: 28px;
}

.intro p {
  color: #555;
  line-height: 1.6;
  font-size: 16px;
}

/* MAIN */
main {
  max-width: 1000px;
  margin: 30px auto;
  background: white;
  padding: 40px;
  border-radius: 10px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

@media (max-width: 768px) {
  main {
    margin: 15px;
    padding: 20px;
    border-radius: 8px;
  }
}

/* CARDS */
.cards {
  display: flex;
  gap: 25px;
  margin-top: 20px;
  flex-wrap: wrap;
}

@media (max-width: 768px) {
  .cards {
    gap: 15px;
  }
}

.card {
  flex: 1;
  min-width: 250px;
  background: linear-gradient(135deg, #fff5f5 0%, #fff0f0 100%);
  padding: 25px;
  border-left: 5px solid #8B0000;
  border-radius: 10px;
  box-shadow: 0 3px 15px rgba(139, 0, 0, 0.1);
  transition: all 0.3s ease;
  position: relative;
}

.card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 25px rgba(139, 0, 0, 0.2);
  background: linear-gradient(135deg, #fff0f0 0%, #ffe5e5 100%);
}

.card h3 {
  color: #8B0000;
  margin-bottom: 12px;
  font-size: 20px;
}

.card p {
  color: #666;
  line-height: 1.5;
  margin: 0;
}

/* TABLE */
table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  border-radius: 8px;
  overflow: hidden;
}

thead {
  background: linear-gradient(135deg, #8B0000 0%, #a52a2a 100%);
}

th {
  background: transparent;
  color: white;
  padding: 15px;
  font-weight: 600;
  text-align: center;
  border-bottom: 2px solid #6d0000;
}

td {
  padding: 14px 15px;
  text-align: center;
  border-bottom: 1px solid #e0e0e0;
  color: #333;
}

tbody tr {
  transition: all 0.3s ease;
}

tbody tr:nth-child(even) {
  background: #fafafa;
}

tbody tr:nth-child(odd) {
  background: white;
}

tbody tr:hover {
  background: #fff5f5;
  box-shadow: inset 0 0 10px rgba(139, 0, 0, 0.05);
}

tbody tr:last-child td {
  border-bottom: none;
}

@media (max-width: 768px) {
  table {
    font-size: 13px;
  }

  th, td {
    padding: 10px 8px;
  }

  th {
    padding: 12px 8px;
  }
}

/* STATUS */
.ok {
  color: green;
  font-weight: bold;
}

.mid {
  color: orange;
  font-weight: bold;
}

.low {
  color: red;
  font-weight: bold;
}

/* SUMMARY */
.summary {
  background: linear-gradient(135deg, #fff3cd 0%, #ffecb3 100%);
  padding: 20px;
  border-left: 5px solid orange;
  margin-bottom: 25px;
  border-radius: 8px;
  box-shadow: 0 3px 10px rgba(255, 152, 0, 0.15);
  font-size: 16px;
  color: #333;
  font-weight: 500;
}

/* FOOTER */
footer {
  text-align: center;
  padding: 15px;
  background: #8B0000;
  color: white;
}

@media (max-width: 768px) {
  footer {
    padding: 12px;
    font-size: 13px;
  }

  footer p {
    margin: 5px 0;
  }
}

/* SUB HEADER */
.sub-header {
  background: linear-gradient(135deg, #8B0000 0%, #a52a2a 100%);
  color: white;
  text-align: center;
  padding: 25px 15px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.sub-header h1 {
  margin-bottom: 20px;
  font-size: 26px;
  font-weight: 700;
}

.sub-header nav {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

.sub-header nav a {
  color: white;
  text-decoration: none;
  padding: 10px 16px;
  border-radius: 20px;
  transition: all 0.3s ease;
  border: 2px solid rgba(255,255,255,0.3);
  font-weight: 500;
  font-size: 13px;
}

.sub-header nav a:hover,
.sub-header nav a.active {
  background: rgba(255,255,255,0.2);
  border-color: white;
}

@media (max-width: 768px) {
  .sub-header {
    padding: 20px 10px;
  }

  .sub-header h1 {
    font-size: 22px;
    margin-bottom: 15px;
  }

  .sub-header nav {
    gap: 8px;
  }

  .sub-header nav a {
    padding: 8px 12px;
    font-size: 12px;
    border-radius: 18px;
    flex: 1;
    min-width: 110px;
  }
}

/* FORM */
.form-box {
  background: #fff5f5;
  padding: 15px;
  border-radius: 10px;
  margin-bottom: 20px;
}

.form-box input {
  padding: 10px;
  margin: 5px;
  width: calc(30% - 10px);
}

.form-box button {
  padding: 10px 15px;
  margin: 5px;
  border: none;
  background: #8B0000;
  color: white;
  cursor: pointer;
  border-radius: 5px;
}

.form-box button:hover {
  background: #b22222;
}

@media (max-width: 768px) {
  .form-box {
    padding: 12px;
  }

  .form-box input {
    width: calc(100% - 10px);
    padding: 8px;
    margin: 5px;
    font-size: 14px;
  }

  .form-box button {
    width: calc(100% - 10px);
    padding: 10px;
    margin: 5px;
    font-size: 14px;
  }
}

/* Nút xóa */
.danger {
  background: red !important;
}

/* FINANCE SUMMARY */
.finance-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
  margin-bottom: 40px;
}

.summary-box {
  padding: 15px;
  border-radius: 10px;
  text-align: center;
  color: white;
  box-shadow: 0 4px 15px rgba(0,0,0,0.15);
  transition: all 0.3s ease;
}

.summary-box:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 25px rgba(0,0,0,0.2);
}

.summary-box h3 {
  margin: 0 0 15px 0;
  font-size: 16px;
  font-weight: 600;
}

.summary-box .amount {
  font-size: 28px;
  font-weight: 700;
  margin: 10px 0 5px 0;
  white-space: nowrap;
}

.summary-box .currency {
  font-size: 14px;
  margin: 0;
  opacity: 0.9;
  white-space: nowrap;
}

.summary-box.income {
  background: linear-gradient(135deg, #27ae60 0%, #229954 100%);
}

.summary-box.expense {
  background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
}

.summary-box.balance {
  background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
}

@media (max-width: 768px) {
  .finance-summary {
    grid-template-columns: 1fr;
    gap: 15px;
    margin-bottom: 30px;
  }

  .summary-box .amount {
    font-size: 24px;
  }
}

/* SECTIONS */
.section {
  margin-bottom: 40px;
}

.section h2 {
  color: #8B0000;
  margin-bottom: 20px;
  font-size: 22px;
  border-bottom: 3px solid #8B0000;
  padding-bottom: 10px;
}

.section h3 {
  color: #8B0000;
  margin-top: 30px;
  margin-bottom: 20px;
}

/* INCOME BREAKDOWN */
.income-detail {
  background: linear-gradient(135deg, #f0f9ff 0%, #e6f7ff 100%);
  padding: 25px;
  border-radius: 10px;
  border-left: 5px solid #27ae60;
}

.income-breakdown {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
}

.breakdown-item {
  background: white;
  padding: 20px;
  border-radius: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  border-left: 4px solid #27ae60;
}

.breakdown-item .label {
  font-weight: 600;
  color: #333;
}

.breakdown-item .value {
  font-size: 18px;
  font-weight: 700;
  color: #27ae60;
  white-space: nowrap;
}

@media (max-width: 768px) {
  .income-detail {
    padding: 18px;
  }

  .income-breakdown {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .breakdown-item {
    padding: 15px;
  }

  .breakdown-item .label {
    font-size: 13px;
  }

  .breakdown-item .value {
    font-size: 16px;
  }
}

/* INCOME MANAGEMENT */
.income-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
  gap: 25px;
  margin-top: 30px;
}

.income-category {
  background: linear-gradient(135deg, #f0fff4 0%, #e6fffa 100%);
  padding: 25px;
  border-radius: 10px;
  box-shadow: 0 3px 15px rgba(39, 174, 96, 0.1);
  border-left: 5px solid #27ae60;
  transition: all 0.3s ease;
}

.income-category:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 25px rgba(39, 174, 96, 0.15);
}

.income-category h3 {
  color: #27ae60;
  margin-bottom: 15px;
  font-size: 18px;
  font-weight: 600;
  border-bottom: 2px solid #d5f4e6;
  padding-bottom: 10px;
}

.income-items {
  margin-bottom: 15px;
}

.income-item {
  display: flex;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid #d5f4e6;
  color: #555;
}

.income-item:last-child {
  border-bottom: none;
}

.income-name {
  flex: 1;
  color: #666;
}

.income-amount {
  color: #27ae60;
  font-weight: 600;
  text-align: right;
}

.income-category .category-total {
  background: rgba(39, 174, 96, 0.05);
  padding: 12px;
  border-radius: 6px;
  text-align: right;
  color: #333;
  font-weight: 500;
  border-right: 3px solid #27ae60;
}

@media (max-width: 768px) {
  .income-container {
    grid-template-columns: 1fr;
    gap: 15px;
    margin-top: 20px;
  }

  .income-category {
    padding: 18px;
  }

  .income-category h3 {
    font-size: 16px;
    margin-bottom: 12px;
  }

  .income-item {
    padding: 8px 0;
    font-size: 14px;
  }

  .income-name {
    font-size: 13px;
  }

  .income-amount {
    font-size: 13px;
  }

  .income-category .category-total {
    padding: 10px;
    font-size: 13px;
  }
}

/* EXPENSE MANAGEMENT */
.expense-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
  gap: 25px;
  margin-top: 30px;
}

@media (max-width: 768px) {
  .expense-container {
    grid-template-columns: 1fr;
    gap: 15px;
    margin-top: 20px;
  }
}

.expense-category {
  background: linear-gradient(135deg, #fff5f5 0%, #fff0f0 100%);
  padding: 25px;
  border-radius: 10px;
  box-shadow: 0 3px 15px rgba(139, 0, 0, 0.1);
  border-left: 5px solid #8B0000;
  transition: all 0.3s ease;
}

.expense-category:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 25px rgba(139, 0, 0, 0.15);
}

.expense-category h3 {
  color: #8B0000;
  margin-bottom: 15px;
  font-size: 18px;
  font-weight: 600;
  border-bottom: 2px solid #e0cccc;
  padding-bottom: 10px;
}

.expense-items {
  margin-bottom: 15px;
}

.expense-item {
  display: flex;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid #e8e0e0;
  color: #555;
}

.expense-item:last-child {
  border-bottom: none;
}

.expense-name {
  flex: 1;
  color: #666;
}

.expense-amount {
  color: #8B0000;
  font-weight: 600;
  text-align: right;
}

.category-total {
  background: rgba(139, 0, 0, 0.05);
  padding: 12px;
  border-radius: 6px;
  text-align: right;
  color: #333;
  font-weight: 500;
  border-right: 3px solid #8B0000;
}

@media (max-width: 768px) {
  .expense-category {
    padding: 18px;
  }

  .expense-category h3 {
    font-size: 16px;
    margin-bottom: 12px;
  }

  .expense-item {
    padding: 8px 0;
    font-size: 14px;
  }

  .expense-name {
    font-size: 13px;
  }

  .expense-amount {
    font-size: 13px;
  }

  .category-total {
    padding: 10px;
    font-size: 13px;
  }
}
