/* Trip Expense Splitter Styles - GitHub Pages Version */

/* ============================= */
/* BASE STYLES                   */
/* ============================= */

/* Loading animations */
@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.animate-spin {
  animation: spin 1s linear infinite;
}

/* Trip loading state */
.trip-loading-state {
  text-align: center;
  padding: 40px 20px;
  color: #666;
}

.trip-loading-state h6 {
  margin: 16px 0 8px 0;
  color: #333;
  font-weight: 500;
}

.trip-loading-state p {
  margin: 0;
  font-size: 14px;
  color: #999;
}

html, body { 
  font-family: 'Roboto', 'Helvetica', sans-serif;
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow-x: hidden;
}

.mdl-layout {
  width: 100% !important;
  height: 100% !important;
}

/* Remove gap above trip banner - eliminate MDL default spacing */
.mdl-layout__content {
  padding-top: 0 !important;
  margin-top: 0 !important;
}

.page-content {
  padding: 0 16px 16px 16px;
  width: 100%;
  box-sizing: border-box;
}

.demo-card-wide {
  width: 100%;
  margin-bottom: 16px;
}

.mdl-card__supporting-text {
  width: 100%;
  box-sizing: border-box;
}

.centre-text {
  text-align: centre;
}

.full-width {
  width: 100%;
}

/* ============================= */
/* SUMMARY PAGE STYLES           */
/* ============================= */

/* Make summary page title same size as expenses page title */
.summary-page-title {
  font-size: 24px !important;
  font-weight: 300 !important;
  line-height: normal !important;
  margin: 0 0 16px 0 !important;
  color: #333 !important;
}

/* Left-align settlements section to match rest of app */
.settlements-section {
  text-align: left !important;
}

.settlements-section h4 {
  text-align: left !important;
  margin: 0 0 12px 0 !important;
}

.settlements-list {
  text-align: left !important;
}

.settlement-item {
  text-align: left !important;
  justify-content: space-between !important;
}

/* ============================= */
/* MOBILE EXPENSE CARDS          */
/* ============================= */

.expenses-mobile-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 0;
  width: 100%;
  box-sizing: border-box;
}

.expense-card {
  width: 100% !important;
  margin: 0 !important;
  box-sizing: border-box;
}

.expense-card-content {
  padding: 16px;
}

.expense-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
  gap: 12px;
}

.expense-description {
  font-size: 16px;
  font-weight: 500;
  color: #333;
  flex: 1;
  line-height: 1.3;
}

.expense-amount {
  font-size: 18px;
  font-weight: bold;
  color: #4CAF50;
  flex-shrink: 0;
}

.expense-details {
  margin-bottom: 12px;
}

.expense-detail-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
  gap: 8px;
}

.detail-label {
  font-size: 13px;
  color: #666;
  flex-shrink: 0;
  min-width: 60px;
}

.detail-value {
  font-size: 14px;
  color: #333;
  text-align: right;
  flex: 1;
}

.person-breakdown {
  display: flex;
  flex-direction: column;
  gap: 2px;
  text-align: right;
}

.person-amount {
  font-size: 13px;
  color: #4CAF50;
  font-weight: 500;
  line-height: 1.3;
}

.expense-actions {
  display: flex;
  justify-content: flex-end;
  gap: 4px;
  padding-top: 8px;
  border-top: 1px solid #eee;
}

.expense-actions .mdl-button {
  min-width: 36px;
  width: 36px;
  height: 36px;
  padding: 6px;
}

.expense-actions .material-icons {
  font-size: 18px;
}

/* ============================= */
/* MOBILE PAYMENT CARDS          */
/* ============================= */

.payments-mobile-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 0;
  width: 100%;
  box-sizing: border-box;
}

.payment-card {
  width: 100% !important;
  margin: 0 !important;
  box-sizing: border-box;
}

.payment-card-content {
  padding: 16px;
}

.payment-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
  gap: 12px;
}

.payment-description {
  font-size: 16px;
  font-weight: 500;
  color: #333;
  flex: 1;
  line-height: 1.3;
}

.payment-amount {
  font-size: 18px;
  font-weight: bold;
  color: #FF9800;
  flex-shrink: 0;
}

.payment-details {
  margin-bottom: 12px;
}

.payment-detail-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
  gap: 8px;
}

.payment-actions {
  display: flex;
  justify-content: flex-end;
  gap: 4px;
  padding-top: 8px;
  border-top: 1px solid #eee;
}

.payment-actions .mdl-button {
  min-width: 36px;
  width: 36px;
  height: 36px;
  padding: 6px;
}

.payment-actions .material-icons {
  font-size: 18px;
}

/* Desktop table improvements */
@media (min-width: 769px) {
  .table-container {
    overflow-x: auto;
    width: 100%;
  }
  
  .mdl-data-table {
    min-width: 100%;
    white-space: nowrap;
  }
  
  .expense-action-buttons {
    display: flex;
    gap: 4px;
    justify-content: center;
  }
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .expenses-mobile-container,
  .payments-mobile-container {
    margin: 0 -16px;
    gap: 0;
  }
  
  .expense-card,
  .payment-card {
    border-radius: 0 !important;
    margin: 0 !important;
    border-left: none !important;
    border-right: none !important;
    border-top: 1px solid #eee !important;
    border-bottom: 1px solid #eee !important;
    box-shadow: none !important;
  }
  
  .expense-card:first-child,
  .payment-card:first-child {
    border-top: none !important;
  }
  
  .expense-card:last-child,
  .payment-card:last-child {
    border-bottom: none !important;
  }
}

@media (min-width: 769px) {
  .expenses-mobile-container,
  .payments-mobile-container {
    padding: 0 16px;
  }
  
  .expense-card,
  .payment-card {
    margin-bottom: 12px !important;
  }
}

/* ============================= */
/* PWA LOADING SCREEN            */
/* ============================= */

#app-loading {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: white;
  z-index: 9999;
  transition: opacity 0.5s ease;
}

#app-loading img {
  animation: logo-pulse 2s infinite;
}

@keyframes logo-pulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.05); }
  100% { transform: scale(1); }
}

#loading-status {
  opacity: 0.7;
  transition: opacity 0.3s ease;
}

/* ============================= */
/* PWA SYNC STATUS INDICATORS    */
/* ============================= */

.sync-indicator {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  margin-left: 8px;
  border-radius: 50%;
  font-size: 16px;
  vertical-align: middle;
  transition: all 0.3s ease;
}

.sync-indicator i {
  font-size: 16px;
}

.sync-pending {
  background-color: #ff9800;
  color: white;
  animation: sync-pulse 1.5s infinite;
}

.sync-synced {
  background-color: #4caf50;
  color: white;
}

.sync-error {
  background-color: #f44336;
  color: white;
}

.sync-offline {
  background-color: #9e9e9e;
  color: white;
}

@keyframes sync-pulse {
  0% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.7;
    transform: scale(1.05);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

/* Offline indicator in header */
#offline-indicator {
  background-color: #ff5722;
  color: white;
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
  margin-left: 8px;
  transition: all 0.3s ease;
}

#offline-indicator.hidden {
  opacity: 0;
  transform: translateX(20px);
}

/* Sync button in header */
#sync-button {
  background-color: transparent !important;
  color: white !important;
  margin-left: 8px;
  transition: all 0.3s ease;
}

#sync-button:hover {
  background-color: rgba(255,255,255,0.1) !important;
}

/* Export buttons fix */
.export-btn.mdl-button--colored {
  background-color: #4285f4 !important;
  color: white !important;
}

.export-btn.mdl-button--colored i.material-icons {
  color: white !important;
}

#sync-button.syncing {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* Pending sync counter */
#pending-sync-indicator {
  background-color: #ff9800;
  color: white;
  padding: 2px 6px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: bold;
  margin-left: 4px;
  min-width: 16px;
  text-align: center;
}

/* ============================= */
/* TABLE STYLES                  */
/* ============================= */

.table-container {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  width: 100%;
  position: relative;
}

.mdl-data-table {
  width: 100%;
  table-layout: auto;
}

.mdl-data-table td, .mdl-data-table th {
  text-align: left;
  padding: 8px 12px;
  white-space: nowrap;
}

.sync-status-cell {
  width: 40px;
  text-align: center;
  padding: 8px 4px;
}

/* ============================= */
/* FORM STYLES                   */
/* ============================= */

#add-expense-form .mdl-textfield,
#edit-expense-form .mdl-textfield {
  width: 100%;
}

.date-field-label {
  display: block;
  color: rgba(0,0,0,.54);
  font-size: 12px;
  margin-bottom: 5px;
}

input[type="date"],
input[type="number"],
input[type="text"],
select,
textarea {
  width: 100%;
  box-sizing: border-box;
}

/* Fix for select elements with labels to prevent overlapping */
.mdl-textfield select.mdl-textfield__input {
  margin-top: 16px;
}

.mdl-textfield label[for*="paid-by"],
.mdl-textfield label[for*="payment-from"],
.mdl-textfield label[for*="payment-to"],
.mdl-textfield label[for*="trip-currency"] {
  position: relative !important;
  top: -10px !important;
  font-size: 12px !important;
  color: rgba(0,0,0,.54) !important;
  display: block !important;
}

/* ============================= */
/* COMPONENT STYLES              */
/* ============================= */

/* Fix for FAB buttons to ensure they stay circular */
.mdl-button--fab,
.mdl-button--mini-fab {
  border-radius: 50% !important;
  width: 56px !important;
  height: 56px !important;
  min-width: 56px !important;
  min-height: 56px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  box-sizing: border-box !important;
}

.mdl-button--mini-fab {
  width: 40px !important;
  height: 40px !important;
  min-width: 40px !important;
  min-height: 40px !important;
}

/* Loading spinner */
.loading-container {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255,255,255,0.8);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

/* Balance indicators */
.balance-positive {
  color: green;
  font-weight: bold;
}

.balance-negative {
  color: red;
  font-weight: bold;
}

.balance-neutral {
  color: #333;
}

/* Settlement styles */
.settlement {
  margin-bottom: 8px;
  padding: 12px;
  background-color: #f5f5f5;
  border-radius: 4px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.settlement-item {
  padding: 16px;
  background-color: #f5f5f5;
  border-radius: 4px;
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.settlement-status {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
}

.settlement-status.pending {
  background-color: #fff3e0;
  color: #ff6f00;
}

.settlement-status.partially-paid {
  background-color: #e3f2fd;
  color: #1976d2;
}

.settlement-status.completed {
  background-color: #e8f5e9;
  color: #388e3c;
}

/* Split options */
.split-options {
  margin-top: 16px;
  padding: 16px;
  background-color: #f5f5f5;
  border-radius: 4px;
}

/* Split method radio buttons - vertical layout */
.split-method-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 8px;
}

.split-method-container .mdl-radio {
  display: block;
  margin: 0;
}

.remaining-info {
  margin-top: 8px;
  padding: 8px;
  background-color: #e3f2fd;
  border-radius: 4px;
  font-size: 14px;
}

.remaining-positive {
  color: blue;
}

.remaining-negative {
  color: red;
}

.remaining-zero {
  color: green;
}

/* Split details */
.split-details {
  font-size: 12px;
  color: #666;
}

.split-person-container {
  display: flex;
  align-items: center;
  margin-bottom: 8px;
  gap: 8px;
}

.split-person-container label {
  flex: 0 0 120px;
}

.split-person-container .mdl-textfield {
  flex: 1;
  width: auto;
}

/* Tabs - General improvements */
.mdl-tabs {
  width: 100%;
  overflow: visible;
}

.mdl-tabs__tab-bar {
  width: 100%;
  box-sizing: border-box;
}

.mdl-tabs__tab {
  text-transform: none;
  box-sizing: border-box;
}

/* People list */
/* Person card styling to match expense cards */
.person-card {
  width: 100% !important;
  margin: 0 0 12px 0 !important;
  box-sizing: border-box;
}

.person-card-content {
  padding: 16px 16px 8px 16px;
}

.person-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 8px;
}

.person-header strong {
  font-size: 16px;
  color: #333;
  flex-grow: 1;
}

.person-details {
  margin-bottom: 6px;
  line-height: 1.4;
}

.person-details div {
  margin-bottom: 2px;
}

.person-actions {
  display: flex;
  justify-content: flex-end;
  gap: 4px;
  padding: 4px 0 0 0;
  border-top: 1px solid #eee;
}

.person-actions .mdl-button {
  min-width: 36px;
  width: 36px;
  height: 36px;
  padding: 6px;
}

/* Legacy person-item for backward compatibility */
.person-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px;
  margin-bottom: 8px;
  background-color: #f5f5f5;
  border-radius: 4px;
}

/* Dialogs */
.mdl-dialog {
  border: none;
  box-shadow: 0 9px 46px 8px rgba(0,0,0,.14), 0 11px 15px -7px rgba(0,0,0,.12), 0 24px 38px 3px rgba(0,0,0,.2);
  width: 80%;
  max-width: 700px;
}

.mdl-dialog__title {
  padding: 24px 24px 0;
  margin: 0;
  font-size: 2.5rem;
}

.mdl-dialog__content {
  padding: 20px 24px 24px 24px;
  color: rgba(0,0,0,.54);
}

.mdl-dialog__actions {
  padding: 8px;
  display: flex;
  flex-direction: row-reverse;
}

/* Expense details */
.expense-detail-row {
  margin-bottom: 15px;
}

.expense-detail-row strong {
  display: block;
  margin-bottom: 3px;
}

.expense-detail-divider {
  border-top: 1px solid #eee;
  margin: 20px 0;
}

.split-details-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 10px;
}

.split-details-table th {
  text-align: left;
  font-weight: bold;
  border-bottom: 1px solid #ddd;
  padding: 8px;
}

.split-details-table td {
  padding: 8px;
  border-bottom: 1px solid #eee;
}

/* Action buttons */
.expense-action-buttons {
  display: flex;
  gap: 8px;
  white-space: nowrap;
}

/* ============================= */
/* MOBILE RESPONSIVE STYLES      */
/* ============================= */

/* Medium devices (tablets, 768px and down) - smaller tab text */
@media only screen and (max-width: 768px) {
  .mdl-tabs__tab {
    font-size: 12px !important;
    padding: 0 6px !important;
  }
}

/* Small devices (phones, 600px and down) */
@media only screen and (max-width: 600px) {
  /* Layout adjustments */
  .page-content {
    padding: 8px;
  }
  
  .demo-card-wide {
    margin: 8px 0;
    width: calc(100% - 16px) !important;
    max-width: calc(100vw - 32px);
    box-sizing: border-box;
  }
  
  .mdl-card__supporting-text {
    padding: 12px;
    width: 100% !important;
    box-sizing: border-box;
  }
  
  /* Ensure cards don't overflow on very small screens */
  .mdl-card {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box;
    overflow: hidden;
  }
  
  /* Trip card specific fixes */
  .trip-card, [class*="trip"] .mdl-card {
    width: 100% !important;
    min-width: 0 !important;
    word-wrap: break-word;
    overflow-wrap: break-word;
  }
  
  /* Prevent text overflow in trip cards */
  .trip-card h3, .trip-card h4, .trip-card .trip-name {
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
    max-width: 100%;
  }
  
  /* Tab bar - fit all tabs across the width without scrolling */
  .mdl-tabs__tab-bar {
    display: flex !important;
    width: 100% !important;
    justify-content: space-between !important;
    overflow: hidden !important;
  }
  
  .mdl-tabs__tab {
    flex: 1 !important;
    min-width: 0 !important;
    padding: 0 4px !important;
    font-size: 12px !important;
    height: 48px !important;
    line-height: 48px !important;
    text-align: center !important;
    text-overflow: ellipsis !important;
    overflow: hidden !important;
    white-space: nowrap !important;
    box-sizing: border-box !important;
    font-weight: 500 !important;
  }
  
  /* Make table container scrollable horizontally */
  .table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 -16px;
    padding: 0 16px;
  }
  
  /* Expense table - mobile friendly */
  #expense-table {
    min-width: 650px;
    table-layout: fixed;
    width: 100%;
    border-collapse: collapse;
  }
  
  /* Set specific column widths for expense table - mobile optimized */
  #expense-table th:nth-child(1),
  #expense-table td:nth-child(1) { /* Description */
    width: 120px;
    min-width: 120px;
  }
  
  #expense-table th:nth-child(2),
  #expense-table td:nth-child(2) { /* Amount */
    width: 70px;
    min-width: 70px;
  }
  
  #expense-table th:nth-child(3),
  #expense-table td:nth-child(3) { /* Paid By */
    width: 80px;
    min-width: 80px;
  }
  
  #expense-table th:nth-child(4),
  #expense-table td:nth-child(4) { /* Date */
    width: 80px;
    min-width: 80px;
  }
  
  #expense-table th:nth-child(5),
  #expense-table td:nth-child(5) { /* Split Method */
    width: 100px;
    min-width: 100px;
  }
  
  #expense-table th:nth-child(6),
  #expense-table td:nth-child(6) { /* Status */
    width: 70px;
    min-width: 70px;
  }
  
  #expense-table th:nth-child(7),
  #expense-table td:nth-child(7) { /* Actions */
    width: 100px;
    min-width: 100px;
  }
  
  #expense-table td,
  #expense-table th {
    padding: 8px 6px;
    font-size: 12px;
    white-space: nowrap;
    text-align: left;
    border-bottom: 1px solid #ddd;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  
  #expense-table th {
    font-weight: bold;
    background-color: #f5f5f5;
  }
  
  /* Allow text wrapping for the split details column */
  #expense-table th:nth-child(6),
  #expense-table td:nth-child(6) {
    white-space: normal;
  }
  
  /* Make action buttons slightly smaller on mobile */
  .expense-action-buttons {
    gap: 4px;
  }
  
  .expense-action-buttons button {
    padding: 4px;
    min-width: 36px;
    height: 36px;
    margin: 0 !important;
  }
  
  .expense-action-buttons button i {
    font-size: 18px;
  }
  
  /* Touch-friendly buttons */
  .mdl-button {
    min-height: 48px;
    padding: 12px 16px;
  }
  
  .mdl-button--icon {
    width: 48px;
    height: 48px;
  }
  
  /* Form adjustments */
  input[type="date"],
  input[type="number"],
  input[type="text"],
  select,
  textarea {
    font-size: 16px; /* Prevents zoom on iOS */
    padding: 12px 8px;
    min-height: 48px;
  }
  
  /* Dialog adjustments */
  .mdl-dialog {
    width: 95% !important;
    max-width: none !important;
    margin: 16px;
  }
  
  .mdl-dialog__title {
    font-size: 1.8rem;
    padding: 20px 20px 0;
  }
  
  .mdl-dialog__content {
    padding: 16px;
    max-height: 70vh;
    overflow-y: auto;
  }
  
  .mdl-dialog__actions {
    padding: 8px;
    flex-wrap: wrap;
  }
  
  .mdl-dialog__actions button {
    width: 100%;
    margin: 4px 0;
  }
  
  /* Split with checkboxes - larger touch targets */
  .mdl-checkbox {
    height: 48px;
    padding: 12px 0;
  }
  
  .mdl-checkbox__label {
    padding-left: 40px;
    line-height: 48px;
  }
  
  /* Settlement items mobile layout */
  .settlement-item {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }
  
  .settlement-item button {
    width: 100%;
  }
  
  /* Summary tables - keep them but make scrollable */
  #balances-table-container,
  #breakdown-table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  
  /* Grid adjustments */
  .mdl-grid {
    padding: 0;
  }
  
  .mdl-cell {
    margin: 8px 0;
    width: 100% !important;
  }
  
  /* Ensure FAB buttons stay circular on mobile */
  .mdl-button--fab {
    width: 48px !important;
    height: 48px !important;
    min-width: 48px !important;
    min-height: 48px !important;
  }
  
  .mdl-button--mini-fab {
    width: 36px !important;
    height: 36px !important;
    min-width: 36px !important;
    min-height: 36px !important;
  }
  
  /* People list mobile */
  .person-item {
    flex-wrap: wrap;
    gap: 8px;
  }
  
  .person-item span {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  
  .person-item button {
    width: 100%;
    margin: 4px 0;
  }
  
  /* Custom split inputs */
  .split-person-container {
    flex-direction: column;
    align-items: stretch;
  }
  
  .split-person-container label {
    flex: none;
    width: 100%;
    margin-bottom: 4px;
  }
  
  .split-person-container .mdl-textfield {
    width: 100%;
  }
  
  /* PWA sync indicators on mobile */
  .sync-indicator {
    width: 20px;
    height: 20px;
    font-size: 14px;
  }
  
  .sync-indicator i {
    font-size: 14px;
  }
  
  /* Header adjustments for mobile */
  .mdl-layout__header-row {
    padding: 0 12px !important;
  }
  
  .mdl-layout__header-row img {
    height: 32px !important;
    margin-right: 8px !important;
  }
  
  .mdl-layout-title {
    font-size: 16px !important;
  }
  
  .mdl-layout__header-row span[style*="font-size: 12px"] {
    font-size: 10px !important;
  }
  
  #offline-indicator,
  #pending-sync-indicator {
    padding: 1px 4px !important;
    font-size: 9px !important;
    border-radius: 6px !important;
  }
}

/* Extra small devices (very small phones, 320px and down) */
@media only screen and (max-width: 320px) {
  .page-content {
    padding: 4px;
  }
  
  .demo-card-wide {
    margin: 4px 0;
    width: calc(100% - 8px) !important;
    max-width: calc(100vw - 16px);
  }
  
  .mdl-card__supporting-text {
    padding: 8px;
  }
  
  .mdl-layout__header-row {
    padding: 0 8px !important;
  }
  
  .mdl-layout__header-row img {
    height: 28px !important;
    margin-right: 6px !important;
  }
  
  .mdl-layout-title {
    font-size: 14px !important;
  }
  
  /* Even smaller tab settings for very small screens */
  .mdl-tabs__tab {
    padding: 0 2px !important;
    font-size: 11px !important;
  }
}

/* ============================= */
/* DARK MODE STYLES              */
/* ============================= */

body.dark-mode {
  background-color: #121212;
  color: #e0e0e0;
}

.dark-mode .loading-container {
  background-color: rgba(0, 0, 0, 0.8);
}

.dark-mode .mdl-layout__header,
.dark-mode .mdl-layout__drawer {
  background-color: #1f1f1f;
}

/* Improved contrast for navigation links */
.mdl-layout__drawer .mdl-navigation__link {
  color: rgba(0,0,0,0.87) !important; /* Better contrast on light background */
  font-weight: 500;
}

.mdl-layout__drawer .mdl-navigation__link:hover {
  background-color: rgba(0,0,0,0.08) !important;
  color: rgba(0,0,0,0.87) !important;
}

.dark-mode .mdl-layout__drawer .mdl-navigation__link {
  color: #e0e0e0 !important;
}

.dark-mode .mdl-layout__drawer .mdl-navigation__link:hover {
  background-color: #2a2a2a !important;
  color: #ffffff !important;
}

.dark-mode .mdl-card {
  background-color: #1f1f1f;
  color: #e0e0e0;
}

.dark-mode .mdl-card__title {
  color: #e0e0e0;
}

.dark-mode .mdl-tabs__tab {
  color: #999;
}

.dark-mode .mdl-tabs__tab.is-active {
  color: #bb86fc !important;
  border-bottom-color: #bb86fc;
}

.dark-mode .mdl-textfield__input,
.dark-mode input[type="text"],
.dark-mode input[type="number"],
.dark-mode input[type="date"],
.dark-mode select,
.dark-mode textarea {
  background-color: #2a2a2a;
  color: #e0e0e0;
  border-color: #444;
}

.dark-mode .mdl-textfield__label {
  color: #999;
}

.dark-mode .mdl-textfield.is-focused .mdl-textfield__label {
  color: #bb86fc;
}

.dark-mode .mdl-data-table {
  background-color: #1f1f1f;
  border-color: #444;
}

.dark-mode .mdl-data-table th {
  background-color: #2a2a2a;
  color: #e0e0e0;
  border-bottom-color: #444;
}

.dark-mode .mdl-data-table td {
  color: #e0e0e0;
  border-bottom-color: #333;
}

.dark-mode .mdl-data-table tbody tr:hover {
  background-color: #2a2a2a;
}

.dark-mode .mdl-dialog {
  background-color: #1f1f1f;
  color: #e0e0e0;
}

.dark-mode .mdl-dialog__title {
  color: #e0e0e0;
}

.dark-mode .mdl-dialog__content {
  color: #e0e0e0;
}

.dark-mode .mdl-button {
  color: #e0e0e0;
}

.dark-mode .mdl-button--colored {
  background-color: #bb86fc;
  color: #000;
}

.dark-mode .mdl-button--colored:hover {
  background-color: #9965d4;
}

.dark-mode .balance-positive {
  color: #4caf50;
}

.dark-mode .balance-negative {
  color: #f44336;
}

.dark-mode .settlement,
.dark-mode .settlement-item {
  background-color: #2a2a2a;
  border-color: #444;
}

.dark-mode .settlement button {
  background-color: #1976d2 !important;
}

.dark-mode .person-item {
  background-color: #2a2a2a;
  color: #e0e0e0;
}

.dark-mode .split-options {
  background-color: #2a2a2a;
}

.dark-mode .remaining-info {
  background-color: #333;
  color: #e0e0e0;
}

.dark-mode .date-field-label {
  color: rgba(255,255,255,.7);
}

.dark-mode h1,
.dark-mode h2,
.dark-mode h3,
.dark-mode h4,
.dark-mode h5,
.dark-mode h6 {
  color: #e0e0e0;
}

/* Dark mode sync indicators */
.dark-mode .sync-pending {
  background-color: #ff9800;
}

.dark-mode .sync-synced {
  background-color: #4caf50;
}

.dark-mode .sync-error {
  background-color: #f44336;
}

.dark-mode .sync-offline {
  background-color: #757575;
}

.dark-mode #offline-indicator {
  background-color: #ff5722;
}

.dark-mode #sync-button {
  background-color: #bb86fc !important;
  color: #000 !important;
}

.dark-mode #sync-button:hover {
  background-color: #9965d4 !important;
}

.dark-mode #pending-sync-indicator {
  background-color: #ff9800;
}

/* Additional dark mode fixes */
.dark-mode .split-details {
  color: #999;
}

/* ============================= */
/* SELECT FIELD STYLING          */
/* ============================= */

/* Fix spacing for select fields with positioned labels */
.mdl-textfield select {
  margin-top: 16px;
}

/* Select field labels with positioning */
#expense-paid-by + label,
#edit-expense-paid-by + label,
#payment-from + label,
#payment-to + label,
#edit-trip-currency + label {
  margin-bottom: 8px;
  display: block;
}

/* Dark mode select labels */
.dark-mode #expense-paid-by + label,
.dark-mode #edit-expense-paid-by + label,
.dark-mode #payment-from + label,
.dark-mode #payment-to + label,
.dark-mode #edit-trip-currency + label {
  color: rgba(255,255,255,.7) !important;
}

.dark-mode .remaining-positive {
  color: #64b5f6;
}

.dark-mode .remaining-negative {
  color: #ef5350;
}

.dark-mode .remaining-zero {
  color: #81c784;
}

.dark-mode .settlement-status.pending {
  background-color: #3e2723;
  color: #ffab40;
}

.dark-mode .settlement-status.partially-paid {
  background-color: #1a237e;
  color: #64b5f6;
}

.dark-mode .settlement-status.completed {
  background-color: #2e7d32;
  color: #81c784;
}

.dark-mode .balance-neutral {
  color: #e0e0e0;
}

.dark-mode .expense-detail-divider {
  border-top-color: #444;
}

.dark-mode .split-details-table th {
  border-bottom-color: #444;
  color: #e0e0e0;
}

.dark-mode .split-details-table td {
  border-bottom-color: #333;
  color: #e0e0e0;
}

.dark-mode .expense-detail-row strong {
  color: #e0e0e0;
}

.dark-mode .mdl-checkbox__label {
  color: #e0e0e0;
}

.dark-mode .mdl-radio__label {
  color: #e0e0e0;
}

.dark-mode option {
  background-color: #2a2a2a;
  color: #e0e0e0;
}

.dark-mode .mdl-textfield label[for*="paid-by"],
.dark-mode .mdl-textfield label[for*="payment-from"],
.dark-mode .mdl-textfield label[for*="payment-to"],
.dark-mode .mdl-textfield label[for*="trip-currency"] {
  color: rgba(255,255,255,.7) !important;
}

.dark-mode p {
  color: #e0e0e0;
}

.dark-mode ul, .dark-mode li {
  color: #e0e0e0;
}

.dark-mode small {
  color: #999;
}

.dark-mode #loading-message {
  color: #999;
}

/* ============================= */
/* SUMMARY PAGE STYLES           */
/* ============================= */

.summary-overview {
  margin-bottom: 32px;
}

.summary-stat {
  background: white;
  padding: 24px;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  text-align: center;
  transition: all 0.3s ease;
  border: 1px solid rgba(0,0,0,0.05);
}

.summary-stat:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
}

.summary-stat h4 {
  margin: 0 0 8px 0;
  font-size: 14px;
  font-weight: 500;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.summary-stat .stat-value {
  margin: 0;
  font-size: 32px;
  font-weight: 700;
  color: #1976d2;
  line-height: 1.2;
}

/* Add gradient background for total expenses */
.summary-stat:first-child .stat-value {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Different colors for different stats */
.mdl-cell:nth-child(2) .summary-stat .stat-value {
  color: #43a047;
}

.mdl-cell:nth-child(3) .summary-stat .stat-value {
  color: #fb8c00;
}

.breakdown-section,
.settlement-breakdown-section,
.balances-section {
  background: white;
  padding: 24px;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  margin-bottom: 24px;
  border: 1px solid rgba(0,0,0,0.05);
}

.breakdown-section h4,
.settlement-breakdown-section h4,
.balances-section h4 {
  margin: 0 0 20px 0;
  font-size: 20px;
  font-weight: 600;
  color: #333;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Add icons to section headers */
.breakdown-section h4:before {
  content: "receipt_long";
  font-family: 'Material Icons';
  font-size: 24px;
  color: #667eea;
}

.settlement-breakdown-section h4:before {
  content: "payments";
  font-family: 'Material Icons';
  font-size: 24px;
  color: #43a047;
}

.balances-section h4:before {
  content: "account_balance";
  font-family: 'Material Icons';
  font-size: 24px;
  color: #fb8c00;
}

/* Enhanced table styles */
.breakdown-section table,
.settlement-breakdown-section table,
.balances-section table {
  width: 100%;
  border: none;
  background: transparent;
}


.breakdown-section th,
.settlement-breakdown-section th,
.balances-section th {
  background: #f8f9fa;
  font-weight: 600;
  color: #666;
  text-transform: uppercase;
  font-size: 12px;
  letter-spacing: 0.5px;
  padding: 12px 8px;
  border: none;
}

.breakdown-section td,
.settlement-breakdown-section td,
.balances-section td {
  padding: 12px 8px;
  border-bottom: 1px solid #f0f0f0;
  font-size: 15px;
}

.breakdown-section tr:last-child td,
.settlement-breakdown-section tr:last-child td,
.balances-section tr:last-child td {
  border-bottom: none;
}

.breakdown-section tr:hover,
.settlement-breakdown-section tr:hover,
.balances-section tr:hover {
  background: #f8f9fa;
}

/* Balance colors */
.balance-positive {
  color: #43a047;
  font-weight: 600;
}

.balance-negative {
  color: #f44336;
  font-weight: 600;
}

.balance-zero {
  color: #999;
}

/* Summary message styles */
.summary-message {
  background: #e3f2fd;
  color: #1976d2;
  padding: 16px;
  border-radius: 8px;
  margin: 20px 0;
  display: flex;
  align-items: center;
  gap: 12px;
}

.summary-message:before {
  content: "info";
  font-family: 'Material Icons';
  font-size: 24px;
}

.summary-message.success {
  background: #e8f5e9;
  color: #2e7d32;
}

.summary-message.success:before {
  content: "check_circle";
}

/* Dark mode support for summary */
.dark-mode .summary-stat {
  background: #2a2a2a;
  border-color: #444;
}

.dark-mode .breakdown-section,
.dark-mode .settlement-breakdown-section,
.dark-mode .balances-section {
  background: #2a2a2a;
  border-color: #444;
}

.dark-mode .breakdown-section h4,
.dark-mode .settlement-breakdown-section h4,
.dark-mode .balances-section h4 {
  color: #e0e0e0;
}

.dark-mode .summary-stat h4 {
  color: #999;
}

.dark-mode .breakdown-section th,
.dark-mode .settlement-breakdown-section th,
.dark-mode .balances-section th {
  background: #333;
  color: #999;
}

.dark-mode .breakdown-section td,
.dark-mode .settlement-breakdown-section td,
.dark-mode .balances-section td {
  border-bottom-color: #444;
  color: #e0e0e0;
}

.dark-mode .breakdown-section tr:hover,
.dark-mode .settlement-breakdown-section tr:hover,
.dark-mode .balances-section tr:hover {
  background: #333;
}

/* Add subtle animations */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.summary-stat,
.breakdown-section,
.settlement-breakdown-section,
.balances-section {
  animation: fadeInUp 0.5s ease;
}

.breakdown-section {
  animation-delay: 0.1s;
}

.settlement-breakdown-section {
  animation-delay: 0.2s;
}

.balances-section {
  animation-delay: 0.3s;
}

/* ============================= */
/* INSTALL PROMPT STYLES         */
/* ============================= */

#install-prompt {
  position: fixed;
  bottom: 20px;
  left: 20px;
  right: 20px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 16px;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
  z-index: 1000;
  display: none;
  animation: slideUp 0.3s ease;
}

@keyframes slideUp {
  from {
    transform: translateY(100%);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

#install-prompt .install-content {
  display: flex;
  align-items: center;
  gap: 12px;
}

#install-prompt .install-icon {
  font-size: 24px;
}

#install-prompt .install-text {
  flex: 1;
}

#install-prompt .install-title {
  font-weight: 500;
  margin-bottom: 4px;
}

#install-prompt .install-subtitle {
  font-size: 14px;
  opacity: 0.9;
}

#install-prompt .install-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

#install-prompt button {
  padding: 8px 16px;
  border: none;
  border-radius: 6px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

#install-prompt .install-btn {
  background-color: rgba(255,255,255,0.2);
  color: white;
}

#install-prompt .install-btn:hover {
  background-color: rgba(255,255,255,0.3);
}

#install-prompt .dismiss-btn {
  background-color: rgba(255,255,255,0.1);
  color: white;
}

#install-prompt .dismiss-btn:hover {
  background-color: rgba(255,255,255,0.2);
}

/* ============================= */
/* TRIP BALANCE SUMMARY STYLES   */
/* ============================= */

.user-balance-summary {
  margin-top: 12px;
  padding: 12px;
  background: #f8f9fa;
  border-radius: 8px;
  border-left: 4px solid #4285f4;
  font-size: 13px;
  text-align: left;
}

.balance-header {
  font-weight: 600;
  margin-bottom: 8px;
  color: #333;
  text-align: left;
}

.balance-amount.positive {
  color: #43a047;
}

.balance-amount.negative {
  color: #f44336;
}

.balance-item {
  margin: 4px 0;
  padding: 4px 0;
  display: flex;
  align-items: center;
  gap: 6px;
  justify-content: flex-start;
  text-align: left;
}

.balance-item.debt {
  color: #d84315;
}

.balance-item.credit {
  color: #2e7d32;
}

/* Dark mode support */
.dark-mode .user-balance-summary {
  background: #2a2a2a;
  border-left-color: #bb86fc;
}

.dark-mode .balance-header {
  color: #e0e0e0;
}

.dark-mode .balance-item.debt {
  color: #ff8a65;
}

.dark-mode .balance-item.credit {
  color: #81c784;
}

/* Mobile responsiveness */
@media (max-width: 768px) {
  .user-balance-summary {
    padding: 10px;
    margin-top: 10px;
    font-size: 12px;
  }
  
  .balance-header {
    margin-bottom: 6px;
  }
  
  .balance-item {
    margin: 3px 0;
    padding: 3px 0;
  }
}

/* ============================= */
/* PRINT STYLES                  */
/* ============================= */

/* ============================= */
/* INVITE SYSTEM STYLES          */
/* ============================= */

.person-badge {
  margin-left: 8px;
  font-size: 12px;
  padding: 2px 6px;
  border-radius: 12px;
  background: #f5f5f5;
  display: inline-block;
  vertical-align: middle;
}

.person-badge.authenticated {
  background: #e8f5e8;
  color: #2e7d32;
}

.person-badge.guest {
  background: #fff3e0;
  color: #ef6c00;
}

/* Invite modal specific styles */
.invite-modal .trip-summary {
  background: #f9f9f9;
  border-radius: 4px;
  padding: 12px;
}

.invite-modal .expense-item {
  display: flex;
  justify-content: space-between;
  margin-bottom: 4px;
  font-size: 13px;
}

.invite-modal .link-container {
  display: flex;
  gap: 8px;
  align-items: center;
  background: #f5f5f5;
  padding: 12px;
  border-radius: 4px;
}

.invite-modal .invite-link-input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 14px;
  font-family: monospace;
  outline: none;
}

@media print {
  .mdl-layout__drawer,
  .mdl-layout__header,
  .mdl-tabs__tab-bar,
  .action-button,
  .mdl-button,
  #offline-indicator,
  #sync-button,
  #pending-sync-indicator,
  .sync-indicator,
  #install-prompt {
    display: none !important;
  }
  
  .mdl-card {
    box-shadow: none;
    border: 1px solid #000;
  }
}

/* Receipt Upload and Display Styles */
.receipt-icon {
  color: #4CAF50;
  font-size: 18px;
  margin-left: 8px;
  vertical-align: middle;
}

.receipt-thumbnail {
  margin-top: 8px;
}

.receipt-thumbnail img {
  max-height: 60px;
  max-width: 100%;
  border-radius: 4px;
  cursor: pointer;
  transition: opacity 0.2s;
}

.receipt-thumbnail img:hover {
  opacity: 0.8;
}

.receipt-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
}

/* Receipt modal dialog - ensure it appears above expense details dialog */
#receipt-modal-dialog {
  z-index: 10001 !important;
}

#receipt-modal-dialog::backdrop {
  z-index: 10000 !important;
  background-color: rgba(0, 0, 0, 0.6);
}

/* ============================= */
/* TRIP BANNER                   */
/* ============================= */

/* Override any parent container centering */
.page-content .mdl-tabs .trip-banner,
.mdl-tabs .trip-banner {
  margin-left: 0 !important;
  margin-right: auto !important;
  text-align: left !important;
  justify-self: flex-start !important;
  align-self: flex-start !important;
  float: left !important;
  clear: left !important;
}

/* No margin adjustment needed since banner is no longer absolute positioned */

/* Mobile PWA specific adjustments */
@media (max-width: 768px) {
  .trip-banner {
    padding: 12px 0px 12px 16px !important;
    min-height: 42px !important;
    margin: 0 !important;
  }
  
  .trip-info {
    padding: 0px 0px 0px 0px !important;
  }
}

/* Extra aggressive mobile PWA rules */
@media (max-width: 480px) {
  .trip-banner {
    padding: 12px 0px 12px 16px !important;
    min-height: 42px !important;
    margin: 0 0 8px 0 !important;
  }
  
  .trip-info {
    padding: 0px 0px 0px 0px !important;
  }
  
  .trip-name-with-icon {
    font-size: 14px !important;
  }
}

.trip-banner {
  display: flex !important;
  align-items: center;
  justify-content: flex-start !important;
  background: #f8f9fa;
  border: 1px solid #e1e4e8;
  border-left: none !important;
  border-right: none;
  padding: 12px 0px 12px 0px !important;
  min-height: 42px;
  position: relative;
  transition: background-color 0.2s ease;
  text-align: left !important;
  margin: 0 !important;
  width: 100% !important;
  box-sizing: border-box !important;
}

/* Remove gap below trip banner */
#trip-banner + .mdl-tabs__tab-bar {
  margin-top: 0 !important;
  padding-top: 0 !important;
}

.trip-banner:hover {
  background: #f1f3f4;
}

.trip-info {
  display: flex !important;
  align-items: center;
  justify-content: flex-start !important;
  cursor: pointer;
  min-width: 0; /* Allow text truncation */
  padding: 12px 0px 12px 8px !important;
  border-radius: 4px;
  transition: background-color 0.2s ease;
  margin-left: 0 !important;
  text-align: left !important;
}

.trip-info:hover {
  background: rgba(66, 133, 244, 0.08);
}

.trip-name-with-icon {
  display: inline-flex !important;
  align-items: center;
  justify-content: flex-start !important;
  font-weight: 500;
  color: #333;
  font-size: 16px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex-shrink: 1;
  margin-left: 0 !important;
  margin-right: auto !important;
  text-align: left !important;
  align-self: flex-start !important;
  position: relative !important;
  left: 0 !important;
}

/* Extremely aggressive left alignment for trip selector */
#trip-banner, #trip-banner .trip-info, #trip-banner .trip-name-with-icon {
  justify-content: flex-start !important;
  text-align: left !important;
  margin-left: 0 !important;
  align-items: flex-start !important;
  align-self: flex-start !important;
}

/* Override any MDL centering behavior */
.mdl-tabs #trip-banner,
.mdl-tabs #trip-banner * {
  text-align: left !important;
  justify-content: flex-start !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
}

.trip-icon {
  color: #4285f4;
  font-size: 20px !important;
  margin-right: 8px;
  vertical-align: middle;
}

.dropdown-arrow {
  color: #666;
  font-size: 18px !important;
  transition: transform 0.2s ease;
  margin-left: 6px;
  vertical-align: middle;
}

.trip-info:hover .dropdown-arrow {
  color: #4285f4;
}


/* Trip banner responsive design */
@media (max-width: 768px) {
  .trip-banner {
    padding: 8px 12px;
    min-height: 44px;
  }
  
  .trip-name {
    font-size: 14px;
    max-width: 200px;
  }
  
  .trip-icon {
    font-size: 18px !important;
  }
}

@media (max-width: 480px) {
  .trip-banner {
    padding: 6px 8px;
    min-height: 40px;
  }
  
  .trip-name {
    font-size: 14px;
    max-width: 150px;
  }
  
  .trip-info {
    padding: 2px 4px;
    gap: 6px;
  }
}

/* Trip Switcher Dialog */
.trip-switcher-list {
  max-height: 300px;
  overflow-y: auto;
  margin: 8px 0;
}

.trip-switcher-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px;
  border-radius: 4px;
  cursor: pointer;
  border: 1px solid transparent;
  margin-bottom: 4px;
  transition: all 0.2s ease;
}

.trip-switcher-item:hover {
  background: #f1f3f4;
  border-color: #e1e4e8;
}

.trip-switcher-item.selected {
  background: rgba(66, 133, 244, 0.08);
  border-color: #4285f4;
}

.trip-switcher-main {
  flex: 1;
  min-width: 0;
}

.trip-switcher-name {
  font-weight: 500;
  color: #333;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.trip-switcher-meta {
  font-size: 12px;
  color: #666;
}

.trip-switcher-check {
  color: #4285f4;
  font-size: 20px !important;
}

.receipt-modal-content {
  background: white;
  padding: 20px;
  border-radius: 8px;
  max-width: 90%;
  max-height: 90%;
  position: relative;
}

.receipt-modal img {
  max-width: 100%;
  max-height: 70vh;
  border-radius: 4px;
}

.receipt-modal-close {
  position: absolute;
  top: 10px;
  right: 15px;
  font-size: 24px;
  cursor: pointer;
  color: #666;
}

.receipt-modal-close:hover {
  color: #000;
}

/* ============================= */
/* RECEIPT DISPLAY STYLES        */
/* ============================= */

.receipt-icon {
  font-size: 16px !important;
  color: #4CAF50;
  margin-left: 8px;
  vertical-align: middle;
}

.receipt-thumbnail {
  margin: 8px 0;
  text-align: center;
}

.receipt-thumbnail img {
  border: 1px solid #ddd;
  border-radius: 4px;
  transition: transform 0.2s ease;
}

.receipt-thumbnail img:hover {
  transform: scale(1.05);
  border-color: #2196F3;
}

/* ============================= */
/* FORM VALIDATION STYLES        */
/* ============================= */

/* Disabled submit buttons */
button[disabled] {
  opacity: 0.5 !important;
  cursor: not-allowed !important;
  pointer-events: none !important;
}

button[disabled].mdl-button--colored {
  background-color: #ccc !important;
  color: #666 !important;
}

/* Validation error messages */
.validation-error {
  color: #d32f2f;
  font-size: 12px;
  margin-top: 4px;
  line-height: 1.3;
  font-family: "Roboto", "Helvetica", "Arial", sans-serif;
}

/* Error state for input fields */
.mdl-textfield.has-error .mdl-textfield__input {
  border-color: #d32f2f;
  box-shadow: none;
}

.mdl-textfield.has-error .mdl-textfield__label {
  color: #d32f2f;
}

/* ============================= */
/* IMPROVED TRIP LIST LAYOUT     */
/* ============================= */

/* Main trip list container */
.trip-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 0;
  text-align: left;
  align-items: stretch;
}

/* Individual trip card */
.trip-list .trip-list-item {
  background: white !important;
  border: 1px solid #e0e0e0 !important;
  border-radius: 8px !important;
  padding: 16px !important;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1) !important;
  transition: all 0.2s ease !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 12px !important;
  text-align: left !important;
  align-items: flex-start !important;
  justify-content: flex-start !important;
}

.trip-list .trip-list-item:hover {
  box-shadow: 0 4px 8px rgba(0,0,0,0.15) !important;
  border-color: #4285f4 !important;
}

.trip-list .trip-list-item.active {
  border-color: #4285f4 !important;
  background: #f8f9ff !important;
}

/* Trip header (title at top) */
.trip-header {
  margin-bottom: 8px;
  text-align: left !important;
}

.trip-header h5 {
  margin: 0;
  font-size: 18px;
  font-weight: 500;
  color: #1a1a1a;
  line-height: 1.3;
  text-align: left !important;
}

/* Trip info (meta and stats in middle) */
.trip-info {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
  text-align: left !important;
}

/* Trip meta information */
.trip-meta {
  color: #666;
  margin-bottom: 8px;
  text-align: left !important;
}

.trip-meta small {
  font-size: 13px;
  line-height: 1.4;
  text-align: left !important;
}

/* Trip statistics */
.trip-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 8px;
  justify-content: flex-start;
  text-align: left !important;
}

.stat-item {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #555;
  font-size: 14px;
  text-align: left !important;
}

.stat-item .material-icons {
  font-size: 18px !important;
  color: #4285f4;
}

/* User balance summary (at bottom) */
.user-balance-summary {
  margin-top: 8px;
  padding: 12px;
  background: #f8f9fa;
  border-radius: 6px;
  border-left: 4px solid #4285f4;
  font-size: 13px;
  text-align: left !important;
}

/* Trip actions (positioned absolutely) */
.trip-list .trip-list-item {
  position: relative !important;
}

.trip-actions {
  position: absolute;
  top: 12px;
  right: 12px;
  display: flex;
  align-items: center;
  gap: 4px;
  background: rgba(255,255,255,0.9);
  border-radius: 4px;
  padding: 2px;
}

/* Ensure all content sections are left-aligned and leave space for actions */
.trip-header,
.trip-info,
.trip-meta,
.trip-stats,
.user-balance-summary {
  text-align: left !important;
  margin-right: 80px !important; /* Leave space for action buttons */
}

.trip-header h5 {
  text-align: left !important;
  margin: 0;
}

.trip-meta {
  width: 100% !important;
  margin: 0 !important;
  padding: 0 !important;
  text-align: left !important;
}

.trip-meta small {
  text-align: left !important;
  display: block !important;
  margin: 0 !important;
  padding: 0 !important;
  width: 100% !important;
  text-indent: 0 !important;
}

.trip-meta-line {
  text-align: left !important;
  margin: 0 !important;
  padding: 0 !important;
  font-size: 13px !important;
  color: #666 !important;
  line-height: 1.4 !important;
  width: 100% !important;
}

.trip-stats {
  justify-content: flex-start !important;
  text-align: left !important;
}

.stat-item {
  text-align: left !important;
}

/* Dark mode support */
.dark-mode .trip-list .trip-list-item {
  background: #2a2a2a !important;
  border-color: #404040 !important;
  color: #e0e0e0 !important;
}

.dark-mode .trip-list .trip-list-item.active {
  background: #1a1a2e !important;
  border-color: #bb86fc !important;
}

.dark-mode .trip-header h5 {
  color: #e0e0e0;
}

.dark-mode .trip-meta {
  color: #b0b0b0;
}

.dark-mode .stat-item {
  color: #c0c0c0;
}

.dark-mode .trip-actions {
  background: rgba(42,42,42,0.9);
}

/* Mobile responsiveness */
@media (max-width: 768px) {
  .trip-list {
    gap: 12px;
  }
  
  .trip-list .trip-list-item {
    padding: 12px !important;
    gap: 10px !important;
  }
  
  .trip-header h5 {
    font-size: 16px;
  }
  
  .trip-stats {
    gap: 10px;
  }
  
  .stat-item {
    font-size: 13px;
  }
  
  .stat-item .material-icons {
    font-size: 16px !important;
  }
  
  .trip-actions {
    top: 8px;
    right: 8px;
  }
}