/* ========================================
   Base Styles
   ======================================== */

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: #f8f9fa;
  margin: 0;
  padding: 0;
  color: #333;
}

/* ========================================
   Navigation
   ======================================== */

.main-menu {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem 1rem;
  background: #fff;
  box-shadow: 0 4px 20px rgba(0,0,0,0.08);
  margin-bottom: 2rem;
  border-bottom: 1px solid #e0e0e0;
}

.hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 4px;
  background: transparent !important;
  border: none;
  cursor: pointer;
  padding: 0;
  margin: 0;
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  z-index: 1001;
  width: 24px;
  height: 20px;
  box-shadow: none !important;
}

.hamburger:hover {
  transform: translateY(-50%);
  box-shadow: none !important;
  background: transparent !important;
}

.hamburger:active {
  transform: translateY(-50%);
  box-shadow: none !important;
}

.hamburger span {
  width: 24px;
  height: 2.5px;
  background: #333;
  border-radius: 2px;
  transition: all 0.3s ease;
  display: block;
}

.nav-links {
  display: flex;
  gap: 0.5rem;
}

.main-menu a {
  display: inline-block;
  padding: 0.75rem 1.25rem;
  color: #555;
  text-decoration: none;
  font-weight: 500;
  border-radius: 8px;
  transition: all 0.3s ease;
}

.main-menu a:hover {
  background: #f0f0f0;
  color: #00bcd4;
  transform: translateY(-2px);
}

.main-menu a.active {
  background: linear-gradient(135deg, #00bcd4 0%, #0097a7 100%);
  color: white;
  box-shadow: 0 4px 15px 0 rgba(0,188,212,0.4);
}

/* Mobile Menu */
.mobile-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1001;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.mobile-overlay.active {
  display: block;
  opacity: 1;
}

.mobile-menu {
  position: fixed;
  top: 0;
  left: -280px;
  width: 280px;
  height: 100vh;
  background: #fff;
  z-index: 1002;
  transition: left 0.3s ease;
  box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
  overflow-y: auto;
}

.mobile-menu.active {
  left: 0;
}

.mobile-menu-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.5rem 1rem;
  border-bottom: 1px solid #e0e0e0;
  background: linear-gradient(135deg, #00bcd4 0%, #0097a7 100%);
}

.mobile-menu-header .profile-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.mobile-menu-header .profile-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: white;
  color: #00bcd4;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 1rem;
}

.mobile-menu-header .profile-name {
  color: white;
  font-weight: 600;
  font-size: 1rem;
}

.close-menu {
  background: none;
  border: none;
  color: white;
  font-size: 2rem;
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.mobile-menu-links {
  padding: 1rem 0;
}

.mobile-menu-links a {
  display: block;
  padding: 1rem 1.5rem;
  color: #333;
  text-decoration: none;
  font-weight: 500;
  transition: background 0.2s ease;
  border-bottom: 1px solid #e5e5e5;
}

.mobile-menu-links a:last-child {
  border-bottom: none;
}

.mobile-menu-links a:hover {
  background: #f5f5f5;
  color: #00bcd4;
}

@media (max-width: 768px) {
  .hamburger {
    display: flex;
  }
  
  .nav-links {
    display: none;
  }
  
  .main-menu {
    justify-content: center;
  }
}

.profile-menu {
  position: absolute;
  top: 50%;
  right: 5%;
  transform: translateY(-50%);
}

@media (max-width: 640px) {
  .profile-menu {
    right: 1rem;
  }
}

.profile-trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  padding: 6px 12px;
  border-radius: 20px;
  transition: background 0.2s;
}

.profile-trigger:hover {
  background: #f5f5f5;
}

.profile-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #00bcd4 0%, #0097a7 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 600;
  font-size: 0.9rem;
  text-transform: uppercase;
}

.profile-name {
  font-size: 0.9rem;
  color: #333;
  font-weight: 500;
}

.profile-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: white;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  min-width: 180px;
  overflow: hidden;
  z-index: 1000;
}

.profile-menu.active .profile-dropdown {
  display: block;
}

.profile-dropdown a,
.profile-dropdown button {
  display: block;
  width: 100%;
  padding: 12px 16px;
  text-align: left;
  color: #555;
  text-decoration: none;
  border: none;
  border-bottom: 1px solid #e5e5e5;
  border-radius: 0;
  background: none;
  font-size: 0.9rem;
  cursor: pointer;
  transition: color 0.2s;
  box-sizing: border-box;
  outline: none;
}

.profile-dropdown a:last-child,
.profile-dropdown button:last-child {
  border-bottom: none;
  border-radius: 0 0 8px 8px;
  margin-bottom: 0;
  padding-bottom: 12px;
}

.profile-dropdown a:hover,
.profile-dropdown button:hover,
.profile-dropdown a:focus,
.profile-dropdown button:focus {
  color: #00bcd4;
  outline: none;
}



/* ========================================
   Forms
   ======================================== */

.form-wrapper {
  display: flex;
  justify-content: center;
  padding: 2rem 1rem;
}

.container {
  background: #fff;
  padding: 2rem;
  border-radius: 12px;
  box-shadow: 0 8px 32px 0 rgba(0,0,0,0.1);
  width: 100%;
  max-width: 400px;
  margin: 0 auto;
  border: 1px solid #e0e0e0;
  box-sizing: border-box;
}

@media (max-width: 640px) {
  .container {
    padding: 1.5rem;
    margin: 0 1rem;
  }
}

.container h2 {
  margin-top: 0;
  font-size: 1.5rem;
  text-align: center;
  background: linear-gradient(135deg, #00bcd4 0%, #0097a7 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-weight: 600;
}

form {
  display: flex;
  flex-direction: column;
}

#payment_reason_field {
  display: flex;
  flex-direction: column;
}

label {
  margin-top: 0.5rem;
  font-weight: 500;
  color: #555;
  font-size: 0.9rem;
}

input, select {
  margin: 0.5rem 0;
  padding: 10px 12px;
  font-size: 14px;
  border-radius: 8px;
  border: 1px solid #e0e0e0;
  width: 100%;
  box-sizing: border-box;
  transition: all 0.3s ease;
}

select option[value=""] {
  color: #999;
}

input:focus, select:focus {
  outline: none;
  border-color: #00bcd4;
  box-shadow: 0 0 0 3px rgba(0,188,212,0.1);
}

button {
  background: linear-gradient(135deg, #00bcd4 0%, #0097a7 100%);
  color: white;
  border: none;
  cursor: pointer;
  font-weight: 500;
  margin-top: 1rem;
  width: 100%;
  padding: 10px 20px;
  border-radius: 8px;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px 0 rgba(0,188,212,0.4);
}

button:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px 0 rgba(0,188,212,0.6);
}

button:active {
  transform: translateY(0);
}

/* Button variants for forms */
.btn {
  display: inline-block;
  padding: 10px 20px;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 500;
  text-align: center;
  cursor: pointer;
  border: none;
  transition: all 0.3s ease;
}

.btn-primary {
  background: linear-gradient(135deg, #00bcd4 0%, #0097a7 100%);
  color: white;
  box-shadow: 0 4px 15px 0 rgba(0,188,212,0.4);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px 0 rgba(0,188,212,0.6);
}

.btn-secondary {
  background: #e0e0e0;
  color: #555;
}

.btn-secondary:hover {
  background: #d5d5d5;
  transform: translateY(-2px);
}

/* Button variants without shadow */
.btn-flat {
  background: linear-gradient(135deg, #00bcd4 0%, #0097a7 100%);
  color: white;
  border: none;
  cursor: pointer;
  font-weight: 500;
  padding: 10px 20px;
  border-radius: 8px;
  transition: all 0.3s ease;
  box-shadow: none !important;
  margin-top: 0;
  width: auto;
}

.btn-flat:hover {
  background: linear-gradient(135deg, #00acc4 0%, #008797 100%);
  transform: translateY(-1px);
  box-shadow: none !important;
}

.btn-flat:active {
  transform: translateY(0);
}

.btn-flat-danger {
  background: linear-gradient(135deg, #f44336 0%, #d32f2f 100%);
  color: white;
  border: none;
  cursor: pointer;
  font-weight: 500;
  padding: 10px 20px;
  border-radius: 8px;
  transition: all 0.3s ease;
  box-shadow: none !important;
  margin-top: 0;
  width: auto;
}

.btn-flat-danger:hover {
  background: linear-gradient(135deg, #e53935 0%, #c62828 100%);
  transform: translateY(-1px);
  box-shadow: none !important;
}

.btn-flat-danger:active {
  transform: translateY(0);
}

/* ========================================
   Dashboard
   ======================================== */

.dashboard-container {
  max-width: 1200px;
  width: 100%;
  margin: 0 auto 2rem auto;
  padding: 2rem;
  background: white;
  border-radius: 8px;
  box-shadow: 0 0 10px rgba(0,0,0,0.1);
  box-sizing: border-box;
}

@media (max-width: 768px) {
  .dashboard-container {
    padding: 0.75rem;
    margin: 0.5rem;
    border-radius: 8px;
    box-shadow: 0 0 5px rgba(0,0,0,0.1);
  }

  .dashboard-container h1 {
    font-size: 1.5rem;
    margin-bottom: 1.25rem;
  }

  .dashboard-tabs {
    width: 100%;
    margin-bottom: 1.5rem;
    padding: 3px;
  }

  .tab-btn {
    padding: 0.6rem 1rem;
    font-size: 0.85rem;
    flex: 1;
  }
}

.dashboard-container h1 {
  text-align: center;
  color: #333;
  margin-bottom: 2rem;
}

/* Dashboard Tabs */
.dashboard-tabs {
  display: flex;
  gap: 0;
  justify-content: center;
  margin-bottom: 2rem;
  background: #f0f0f0;
  border-radius: 8px;
  padding: 4px;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
  width: fit-content;
  margin-left: auto;
  margin-right: auto;
}

.tab-btn {
  padding: 0.8rem 2rem;
  background: none;
  border: none;
  border-radius: 6px;
  color: #555;
  font-weight: 500;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.3s ease;
  margin: 0;
  box-shadow: none !important;
  width: auto;
  white-space: nowrap;
}

.tab-btn:hover {
  color: #00bcd4;
  box-shadow: none !important;
  transform: none;
}

.tab-btn.active {
  background: linear-gradient(135deg, #00bcd4 0%, #0097a7 100%);
  color: white;
  box-shadow: 0 2px 8px rgba(0,188,212,0.3) !important;
  font-weight: 600;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

.view-toggle {
  display: flex;
  gap: 0;
  background: #f0f0f0;
  border-radius: 8px;
  padding: 4px;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
}

.toggle-btn {
  padding: 0.6rem 1.2rem;
  border-radius: 6px;
  text-decoration: none;
  color: #555;
  font-weight: 500;
  font-size: 0.9rem;
  transition: all 0.3s ease;
  white-space: nowrap;
}

.toggle-btn:hover {
  color: #00bcd4;
}

.toggle-btn.active {
  background: linear-gradient(135deg, #00bcd4 0%, #0097a7 100%);
  color: white;
  box-shadow: 0 2px 8px rgba(0,188,212,0.3);
}

@media (max-width: 640px) {
  .view-toggle {
    padding: 3px;
  }
  
  .toggle-btn {
    padding: 0.5rem 0.8rem;
    font-size: 0.85rem;
  }
}

.summary-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 2rem;
  align-items: stretch;
  max-width: 900px;
  margin-left: auto;
  margin-right: auto;
}

.card {
  padding: 0.75rem;
  border-radius: 8px;
  text-align: center;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.card.income {
  background: linear-gradient(135deg, #00bcd4 0%, #0097a7 100%);
  color: white;
}

.card.expenses {
  background: linear-gradient(135deg, #ff6b6b 0%, #ee5a52 100%);
  color: white;
}

.card.net {
  background: linear-gradient(135deg, #51cf66 0%, #37b24d 100%);
  color: white;
}

.card h3 {
  margin: 0 0 0.35rem 0;
  font-size: 0.65rem;
  opacity: 0.85;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.card .amount {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
}

.section {
  margin: 2rem 0;
}

.section h2 {
  color: #333;
  border-bottom: 2px solid #00bcd4;
  padding-bottom: 0.5rem;
  margin-bottom: 1rem;
}

.charts-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
  margin-bottom: 2rem;
}

@media (max-width: 768px) {
  .charts-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  
  .summary-cards {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

  .card h3 {
    font-size: 0.95rem;
    margin-bottom: 0.5rem;
  }

  .card .amount {
    font-size: 1.5rem;
  }
  
  .chart-card {
    padding: 0.75rem;
    background: #fff;
    width: 100%;
  }

  .chart-card h2 {
    font-size: 1rem;
    margin-bottom: 0.75rem;
  }

  .chart-card canvas {
    max-height: 250px;
    width: 100% !important;
  }

  .section {
    margin-bottom: 1.5rem;
  }

  .section h2 {
    font-size: 1.2rem;
    margin-bottom: 0.75rem;
  }
  
  table {
    font-size: 0.8rem;
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  table th,
  table td {
    padding: 0.5rem 0.35rem;
    font-size: 0.8rem;
    white-space: nowrap;
  }

  .action-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    align-items: flex-start;
  }

  .action-buttons button,
  .action-buttons .btn-edit,
  .action-buttons .btn-delete {
    font-size: 0.75rem;
    padding: 0.4rem 0.8rem;
    width: auto;
  }

  .action-buttons form {
    width: 100%;
  }

  .no-data {
    font-size: 0.9rem;
    padding: 1.5rem;
  }
}

.chart-card {
  background: #f9f9f9;
  padding: 1.5rem;
  border-radius: 8px;
}

.chart-card h2 {
  color: #333;
  margin-top: 0;
  margin-bottom: 1rem;
  text-align: center;
  font-size: 1rem;
}

.chart-card canvas {
  max-height: 300px;
  max-width: 100%;
  margin: 0 auto;
  display: block;
}

/* ========================================
   Tables
   ======================================== */

table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1rem;
  background: white;
}

table thead {
  background: #f8f9fa;
  color: #555;
}

table th,
table td {
  padding: 0.75rem;
  text-align: left;
  border-bottom: 1px solid #ddd;
}

table tbody tr:hover {
  background: #f5f5f5;
}

.no-data {
  text-align: center;
  color: #999;
  padding: 2rem;
  font-style: italic;
}

/* Action buttons in tables */
.action-buttons {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  justify-content: flex-start;
}

.action-buttons form {
  margin: 0;
  padding: 0;
  display: inline-flex;
}

.btn-edit,
.btn-delete {
  cursor: pointer;
  font-size: 0.85rem;
  padding: 0.4rem 0.8rem;
  border-radius: 4px;
  transition: all 0.2s ease;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 500;
  white-space: nowrap;
  border: none;
  font-family: inherit;
  line-height: normal;
  margin: 0;
  box-shadow: none;
  width: auto;
}

.btn-edit {
  background: #2196F3;
  color: white;
}

.btn-edit:hover {
  background: #1976D2;
  transform: translateY(-1px);
  box-shadow: none;
}

.btn-delete {
  background: #f44336;
  color: white;
}

.btn-delete:hover {
  background: #d32f2f;
  transform: translateY(-1px);
  box-shadow: none;
}

/* ========================================
   Utility Classes
   ======================================== */

.divider {
  height: 1px;
  background: #e5e5e5;
  margin: 4px 0;
}

/* ========================================
   Edit Modal Styles
   ======================================== */

.edit-modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  justify-content: center;
  align-items: center;
  overflow-y: auto;
  padding: 20px;
}

.edit-modal-overlay.active {
  display: flex;
}

.edit-modal {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
  max-width: 600px;
  width: 100%;
  padding: 24px;
  animation: modalSlideIn 0.3s ease-out;
  max-height: 90vh;
  overflow-y: auto;
}

@keyframes modalSlideIn {
  from {
    transform: translateY(-50px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.edit-modal h3 {
  margin: 0 0 20px 0;
  font-size: 1.3rem;
  color: #333;
  border-bottom: 2px solid #00bcd4;
  padding-bottom: 10px;
}

.edit-modal .form-group {
  margin-bottom: 16px;
}

.edit-modal .form-group label {
  display: block;
  margin-bottom: 6px;
  font-weight: 500;
  color: #555;
  font-size: 0.9rem;
}

.edit-modal .form-group input,
.edit-modal .form-group select,
.edit-modal .form-group textarea {
  width: 100%;
  padding: 10px 12px;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  font-size: 0.95rem;
  box-sizing: border-box;
  transition: border-color 0.2s;
}

.edit-modal .form-group input:focus,
.edit-modal .form-group select:focus,
.edit-modal .form-group textarea:focus {
  outline: none;
  border-color: #00bcd4;
}

.edit-modal-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid #e0e0e0;
}

.edit-modal-actions button {
  padding: 10px 24px;
  border: none;
  border-radius: 8px;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: none !important;
}

.edit-modal-cancel {
  background: #f0f0f0;
  color: #555;
}

.edit-modal-cancel:hover {
  background: #e0e0e0;
}

.edit-modal-save {
  background: linear-gradient(135deg, #00bcd4 0%, #0097a7 100%);
  color: #fff;
}

.edit-modal-save:hover {
  transform: translateY(-2px);
}

/* ========================================
   Confirmation Modal Styles
   ======================================== */

.confirm-modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  justify-content: center;
  align-items: center;
}

.confirm-modal-overlay.active {
  display: flex;
}

.confirm-modal {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
  max-width: 400px;
  width: 90%;
  padding: 24px;
  animation: modalSlideIn 0.3s ease-out;
}

.confirm-modal h3 {
  margin: 0 0 12px 0;
  font-size: 1.2rem;
  color: #d32f2f;
}

.confirm-modal p {
  margin: 0 0 20px 0;
  color: #555;
  line-height: 1.5;
}

.confirm-modal-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

.confirm-modal-actions button {
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: none !important;
}

.confirm-modal-cancel {
  background: #f0f0f0;
  color: #555;
}

.confirm-modal-cancel:hover {
  background: #e0e0e0;
  box-shadow: none !important;
}

.confirm-modal-delete {
  background: linear-gradient(135deg, #d32f2f 0%, #b71c1c 100%);
  color: #fff;
}

.confirm-modal-delete:hover {
  transform: translateY(-2px);
  box-shadow: none !important;
}

/* ========================================
   Flash Messages
   ======================================== */

.flash-messages {
  list-style: none;
  padding: 0;
  margin: 0 0 24px 0;
}

.flash-messages li {
  padding: 10px 14px;
  border-radius: 6px;
  margin-bottom: 8px;
  font-size: 0.9rem;
}

.flash-messages li.success {
  background: #d4edda;
  color: #155724;
  border-left: 4px solid #28a745;
}

.flash-messages li.danger {
  background: #f8d7da;
  color: #721c24;
  border-left: 4px solid #dc3545;
}

.flash-messages li.warning {
  background: #fff3cd;
  color: #856404;
  border-left: 4px solid #ffc107;
}
