/* Reset and Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --primary-color: #2196F3;
  --success-color: #4CAF50;
  --danger-color: #F44336;
  --warning-color: #FF9800;
  --info-color: #00BCD4;
  --dark-color: #333;
  --light-color: #f8f9fa;
  --border-color: #ddd;
  --shadow: 0 2px 4px rgba(0,0,0,0.1);
  --shadow-lg: 0 4px 8px rgba(0,0,0,0.15);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: #f5f7fa;
  color: var(--dark-color);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

html {
  scroll-behavior: smooth;
}

/* Navigation */
.navbar {
  background: white;
  box-shadow: var(--shadow);
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 0;
}

.nav-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: auto;
  flex-wrap: wrap;
}

.nav-brand {
  font-size: 1.5rem;
  font-weight: bold;
  color: var(--primary-color);
  display: flex;
  align-items: center;
  gap: 10px;
  margin-right: 40px;
  padding: 0;
  line-height: 0;
}

.nav-logo {
  width: 200px;
  height: auto;
  object-fit: contain;
  display: block;
  margin: 0;
}

.nav-menu {
  display: flex;
  list-style: none;
  gap: 8px;
  flex-wrap: wrap;
  margin: 0;
  padding: 0;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  color: var(--dark-color);
  text-decoration: none;
  border-radius: 8px;
  transition: all 0.3s;
  white-space: nowrap;
}

.nav-link:hover {
  background: var(--light-color);
  color: var(--primary-color);
}

.nav-link.active {
  background: var(--primary-color);
  color: white;
}

/* Main Content */
.main-content {
  max-width: 1400px;
  margin: 0 auto;
  padding: 30px 20px;
}

.page {
  display: none;
}

.page.active {
  display: block;
  animation: fadeIn 0.3s;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
}

.page-header-with-tabs {
  display: flex;
  justify-content: flex-start;
  align-items: baseline;
  gap: 2rem;
  flex-wrap: wrap;
  min-height: 42px;
}

.page-header-with-tabs .date-filter {
  margin-left: auto;
  display: flex;
  align-items: baseline;
}

.page-header-with-tabs h1 {
  margin: 2px 0 0 0;
  height: 42px;
  line-height: 42px;
}

.page-header h1 {
  font-size: 2rem;
  color: var(--dark-color);
}

.page-header > div {
  display: flex;
  gap: 10px;
}

.sub-nav-inline {
  margin: 0;
  padding: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  height: 42px;
}

.sub-nav-inline .sub-nav-btn {
  height: 100%;
  padding: 0 16px;
  font-size: 0.875rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border: none;
  cursor: pointer;
  white-space: nowrap;
}

.me-2 {
  margin-right: 0.5rem;
}

/* Cards */
.card {
  background: white;
  border-radius: 12px;
  box-shadow: var(--shadow);
  overflow: visible;
  margin-bottom: 20px;
}

.card-header {
  padding: 20px;
  border-bottom: 1px solid var(--border-color);
  background: var(--light-color);
}

.card-header h3 {
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--dark-color);
  margin: 0;
}

.card-body {
  padding: 20px;
}

.card-body canvas {
  max-width: 100%;
  height: auto !important;
}

/* Card Grid */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}

@media (max-width: 768px) {
  .card-grid {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
  }
}

@media (max-width: 480px) {
  .card-grid {
    grid-template-columns: 1fr;
    gap: 15px;
  }
}

/* Stat Cards */
.stat-card {
  background: white;
  border-radius: 12px;
  padding: 20px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 15px;
  transition: transform 0.3s;
}

.stat-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-lg);
}

.stat-icon {
  width: 60px;
  height: 60px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  color: white;
}

.stat-content h3 {
  font-size: 1.8rem;
  font-weight: bold;
  margin-bottom: 5px;
}

.stat-content p {
  color: #666;
  font-size: 0.9rem;
}

/* Charts */
.charts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}

@media (max-width: 1024px) {
  .charts-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .charts-grid {
    grid-template-columns: 1fr;
    gap: 15px;
  }
}

/* Forms */
.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
  color: var(--dark-color);
}

.form-control {
  width: 100%;
  padding: 10px 15px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  font-size: 1rem;
  transition: border-color 0.3s;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary-color);
}

select.form-control {
  cursor: pointer;
  height: 42px;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%239ca3af' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

textarea.form-control {
  resize: vertical;
  font-family: inherit;
}

/* Buttons */
.btn {
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.3s;
  text-decoration: none;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
  transform: none !important;
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.btn-primary {
  background: var(--primary-color);
  color: white;
}

.btn-success {
  background: var(--success-color);
  color: white;
}

.btn-danger {
  background: var(--danger-color);
  color: white;
}

.btn-warning {
  background: #f59e0b;
  color: white;
}

.btn-warning:hover {
  background: #d97706;
}

.btn-secondary {
  background: #6c757d;
  color: white;
}

.btn-outline-primary {
  background: white;
  color: var(--primary-color);
  border: 1px solid var(--primary-color);
}

.btn-outline-primary:hover {
  background: var(--primary-color);
  color: white;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.875rem;
}

.btn-block {
  width: 100%;
  justify-content: center;
}

.btn-icon {
  background: none;
  border: none;
  color: var(--primary-color);
  cursor: pointer;
  padding: 5px 10px;
  font-size: 1rem;
  transition: color 0.3s;
}

.btn-icon:hover {
  color: var(--primary-color);
  opacity: 0.8;
}

/* Filter Grid */
.filter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 15px;
}

.date-filter {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Tables */
.table-responsive {
  overflow-x: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
}

.table thead {
  background: var(--light-color);
}

.table th,
.table td {
  padding: 12px;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

.table th {
  font-weight: 600;
  color: var(--dark-color);
}

.table tbody tr:hover {
  background: var(--light-color);
}

/* Badge */
.badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 500;
  color: white;
}

.badge-warning {
  background-color: #f59e0b;
  color: #1f2937;
}

/* Transaction List */
.transaction-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.transaction-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px;
  background: var(--light-color);
  border-radius: 8px;
  transition: background 0.3s;
}

.transaction-item:hover {
  background: #e9ecef;
}

.transaction-info strong {
  display: block;
  color: var(--dark-color);
  margin-bottom: 5px;
}

.transaction-info small {
  color: #666;
  font-size: 0.85rem;
}

.transaction-amount {
  font-size: 1.2rem;
  font-weight: bold;
  color: var(--danger-color);
}

/* Account Grid */
.account-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}

@media (max-width: 768px) {
  .account-grid {
    grid-template-columns: 1fr;
    gap: 15px;
  }
}

@media (max-width: 480px) {
  .account-grid {
    gap: 12px;
  }
}

.account-card {
  background: white;
  border-radius: 12px;
  padding: 20px;
  box-shadow: var(--shadow);
  transition: transform 0.3s;
}

.account-card.account-inactive {
  opacity: 0.6;
  background: #f9fafb;
}

.account-card.account-inactive h3,
.account-card.account-inactive h2,
.account-card.account-inactive small {
  color: #9ca3af;
}

.account-card.account-inactive .fas {
  color: #d1d5db;
}

.inactive-label {
  font-size: 0.75rem;
  color: #ef4444;
  font-weight: normal;
  margin-left: 8px;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

.account-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-lg);
}

.account-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
}

.account-header h3 {
  font-size: 1.2rem;
  color: var(--dark-color);
}

.account-type {
  background: var(--light-color);
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.85rem;
  color: #666;
}

.account-balance {
  margin-bottom: 20px;
}

.account-balance h2 {
  font-size: 2rem;
  color: var(--success-color);
  margin-bottom: 5px;
}

.account-balance small {
  color: #666;
  font-size: 0.9rem;
}

.account-actions {
  display: flex;
  gap: 10px;
}

/* Report Items */
.report-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px;
  border-bottom: 1px solid var(--border-color);
}

.report-item:last-child {
  border-bottom: none;
}

.report-label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 500;
}

.report-label small {
  display: block;
  color: #666;
  font-weight: normal;
  font-size: 0.85rem;
}

.report-value {
  text-align: right;
  font-weight: bold;
  color: var(--dark-color);
}

.report-value small {
  display: block;
  color: #666;
  font-weight: normal;
  font-size: 0.85rem;
}

.color-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  display: inline-block;
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.modal-content {
  background: white;
  border-radius: 12px;
  width: 90%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}

.modal-header {
  padding: 20px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h2 {
  font-size: 1.5rem;
  color: var(--dark-color);
}

.close-btn {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: #666;
  cursor: pointer;
  padding: 0;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.close-btn:hover {
  color: var(--danger-color);
}

.modal-body {
  padding: 20px;
}

.modal-footer {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 20px;
}

/* Loading Overlay */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
}

.spinner {
  border: 4px solid var(--light-color);
  border-top: 4px solid var(--primary-color);
  border-radius: 50%;
  width: 50px;
  height: 50px;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Toast Notification */
.toast {
  position: fixed;
  bottom: 30px;
  right: 30px;
  background: var(--dark-color);
  color: white;
  padding: 15px 25px;
  border-radius: 8px;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.3s;
  z-index: 3000;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast-success {
  background: var(--success-color);
}

.toast-error {
  background: var(--danger-color);
}

.toast-info {
  background: var(--info-color);
}

/* Utilities */
.text-center {
  text-align: center;
}

.text-muted {
  color: #666;
}

.mb-3 {
  margin-bottom: 20px;
}

.mt-2 {
  margin-top: 10px;
}

/* Pagination improvements */
.pagination-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 1rem;
  padding: 0 1rem;
  flex-wrap: wrap;
  gap: 15px;
}

.pagination-controls {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}

@media (max-width: 768px) {
  .pagination-container {
    padding: 0;
    gap: 10px;
  }

  .pagination-controls {
    width: 100%;
    justify-content: center;
  }

  #expensesPaginationInfo,
  #expensesPageInfo {
    font-size: 0.85rem;
  }
}

/* Responsive Design */

/* Tablet styles */
@media (max-width: 1024px) {
  .nav-container {
    padding: 0 15px;
  }

  .main-content {
    padding: 20px 15px;
  }

  .page-header h1 {
    font-size: 1.75rem;
  }

  .modal-content {
    max-width: 90%;
  }
}

/* Mobile styles */
@media (max-width: 768px) {
  .nav-container {
    padding: 10px 15px;
  }

  .nav-brand {
    font-size: 1.25rem;
    margin-right: 10px;
  }

  .nav-menu {
    gap: 2px;
    width: 100%;
    justify-content: space-around;
    padding-top: 10px;
  }

  .nav-link {
    padding: 10px 8px;
    font-size: 0.75rem;
    flex-direction: column;
    gap: 4px;
    flex: 1;
    justify-content: center;
    text-align: center;
    min-width: 60px;
  }

  .nav-link i {
    font-size: 1.1rem;
  }

  /* User profile adjustments */
  .user-profile-container {
    width: 100%;
    order: 3;
    margin-top: 10px;
  }

  .user-profile {
    width: 100%;
    justify-content: space-between;
    padding: 8px 12px;
    background: var(--light-color);
    border-radius: 8px;
  }

  .user-dropdown {
    left: 0;
    right: 0;
    min-width: 100%;
  }

  .user-name {
    font-size: 0.9rem;
  }

  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 15px;
  }

  .page-header-with-tabs {
    flex-direction: column;
    align-items: stretch;
    gap: 15px;
  }

  .page-header-with-tabs .sub-nav-inline {
    order: 2;
    width: 100%;
    margin-bottom: 0;
  }

  .page-header-with-tabs .date-filter {
    order: 3;
    margin-left: 0;
  }

  .page-header > div {
    width: 100%;
  }

  .date-filter {
    flex-wrap: wrap;
    width: 100%;
    gap: 10px;
  }

  .date-filter input {
    flex: 1;
    min-width: 120px;
  }

  .stat-card {
    flex-direction: row;
    padding: 15px;
  }

  .stat-icon {
    width: 50px;
    height: 50px;
    font-size: 1.25rem;
  }

  .stat-content h3 {
    font-size: 1.5rem;
  }

  .stat-content p {
    font-size: 0.85rem;
  }

  .filter-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .filter-grid .form-group {
    margin-bottom: 0;
  }

  .account-grid {
    grid-template-columns: 1fr;
  }

  .account-card {
    padding: 16px;
  }

  .table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .table {
    font-size: 0.85rem;
    min-width: 600px;
  }

  .table th,
  .table td {
    padding: 8px 6px;
    white-space: nowrap;
  }

  .modal-content {
    width: 95%;
    max-height: 85vh;
  }

  .modal-dialog {
    min-width: auto;
    width: 90%;
    padding: 20px;
  }

  .modal-header {
    padding: 15px;
  }

  .modal-body {
    padding: 15px;
  }

  .modal-header h2 {
    font-size: 1.25rem;
  }

  .form-control {
    font-size: 16px; /* Prevents zoom on iOS */
  }

  .btn {
    padding: 12px 16px;
    font-size: 0.95rem;
  }

  .btn-block {
    width: 100%;
  }

  /* Auth page mobile */
  .auth-container {
    padding: 15px;
  }

  .auth-card {
    padding: 25px 20px;
  }

  /* Toast notifications */
  .toast {
    bottom: 20px;
    right: 20px;
    left: 20px;
    max-width: calc(100% - 40px);
  }
}

/* Small mobile styles */
@media (max-width: 480px) {
  .nav-brand {
    font-size: 1.1rem;
  }

  .nav-brand span {
    display: none;
  }

  .nav-link {
    font-size: 0.7rem;
    padding: 8px 4px;
    min-width: 50px;
  }

  .nav-link i {
    font-size: 1rem;
  }

  .page-header h1 {
    font-size: 1.5rem;
  }

  .main-content {
    padding: 15px 10px;
  }

  .stat-content h3 {
    font-size: 1.3rem;
  }

  .stat-icon {
    width: 45px;
    height: 45px;
    font-size: 1.1rem;
  }

  .btn {
    padding: 10px 14px;
    font-size: 0.875rem;
  }

  .btn-sm {
    padding: 6px 10px;
    font-size: 0.75rem;
  }

  .card {
    border-radius: 8px;
  }

  .card-header, .card-body {
    padding: 15px;
  }

  .card-header h3 {
    font-size: 1rem;
  }

  .modal-dialog {
    padding: 15px;
  }

  .table {
    font-size: 0.8rem;
  }

  /* Make buttons stack vertically on very small screens */
  .page-header > div {
    flex-direction: column;
  }

  .modal-footer {
    flex-direction: column;
  }

  .modal-footer .btn {
    width: 100%;
  }

  /* Auth adjustments */
  .auth-card {
    padding: 20px 15px;
  }

  .auth-header h1 {
    font-size: 1.5rem;
  }

  .auth-container {
    padding: 25px 20px;
  }

  /* Report items */
  .report-item {
    padding: 12px;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .report-value {
    text-align: left;
  }

  /* Date filter improvements */
  .date-filter {
    flex-direction: column;
    align-items: stretch;
  }

  .date-filter input {
    width: 100%;
  }

  .date-filter span {
    text-align: center;
  }
}

/* Landscape mobile */
@media (max-width: 768px) and (orientation: landscape) {
  .modal-content {
    max-height: 95vh;
  }

  .nav-container {
    min-height: 50px;
  }
}

/* Touch-friendly improvements */
@media (hover: none) and (pointer: coarse) {
  .btn, .nav-link, .close-btn {
    min-height: 44px; /* iOS recommended touch target */
    min-width: 44px;
  }

  .table th,
  .table td {
    padding: 12px 8px;
  }

  .form-control {
    min-height: 44px;
    padding: 12px 15px;
  }

  select.form-control {
    padding: 10px 15px;
  }
}

/* Confirmation Dialog */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 11000;
}

.confirmation-overlay {
    z-index: 15000;
}

.modal-dialog {
    background: white;
    border-radius: 8px;
    padding: 32px;
    min-width: 400px;
    max-width: 500px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.modal-dialog .modal-content {
    background: none;
    box-shadow: none;
    border: none;
    padding: 0;
    border-radius: 0;
}

.modal-content p {
    margin: 0 0 28px 0;
    padding: 4px 0;
    font-size: 16px;
    color: #374151;
    line-height: 1.6;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.modal-actions .btn {
    padding: 8px 24px;
    border-radius: 6px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    font-size: 14px;
    transition: all 0.2s;
}

.modal-actions .btn-primary {
    background: #2563eb;
    color: white;
}

.modal-actions .btn-primary:hover {
    background: #1d4ed8;
}

.modal-actions .btn-secondary {
    background: #e5e7eb;
    color: #374151;
}

.modal-actions .btn-secondary:hover {
    background: #d1d5db;
}

/* Form Groups */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #374151;
    font-size: 14px;
}

.form-control {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.2s;
    background: white;
}

.form-control:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}


/* Merchant Dialog */
.merchant-dialog {
    min-width: 550px;
    max-width: 600px;
    max-height: 80vh;
    padding: 0;
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
    font-size: 18px;
    color: #1f2937;
}

.btn-close {
    background: none;
    border: none;
    font-size: 28px;
    color: #9ca3af;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}

.btn-close:hover {
    color: #374151;
}

.merchant-dialog .modal-content {
    padding: 20px 24px;
    max-height: calc(80vh - 80px);
    overflow-y: auto;
}

.merchant-list {
    margin-top: 16px;
}

.merchant-list-header {
    padding: 12px 16px;
    background: #f9fafb;
    border-bottom: 2px solid #e5e7eb;
    font-weight: 600;
    color: #6b7280;
    font-size: 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.merchant-item {
    padding: 12px 16px;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.2s;
}

.merchant-item:hover {
    background: #f9fafb;
}

.merchant-item-name {
    flex: 1;
    font-size: 15px;
    color: #1f2937;
}

.merchant-item-input {
    flex: 1;
    padding: 6px 8px;
    border: 1px solid #3b82f6;
    border-radius: 4px;
    font-size: 15px;
    outline: none;
}

.merchant-item-input:focus {
    border-color: #2563eb;
}

.merchant-item-actions {
    display: flex;
    gap: 8px;
}

.merchant-item-actions button {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px 8px;
    font-size: 16px;
    color: #6b7280;
    transition: color 0.2s;
}

.merchant-item-actions button:hover {
    color: #374151;
}

.merchant-item-actions .btn-edit:hover {
    color: #3b82f6;
}

.merchant-item-actions .btn-delete:hover {
    color: #ef4444;
}

.merchant-item-actions .btn-delete-disabled {
    color: #d1d5db !important;
    cursor: not-allowed !important;
}

.merchant-item-actions .btn-delete-disabled:hover {
    color: #d1d5db !important;
}

.merchant-item-actions .btn-save {
    color: #3b82f6;
}

.merchant-item-actions .btn-save:hover {
    color: #2563eb;
}

.merchant-item-actions .btn-save:disabled {
    color: #d1d5db;
    cursor: not-allowed;
}

.merchant-item-actions .btn-cancel:hover {
    color: #ef4444;
}

/* Category Management */
.category-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid #e5e7eb;
    transition: background-color 0.2s;
}

.category-item:hover {
    background-color: #f9fafb;
}

.category-item:last-child {
    border-bottom: none;
}

.category-info {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
}

.category-name {
    font-weight: 500;
    color: #111827;
}

.category-type {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 12px;
    font-weight: 500;
    text-transform: uppercase;
}

.category-type.expense-type {
    background-color: #fee2e2;
    color: #dc2626;
}

.category-type.income-type {
    background-color: #dcfce7;
    color: #16a34a;
}

.system-badge {
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 8px;
    background-color: #e5e7eb;
    color: #6b7280;
    font-weight: 500;
}

.category-actions {
    display: flex;
    gap: 8px;
}

.category-actions button {
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    border-radius: 4px;
    color: #6b7280;
    transition: all 0.2s;
}

.category-actions button:hover {
    background-color: #f3f4f6;
}

.category-actions .btn-edit:hover {
    color: #3b82f6;
}

.category-actions .btn-delete:hover {
    color: #ef4444;
}

#categoriesList {
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    margin-top: 16px;
}

#categoriesList .no-data,
#categoriesList .error {
    padding: 24px;
    text-align: center;
    color: #6b7280;
}

#categoriesList .error {
    color: #ef4444;
}

/* Auth Page */
.auth-page {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.auth-container {
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    width: 90%;
    max-width: 500px;
    padding: 40px;
}

.auth-header {
    text-align: center;
    margin-bottom: 30px;
}

.auth-logo {
    width: 100%;
    max-width: 400px;
    height: auto;
    object-fit: contain;
    margin-bottom: 16px;
    display: block;
    margin-left: auto;
    margin-right: auto;
}

.auth-header i {
    font-size: 48px;
    color: #667eea;
    margin-bottom: 10px;
}

.auth-header h1 {
    font-size: 28px;
    color: #1f2937;
    margin-bottom: 8px;
}

.auth-header p {
    color: #6b7280;
    font-size: 14px;
}

.auth-form h2 {
    font-size: 24px;
    color: #1f2937;
    margin-bottom: 24px;
}

.auth-form .form-group {
    margin-bottom: 20px;
}

.auth-form .form-group small {
    display: block;
    margin-top: 4px;
    color: #6b7280;
    font-size: 12px;
}

.btn-block {
    width: 100%;
    padding: 12px;
    font-size: 16px;
}

.auth-switch {
    text-align: center;
    margin-top: 20px;
    color: #6b7280;
    font-size: 14px;
}

.auth-switch a {
    color: #667eea;
    text-decoration: none;
    font-weight: 500;
}

.auth-switch a:hover {
    text-decoration: underline;
}

.auth-forgot {
    text-align: center;
    margin-top: 15px;
    margin-bottom: 5px;
}

.auth-forgot a {
    color: #667eea;
    text-decoration: none;
    font-size: 14px;
}

.auth-forgot a:hover {
    text-decoration: underline;
}

.auth-subtitle {
    color: #6b7280;
    font-size: 14px;
    text-align: center;
    margin-bottom: 20px;
}

/* User Profile Container */
.user-profile-container {
    position: relative;
    margin-left: auto;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 16px;
    cursor: pointer;
    border-radius: 8px;
    transition: background-color 0.2s;
}

.user-profile:hover {
    background-color: #f3f4f6;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 18px;
}

.user-name {
    font-weight: 500;
    color: #1f2937;
    font-size: 14px;
}

.user-profile .fa-chevron-down {
    color: #6b7280;
    font-size: 12px;
    transition: transform 0.2s;
}

.user-profile.active .fa-chevron-down {
    transform: rotate(180deg);
}

/* User Dropdown */
.user-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: white;
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    min-width: 200px;
    overflow: hidden;
    z-index: 1000;
    animation: slideDown 0.2s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: #374151;
    text-decoration: none;
    transition: background-color 0.2s;
    font-size: 14px;
}

.dropdown-item:hover {
    background-color: #f3f4f6;
}

.dropdown-item i {
    width: 20px;
    text-align: center;
    color: #6b7280;
}

.dropdown-item.logout-item {
    color: #dc2626;
}

.dropdown-item.logout-item i {
    color: #dc2626;
}

.dropdown-divider {
    height: 1px;
    background-color: #e5e7eb;
    margin: 8px 0;
}

/* Custom Alert Dialog */
.alert-dialog {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 20000;
    animation: fadeIn 0.2s ease-out;
}

.alert-dialog-content {
    background: white;
    border-radius: 12px;
    max-width: 450px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from {
        transform: translateY(50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.alert-dialog-header {
    padding: 20px 24px 0;
}

.alert-dialog-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #1f2937;
}

.alert-dialog-body {
    padding: 16px 24px 24px;
}

.alert-dialog-body p {
    margin: 0;
    font-size: 14px;
    color: #4b5563;
    line-height: 1.6;
}

.alert-dialog-footer {
    padding: 0 24px 20px;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.alert-dialog-footer .btn {
    min-width: 80px;
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 25000;
    display: flex;
    flex-direction: column;
    gap: 12px;
    pointer-events: none;
}

.toast {
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 300px;
    max-width: 400px;
    pointer-events: auto;
    animation: slideInRight 0.3s ease-out;
}

.toast.success {
    background: #4CAF50 !important;
    color: white !important;
}

.toast.success .toast-icon,
.toast.success .toast-message,
.toast.success .toast-close {
    color: white !important;
}

.toast.error {
    background: #F44336 !important;
    color: white !important;
}

.toast.error .toast-icon,
.toast.error .toast-message,
.toast.error .toast-close {
    color: white !important;
}

.toast.info {
    background: #2196F3 !important;
    color: white !important;
}

.toast.info .toast-icon,
.toast.info .toast-message,
.toast.info .toast-close {
    color: white !important;
}

.toast.warning {
    background: #FF9800 !important;
    color: white !important;
}

.toast.warning .toast-icon,
.toast.warning .toast-message,
.toast.warning .toast-close {
    color: white !important;
}

.toast-icon {
    font-size: 20px;
    flex-shrink: 0;
}

.toast-message {
    flex: 1;
    font-size: 14px;
    line-height: 1.4;
}

.toast-close {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: color 0.2s;
}

.toast-close:hover {
    color: #4b5563;
}

.toast.removing {
    animation: slideOutRight 0.3s ease-out forwards;
}

@keyframes slideInRight {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOutRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(400px);
        opacity: 0;
    }
}

/* Settings Page Styles */
.settings-section {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.profile-picture-section {
    display: flex;
    gap: 32px;
    align-items: center;
    padding-bottom: 24px;
    border-bottom: 1px solid #e5e7eb;
}

.profile-picture-preview {
    flex-shrink: 0;
}

.profile-avatar-large {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 48px;
    overflow: hidden;
}

.profile-avatar-large img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-picture-controls {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.profile-picture-controls .btn {
    width: fit-content;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
}

.help-text {
    font-size: 13px;
    color: #6b7280;
    margin-top: 4px;
}

.text-danger {
    color: #dc2626;
}

.btn-outline {
    background: white;
    color: #6b7280;
    border: 1px solid #d1d5db;
}

.btn-outline:hover {
    background: #f9fafb;
    border-color: #9ca3af;
}

.setting-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
}

.setting-item > div {
    flex: 1;
}

.setting-item h4 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 4px;
    color: #1f2937;
}

.setting-item p {
    font-size: 14px;
    color: #6b7280;
    margin: 0;
}

.setting-divider {
    height: 1px;
    background-color: #e5e7eb;
    margin: 20px 0;
}

@media (max-width: 768px) {
    .profile-picture-section {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .setting-item {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .setting-item .btn {
        width: 100%;
    }
}

/* Email Settings Styles */
.email-status-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: #f8fafc;
    border-radius: 8px;
    margin-bottom: 20px;
    border: 1px solid #e5e7eb;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #9ca3af;
}

.status-dot.connected {
    background: #22c55e;
    box-shadow: 0 0 8px rgba(34, 197, 94, 0.4);
}

.status-dot.disconnected {
    background: #ef4444;
}

.status-dot.pending {
    background: #f59e0b;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.email-quota {
    font-size: 14px;
    color: #6b7280;
}

.email-quota strong {
    color: #374151;
}

.password-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.password-input-wrapper input {
    flex: 1;
    padding-right: 40px;
}

.password-input-wrapper .btn-icon {
    position: absolute;
    right: 8px;
    background: none;
    border: none;
    color: #6b7280;
    cursor: pointer;
    padding: 4px 8px;
}

.password-input-wrapper .btn-icon:hover {
    color: #374151;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-weight: 500;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.form-actions {
    display: flex;
    gap: 12px;
    margin-top: 16px;
}

#customSmtpFields {
    padding: 16px;
    background: #f8fafc;
    border-radius: 8px;
    margin-bottom: 16px;
    border: 1px dashed #e5e7eb;
}

/* Multi-Select Dropdown Styles */
.multi-select {
    position: relative;
    width: 100%;
}

.multi-select-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    height: 42px;
    box-sizing: border-box;
}

.multi-select-header:hover {
    border-color: var(--primary-color);
}

.multi-select.open .multi-select-header {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(33, 150, 243, 0.1);
}

.multi-select-text {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--dark-color);
    font-size: 0.95rem;
}

.multi-select-text.placeholder {
    color: #9ca3af;
}

.multi-select-header i {
    color: #9ca3af;
    transition: transform 0.3s;
    margin-left: 8px;
}

.multi-select.open .multi-select-header i {
    transform: rotate(180deg);
}

.multi-select-dropdown {
    position: absolute !important;
    top: 100% !important;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2) !important;
    z-index: 99999 !important;
    max-height: 250px;
    overflow-y: auto;
    display: none;
    margin-top: 4px;
}

.multi-select.open .multi-select-dropdown {
    display: block !important;
}

.multi-select-options {
    padding: 8px 0;
}

.multi-select-option {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: flex-start !important;
    padding: 10px 14px !important;
    cursor: pointer;
    transition: background 0.2s;
    gap: 0 !important;
}

.multi-select-option:hover {
    background: #f3f4f6;
}

.multi-select-option input[type="checkbox"] {
    width: 18px !important;
    height: 18px !important;
    min-width: 18px !important;
    min-height: 18px !important;
    cursor: pointer;
    accent-color: var(--primary-color);
    margin: 0 !important;
    margin-right: 12px !important;
    flex-shrink: 0 !important;
    vertical-align: middle !important;
}

.multi-select-option span {
    flex: 1;
    cursor: pointer;
    font-size: 0.95rem;
    line-height: 18px !important;
    vertical-align: middle !important;
    display: inline-block !important;
}

.multi-select-option.select-all {
    border-bottom: 1px solid var(--border-color);
    font-weight: 500;
    background: #f9fafb;
}

/* Filter Button Styles */
.filter-button-group {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    min-width: fit-content;
}

.filter-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: nowrap;
}

.filter-button-group .btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    font-weight: 500;
    white-space: nowrap;
}

.filter-button-group .btn-secondary {
    background: #6b7280;
    color: white;
    border: none;
}

.filter-button-group .btn-secondary:hover {
    background: #4b5563;
}

/* Ensure filter buttons don't get cut off */
.filter-button-group .btn {
    min-width: auto;
    flex-shrink: 0;
}

/* Invoice filter grid - ensure buttons have enough space */
#invoices .filter-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-items: flex-end;
    overflow: visible;
}

#invoices .filter-grid .form-group {
    flex: 1 1 150px;
    min-width: 150px;
    max-width: 250px;
}

#invoices .filter-grid .filter-button-group {
    flex: 0 0 auto;
    min-width: auto;
    margin-left: auto;
}

#invoices .card-body {
    overflow: visible;
}

@media (max-width: 1200px) {
    #invoices .filter-grid .form-group {
        flex: 1 1 calc(33% - 15px);
        max-width: none;
    }
    
    #invoices .filter-grid .filter-button-group {
        flex: 1 1 100%;
        margin-left: 0;
    }
}

@media (max-width: 900px) {
    #invoices .filter-grid .form-group {
        flex: 1 1 calc(50% - 15px);
    }
}

@media (max-width: 600px) {
    #invoices .filter-grid .form-group {
        flex: 1 1 100%;
    }
    
    #invoices .filter-grid .filter-button-group {
        flex: 1 1 100%;
    }
}

/* Selected count badge */
.multi-select-count {
    background: var(--primary-color);
    color: white;
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: 12px;
    margin-left: 8px;
}

/* Income amount styling (green for income) */
.income-amount {
    color: #16a34a;
}

/* Income pagination info */
#incomePaginationInfo,
#incomePageInfo {
    font-size: 0.9rem;
}

/* Sub-navigation tabs for Dashboard/Reports */
.sub-nav {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    padding: 0.25rem;
    background: #f3f4f6;
    border-radius: 8px;
    width: fit-content;
}

.sub-nav-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: #6b7280;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.sub-nav-btn:hover {
    color: #374151;
    background: rgba(255, 255, 255, 0.5);
}

.sub-nav-btn.active {
    background: #fff;
    color: var(--primary-color);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.sub-nav-btn i {
    font-size: 0.85rem;
}

/* Dashboard and Reports views */
.dashboard-view,
.reports-view {
    display: none;
}

.dashboard-view.active,
.reports-view.active {
    display: block;
}

@media (max-width: 768px) {
    #incomePaginationInfo,
    #incomePageInfo {
        font-size: 0.85rem;
    }

    .sub-nav {
        width: 100%;
    }

    .sub-nav-btn {
        flex: 1;
        justify-content: center;
        padding: 0.5rem 1rem;
    }
}
/* Invoice Styles */
.invoice-income-list {
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.5rem;
    background: #f8f9fa;
}

.invoice-income-item {
    display: flex;
    align-items: center;
    padding: 0.75rem;
    background: white;
    border-radius: 6px;
    margin-bottom: 0.5rem;
    border: 1px solid var(--border-color);
    transition: all 0.2s ease;
}

.invoice-income-item:last-child {
    margin-bottom: 0;
}

.invoice-income-item:hover {
    border-color: var(--primary-color);
}

.invoice-income-item.selected {
    border-color: var(--success-color);
    background: #f0fff0;
}

.invoice-income-item input[type="checkbox"] {
    margin-right: 1rem;
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.invoice-income-item-details {
    flex: 1;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.invoice-income-item-info {
    display: flex;
    flex-direction: column;
}

.invoice-income-item-date {
    font-size: 0.85rem;
    color: #666;
}

.invoice-income-item-desc {
    font-weight: 500;
}

.invoice-income-item-amount {
    font-weight: 600;
    color: var(--success-color);
}

.invoice-total {
    margin-top: 1rem;
    padding: 1rem;
    background: #e8f5e9;
    border-radius: 8px;
    text-align: right;
    font-size: 1.1rem;
}

.invoice-total span {
    color: var(--success-color);
}

/* Invoice Status Badges */
.invoice-status {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.invoice-status.paid {
    background: #e8f5e9;
    color: #2e7d32;
}

.invoice-status.unpaid {
    background: #fff3e0;
    color: #ef6c00;
}

.invoice-status.draft {
    background: #e3f2fd;
    color: #1565c0;
}

.invoice-status.overdue {
    background: #ffebee;
    color: #c62828;
}

.invoice-status.cancelled {
    background: #f5f5f5;
    color: #757575;
}

/* Invoiced Checkbox in Income Grid */
.invoiced-checkbox {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--success-color);
}

.invoiced-checkbox:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

.invoiced-checkbox.invoiced-locked {
    cursor: not-allowed;
    opacity: 0.6;
    filter: grayscale(30%);
}

.invoiced-checkbox.invoiced-new {
    cursor: pointer;
    opacity: 1;
}

.invoiced-cell {
    text-align: center;
}

.invoiced-cell .invoiced-link {
    font-size: 0.75rem;
    color: var(--primary-color);
    text-decoration: none;
    display: block;
    margin-top: 2px;
}

.invoiced-cell .invoiced-link:hover {
    text-decoration: underline;
}

/* Modal Large variant */
.modal-content.modal-large {
    max-width: 700px;
}

/* Modal Extra Large variant */
.modal-content.modal-xlarge {
    max-width: 900px;
    max-height: 90vh;
    overflow-y: auto;
}

/* Invoice Wizard Modal - Fixed dimensions for consistent size */
#invoiceModal .modal-content {
    width: 900px;
    height: 85vh;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
}

#invoiceModal .modal-body {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

#invoiceModal .modal-body form {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

#invoiceModal .wizard-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow-y: auto;
}

#invoiceModal .modal-footer {
    flex-shrink: 0;
}

@media (max-width: 950px) {
    #invoiceModal .modal-content {
        width: 95vw;
        height: 90vh;
        max-height: 90vh;
    }
}

/* Invoice Wizard Styles */
.wizard-steps {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.wizard-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    opacity: 0.5;
    transition: opacity 0.3s ease;
}

.wizard-step.active,
.wizard-step.completed {
    opacity: 1;
}

.wizard-step .step-number {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--border-color);
    color: #666;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    transition: all 0.3s ease;
}

.wizard-step.active .step-number {
    background: var(--primary-color);
    color: white;
}

.wizard-step.completed .step-number {
    background: var(--success-color);
    color: white;
}

.wizard-step .step-title {
    font-size: 0.85rem;
    color: #666;
}

.wizard-step.active .step-title {
    color: var(--primary-color);
    font-weight: 500;
}

.wizard-section-title {
    margin-bottom: 1.5rem;
    color: var(--dark-color);
    font-size: 1.1rem;
    flex-shrink: 0;
}

/* Invoice Type Selection Grid */
.invoice-type-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.invoice-type-card {
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem 1rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    background: white;
}

.invoice-type-card:hover {
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.invoice-type-card.selected {
    border-color: var(--primary-color);
    background: rgba(33, 150, 243, 0.05);
}

.invoice-type-card .type-icon {
    font-size: 2rem;
    margin-bottom: 0.75rem;
    color: var(--primary-color);
}

.invoice-type-card .type-name {
    font-weight: 600;
    margin-bottom: 0.25rem;
    color: var(--dark-color);
}

.invoice-type-card .type-desc {
    font-size: 0.75rem;
    color: #888;
}

.invoice-type-card.create-custom {
    border-style: dashed;
    background: #f9f9f9;
}

.invoice-type-card.create-custom .type-icon {
    color: #888;
}

/* Invoice Line Items */
.line-item-row {
    display: grid;
    grid-template-columns: 2fr repeat(3, 1fr) auto;
    gap: 0.75rem;
    align-items: start;
    padding: 0.75rem;
    background: #f9f9f9;
    border-radius: 8px;
    margin-bottom: 0.5rem;
}

.line-item-row input,
.line-item-row select,
.line-item-row textarea {
    font-size: 0.9rem;
}

.line-item-row .remove-line-item {
    background: none;
    border: none;
    color: var(--danger-color);
    cursor: pointer;
    padding: 0.5rem;
    opacity: 0.6;
    transition: opacity 0.2s;
}

.line-item-row .remove-line-item:hover {
    opacity: 1;
}

.line-item-header {
    display: grid;
    grid-template-columns: 2fr repeat(3, 1fr) auto;
    gap: 0.75rem;
    padding: 0 0.75rem;
    margin-bottom: 0.5rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: #666;
}

/* Invoice Totals */
.invoice-totals {
    background: #f5f7fa;
    padding: 1rem 1.5rem;
    border-radius: 8px;
    max-width: 350px;
    margin-left: auto;
}

.totals-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-color);
}

.totals-row:last-child {
    border-bottom: none;
}

.totals-row.total-final {
    font-size: 1.1rem;
    padding-top: 0.75rem;
    margin-top: 0.5rem;
    border-top: 2px solid var(--dark-color);
    border-bottom: none;
}

/* Invoice Preview */
.invoice-preview {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 2rem;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
}

.invoice-preview-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 2px solid var(--primary-color);
}

.invoice-preview-header .business-info h2 {
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.invoice-preview-header .invoice-meta {
    text-align: right;
}

.invoice-preview-header .invoice-number {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--dark-color);
}

.invoice-preview .client-section {
    margin-bottom: 2rem;
}

.invoice-preview .client-section h4 {
    color: #888;
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
}

.invoice-preview .items-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 2rem;
}

.invoice-preview .items-table th {
    background: #f5f7fa;
    padding: 0.75rem;
    text-align: left;
    font-size: 0.85rem;
    border-bottom: 2px solid var(--border-color);
}

.invoice-preview .items-table td {
    padding: 0.75rem;
    border-bottom: 1px solid var(--border-color);
}

.invoice-preview .items-table .amount-col {
    text-align: right;
}

.invoice-preview .preview-totals {
    max-width: 300px;
    margin-left: auto;
}

.invoice-preview .preview-totals .totals-row {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid #ddd;
}

.invoice-preview .preview-totals .totals-row.total-final {
    font-size: 1.1rem;
    padding-top: 0.75rem;
    margin-top: 0.5rem;
    border-top: 2px solid #333;
    border-bottom: none;
}

/* Wizard Footer - Fixed at bottom */
.wizard-footer {
    display: flex;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-color);
    background: var(--card-bg);
    flex-shrink: 0;
}

/* Back button styling - make it prominent */
#prevStepBtn {
    background: linear-gradient(135deg, #6c757d 0%, #5a6268 100%);
    color: white;
    border: none;
}

#prevStepBtn:hover {
    background: linear-gradient(135deg, #5a6268 0%, #495057 100%);
}

/* Next button disabled state */
#nextStepBtn:disabled,
#nextStepBtn.btn-disabled {
    background: #ccc !important;
    border-color: #ccc !important;
    color: #888 !important;
    cursor: not-allowed;
    opacity: 0.7;
}

#nextStepBtn:disabled:hover,
#nextStepBtn.btn-disabled:hover {
    background: #ccc !important;
    transform: none;
    box-shadow: none;
}

#finalActionBtns {
    display: flex;
    gap: 0.5rem;
}

/* Email Attachment Display */
.email-attachment {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: #f5f7fa;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

/* Type Badge */
.type-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem 0.6rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
    background: #e3f2fd;
    color: #1976d2;
}

.type-badge i {
    font-size: 0.7rem;
}

/* Business Details Section in Settings */
.business-logo-section {
    display: flex;
    align-items: flex-start;
    gap: 2rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.business-logo-preview {
    flex-shrink: 0;
}

.business-logo-placeholder {
    width: 200px;
    height: 80px;
    border: 2px dashed var(--border-color);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #f8f9fa;
    color: #888;
    font-size: 0.85rem;
}

.business-logo-placeholder i {
    font-size: 1.5rem;
    margin-bottom: 0.25rem;
}

.business-logo-placeholder img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.business-logo-controls {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.card-header .badge-info {
    background: #e3f2fd;
    color: #1976d2;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
}

/* Business logo in invoice preview */
.business-logo-inline {
    margin-bottom: 0.5rem;
}

.business-logo-inline img {
    max-height: 80px;
    max-width: 200px;
    object-fit: contain;
}

/* PDF-style business header with logo and text side by side */
.business-header-row {
    display: flex;
    align-items: flex-start;
    gap: 16px;
}

.business-logo-pdf-style {
    max-height: 80px;
    max-width: 200px;
    width: auto;
    object-fit: contain;
}

.business-header-row .business-text {
    display: flex;
    flex-direction: column;
}

.business-header-row .business-text h2 {
    margin: 0 0 4px 0;
    font-size: 1.4rem;
    color: #2196f3;
}

.business-header-row .business-text p {
    margin: 0;
    font-size: 0.85rem;
    color: #666;
    line-height: 1.4;
}

/* Monthly Budget Section Styles */
.budget-section {
    animation: fadeIn 0.3s ease-in-out;
    margin-bottom: 20px;
}

.budget-section .card-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--primary-color);
    font-size: 1.1rem;
    margin: 0;
}

.budget-section .card-title i {
    color: var(--primary-color);
}

#setMonthlyBudgetBtn.btn-primary {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

#setMonthlyBudgetBtn.btn-secondary {
    background: #6c757d;
    color: white;
    border-color: #6c757d;
}

#setMonthlyBudgetBtn:hover {
    opacity: 0.9;
}

/* Month input styling */
input[type="month"] {
    appearance: none;
    -webkit-appearance: none;
    padding: 10px 12px;
    font-size: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: white;
    cursor: pointer;
}

input[type="month"]:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(33, 150, 243, 0.1);
}

/* Budget table badge colors */
.budget-section .badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
}

/* Monthly Budget Warning */
.budget-warning {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background-color: #fff5f5;
    border: 1px solid #fc8181;
    color: #c53030;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    margin-left: 15px;
    animation: pulse-warning 2s infinite;
}

.budget-warning i {
    color: #e53e3e;
}

@keyframes pulse-warning {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(229, 62, 62, 0.4);
    }
    50% {
        box-shadow: 0 0 0 4px rgba(229, 62, 62, 0);
    }
}

/* ===== Expense Row Budget Alert Colors ===== */
.expense-row-warning {
    background-color: #fef3cd !important;
    border-left: 4px solid #ffc107;
}

.expense-row-warning td {
    background-color: #fef3cd !important;
}

.expense-row-caution {
    background-color: #ffe5d0 !important;
    border-left: 4px solid #fd7e14;
}

.expense-row-caution td {
    background-color: #ffe5d0 !important;
}

.expense-row-danger {
    background-color: #f8d7da !important;
    border-left: 4px solid #dc3545;
}

.expense-row-danger td {
    background-color: #f8d7da !important;
}

/* Budget Alert Settings Styles */
.alert-threshold-grid {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.threshold-item {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1rem;
    border-radius: 8px;
    background: #f8f9fa;
}

.threshold-color-preview {
    width: 60px;
    height: 60px;
    border-radius: 8px;
    flex-shrink: 0;
}

.threshold-content {
    flex: 1;
}

.threshold-content label {
    font-weight: 600;
    margin-bottom: 0.5rem;
    display: block;
}

.threshold-input-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.threshold-input-group input {
    width: 80px;
    text-align: center;
}

.threshold-input-group span {
    color: #666;
}

/* Amount Limit column styling */
.amount-limit-cell {
    font-size: 0.85rem;
    color: #666;
}

.amount-limit-cell .limit-value {
    font-weight: 500;
}

.amount-limit-cell .usage-badge {
    font-size: 0.8rem;
    margin-left: 6px;
    padding: 2px 8px;
    border-radius: 10px;
    background: #e9ecef;
    color: #666;
}

.usage-badge.warning {
    background: #ffc107;
    color: #856404;
}

.usage-badge.caution {
    background: #fd7e14;
    color: #fff;
}

.usage-badge.danger {
    background: #dc3545;
    color: #fff;
}

/* Trash / Deleted Items Section */
.trash-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 15px;
}

.trash-tab {
    padding: 8px 16px;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    background: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.trash-tab:hover {
    background: var(--light-color);
}

.trash-tab.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.trash-count {
    background: rgba(0, 0, 0, 0.1);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.8rem;
    min-width: 24px;
    text-align: center;
}

.trash-tab.active .trash-count {
    background: rgba(255, 255, 255, 0.2);
}

.trash-content {
    min-height: 200px;
    max-height: 400px;
    overflow-y: auto;
}

.trash-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 200px;
    color: #9ca3af;
}

.trash-empty i {
    font-size: 3rem;
    margin-bottom: 10px;
}

.trash-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.trash-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    background: #fef3cd;
    border-radius: 8px;
    border: 1px solid #ffc107;
}

.trash-item-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.trash-item-title {
    font-weight: 500;
    color: #1f2937;
}

.trash-item-meta {
    font-size: 0.85rem;
    color: #6b7280;
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.trash-item-meta span {
    display: flex;
    align-items: center;
    gap: 4px;
}

.trash-item-actions {
    display: flex;
    gap: 8px;
}

.btn-restore {
    background: #22c55e;
    color: white;
    padding: 6px 12px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: all 0.2s;
}

.btn-restore:hover {
    background: #16a34a;
}

@media (max-width: 768px) {
    .trash-tabs {
        gap: 6px;
    }
    
    .trash-tab {
        padding: 6px 12px;
        font-size: 0.85rem;
    }
    
    .trash-tab span:not(.trash-count) {
        display: none;
    }
    
    .trash-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .trash-item-actions {
        width: 100%;
        justify-content: flex-end;
    }
}

/* Loading Overlay with Pulsing Logo */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99999;
}

.loading-logo {
    width: 360px;
    height: auto;
    animation: pulse 1.2s ease-in-out infinite;
}

@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.3);
        opacity: 0.8;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Floating Copyright */
.floating-copyright {
    position: fixed;
    bottom: 15px;
    right: 20px;
    font-size: 0.75rem;
    color: #888;
    background: rgba(255, 255, 255, 0.9);
    padding: 6px 12px;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    z-index: 50;
    pointer-events: none;
}