/* Custom Styles for Expense Tracker */
* {
  box-sizing: border-box;
}

body {
  font-family: "Kantumruy Pro", "Inter", sans-serif;
  transition: 0.3s;
  margin: 0;
  padding: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background-color: #f3f4f6;
}

.dark body {
  background: #0f172a;
}

.app-shell {
  width: 100%;
  max-width: 430px;
  margin: 0 auto;
  min-height: 100vh;
  background: #fff;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  position: relative;
  overflow-x: hidden;
}

.dark .app-shell {
  background: #1e293b;
}

.gradient-card {
  background: linear-gradient(135deg, #6366f1, #a855f7);
}

.modal-enter {
  animation: modalFadeIn 0.3s ease-out;
}

@keyframes modalFadeIn {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.hidden {
  display: none !important;
}

.status-active {
  color: #10b981;
}

.status-inactive {
  color: #ef4444;
}

/* Responsive adjustments */
@media (max-width: 430px) {
  .app-shell {
    max-width: 100%;
    min-height: 100vh;
    border-radius: 0;
    box-shadow: none;
  }

  body {
    padding: 0;
    margin: 0;
    background: transparent;
  }

  .dark body {
    background: #0f172a;
  }
}

/* For tablets and larger phones */
@media (min-width: 431px) and (max-width: 768px) {
  .app-shell {
    max-width: 430px;
    margin: 20px auto;
    border-radius: 20px;
    min-height: calc(100vh - 40px);
  }

  body {
    padding: 20px;
    background-color: #f3f4f6;
  }

  .dark body {
    background: #0f172a;
  }
}

/* For desktop */
@media (min-width: 769px) {
  .app-shell {
    max-width: 430px;
    margin: 40px auto;
    border-radius: 24px;
    min-height: calc(100vh - 80px);
    max-height: 900px;
    overflow-y: auto;
  }

  body {
    padding: 40px;
    background-color: #f3f4f6;
  }

  .dark body {
    background: #0f172a;
  }

  .app-shell::-webkit-scrollbar {
    width: 8px;
  }

  .app-shell::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
  }

  .app-shell::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 10px;
  }

  .dark .app-shell::-webkit-scrollbar-track {
    background: #334155;
  }

  .dark .app-shell::-webkit-scrollbar-thumb {
    background: #475569;
  }
}

/* Responsive modal adjustments */
.modal-content {
  width: 90%;
  max-width: 300px;
  margin: 20px;
}

@media (min-width: 640px) {
  .modal-content {
    max-width: 400px;
  }
}

/* Responsive table */
.w-90 {
  width: 90%;
  max-width: 500px;
}

@media (min-width: 640px) {
  .w-90 {
    width: 500px;
  }
}

table {
  border-collapse: separate;
  border-spacing: 0;
  width: 100%;
  table-layout: fixed;
}

th {
  position: sticky;
  top: 0;
  background-color: #f3f4f6;
  padding: 8px 4px;
  font-size: 12px;
}

.dark th {
  background-color: #334155;
}

td {
  padding: 8px 4px;
  font-size: 12px;
  word-break: break-word;
}

/* Responsive text sizes */
@media (max-width: 375px) {
  h1 {
    font-size: 1.5rem !important;
  }

  h2 {
    font-size: 1.25rem !important;
  }

  h3 {
    font-size: 1rem !important;
  }

  .text-3xl {
    font-size: 1.5rem !important;
  }

  .text-lg {
    font-size: 1rem !important;
  }

  .text-sm {
    font-size: 0.75rem !important;
  }

  .text-xs {
    font-size: 0.625rem !important;
  }

  .p-3 {
    padding: 0.5rem !important;
  }

  .p-4 {
    padding: 0.75rem !important;
  }

  .p-6 {
    padding: 1rem !important;
  }
}

/* Responsive input fields */
input,
select {
  font-size: 16px !important;
}

@media (max-width: 375px) {
  input,
  select {
    padding: 0.5rem !important;
    font-size: 14px !important;
  }
}

/* Responsive flex containers */
.flex {
  flex-wrap: wrap;
}

.gap-2 {
  gap: 0.5rem;
}

@media (max-width: 375px) {
  .gap-2 {
    gap: 0.25rem;
  }

  .px-5 {
    padding-left: 1rem !important;
    padding-right: 1rem !important;
  }

  .pt-5 {
    padding-top: 1rem !important;
  }

  .p-5 {
    padding: 1rem !important;
  }
}

/* Responsive chart container */
canvas {
  max-width: 100%;
  height: auto !important;
}

.modal {
  padding: 10px;
  align-items: flex-start;
  padding-top: 20px;
  overflow-y: auto;
}

.modal-content {
  max-height: 80vh;
  overflow-y: auto;
}

button {
  min-height: 44px;
  min-width: 44px;
}

@supports (padding: max(0px)) {
  body {
    padding-left: max(0px, env(safe-area-inset-left));
    padding-right: max(0px, env(safe-area-inset-right));
    padding-top: max(0px, env(safe-area-inset-top));
    padding-bottom: max(0px, env(safe-area-inset-bottom));
  }

  .app-shell {
    padding-left: max(0px, env(safe-area-inset-left));
    padding-right: max(0px, env(safe-area-inset-right));
  }
}

.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#transaction-list {
  max-height: 300px;
  overflow-y: auto;
}

@media (max-height: 700px) {
  #transaction-list {
    max-height: 200px;
  }
}

@media (max-width: 640px) {
  #modal-25hour-report .modal-content,
  #modal-weekly-report .modal-content {
    width: 95%;
    margin: 10px;
    padding: 1rem;
  }

  .max-h-\[80vh\] {
    max-height: 70vh;
  }

  .max-h-\[90vh\] {
    max-height: 80vh;
  }
}

@media (max-height: 500px) and (orientation: landscape) {
  .app-shell {
    max-height: 100vh;
    overflow-y: auto;
  }

  #login-screen {
    padding: 10px;
  }

  .gradient-card {
    padding: 1rem !important;
  }

  .text-3xl {
    font-size: 1.25rem !important;
  }
}
