:root {
  --md-sys-color-primary: #6750a4;
  --md-sys-color-on-primary: #ffffff;
  --md-sys-color-primary-container: #eaddff;
  --md-sys-color-on-primary-container: #21005d;
  --md-sys-color-surface: #fffbfe;
  --md-sys-color-on-surface: #1c1b1f;
  --md-sys-color-surface-variant: #e7e0ec;
  --md-sys-color-on-surface-variant: #49454f;
  --md-sys-color-outline: #79747e;
  --md-sys-color-error: #b3261e;
  --font-family-base: "Roboto", sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-family-base);
  background-color: var(--md-sys-color-surface);
  color: var(--md-sys-color-on-surface);
  display: flex;
  justify-content: center;
  min-height: 100vh;
}

/* Mobile-first Container to mimic App View */
/* Responsive Container */
.app-container {
  width: 100%;
  max-width: 100%; /* Base for mobile */
  background-color: #fff;
  min-height: 100vh;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.05);
  display: flex;
  flex-direction: column;
  position: relative;
  margin: 0 auto;
}

@media (min-width: 768px) {
  .app-container {
    max-width: 1200px;
    min-height: 90vh;
    margin: 5vh auto;
    border-radius: 24px;
    overflow: hidden;
  }
}

/* Typography */
h1 {
  font-size: 24px;
  font-weight: 500;
  margin-bottom: 8px;
}

h2 {
  font-size: 20px;
  font-weight: 500;
}

.text-headline-large {
  font-size: 32px;
  line-height: 40px;
  font-weight: 400;
}

.text-title-medium {
  font-size: 16px;
  font-weight: 500;
  line-height: 24px;
}

.text-body-medium {
  font-size: 14px;
  font-weight: 400;
  line-height: 20px;
  color: var(--md-sys-color-on-surface-variant);
}

/* Utils */
.hidden {
  display: none !important;
}

.center-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
}

.padding-16 {
  padding: 16px;
}

.gap-16 {
  gap: 16px;
}

/* Components: Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 40px;
  padding: 0 24px;
  border-radius: 20px;
  border: none;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.2s;
  width: 100%;
  margin-bottom: 12px;
}

.btn-primary {
  background-color: var(--md-sys-color-primary);
  color: var(--md-sys-color-on-primary);
}

.btn-primary:active {
  opacity: 0.8;
}

.btn-tonal {
  background-color: var(--md-sys-color-primary-container);
  color: var(--md-sys-color-on-primary-container);
}

.btn-outlined {
  background-color: transparent;
  border: 1px solid var(--md-sys-color-outline);
  color: var(--md-sys-color-primary);
}

/* Components: Cards */
.card {
  background-color: var(--md-sys-color-surface);
  border-radius: 12px;
  padding: 16px;
  box-shadow:
    0 1px 3px rgba(0, 0, 0, 0.12),
    0 1px 2px rgba(0, 0, 0, 0.24);
  margin-bottom: 16px;
  transition:
    transform 0.1s,
    box-shadow 0.1s;
  cursor: pointer;
}

.card:active {
  transform: scale(0.98);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
}

.card-content {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  padding: 24px;
  gap: 24px;
}

.card-icon {
  font-size: 48px;
  margin-bottom: 0;
}

.card-content .text-title-medium {
  font-size: 24px;
  font-weight: 500;
}

/* Grid for Menu */
.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 24px;
  padding: 24px;
}

.grid-1 {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
  padding: 24px;
}

@media (max-width: 600px) {
  .grid-2 {
    grid-template-columns: 1fr;
    gap: 16px;
    padding: 16px;
  }
}

/* Form Elements */
.input-group {
  margin-bottom: 16px;
  width: 100%;
}

.input-field {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--md-sys-color-outline);
  border-radius: 4px;
  font-size: 16px;
  font-family: inherit;
  background: inherit;
}

.input-field:focus {
  outline: 2px solid var(--md-sys-color-primary);
  border-color: transparent;
}

/* App Bar */
.top-app-bar {
  height: 64px;
  display: flex;
  align-items: center;
  padding: 0 16px;
  background-color: var(--md-sys-color-surface);
  color: var(--md-sys-color-on-surface);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.05);
}

.app-bar-title {
  font-size: 22px;
  margin-left: 12px;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background-color: #323232;
  color: white;
  padding: 12px 24px;
  border-radius: 24px;
  font-size: 14px;
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
  z-index: 1000;
}

.toast.show {
  opacity: 1;
}

/* Loading Spinner */
.spinner {
  border: 4px solid rgba(0, 0, 0, 0.1);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border-left-color: var(--md-sys-color-primary);
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }

  100% {
    transform: rotate(360deg);
  }
}

.loading-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 500;
}

/* Modal */
.modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 600;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}

.modal-overlay.show {
  opacity: 1;
  pointer-events: auto;
}

.modal-content {
  background: white;
  width: 90%;
  max-width: 320px;
  border-radius: 28px;
  padding: 24px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
  transform: scale(0.9);
  transition: transform 0.3s;
}

.modal-overlay.show .modal-content {
  transform: scale(1);
}

.modal-title {
  font-size: 24px;
  margin-bottom: 16px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 24px;
  gap: 8px;
}

/* Mobile Responsiveness Improvements */
@media (max-width: 480px) {
  .card-content {
    gap: 16px;
    padding: 20px;
  }

  .card-icon {
    font-size: 32px;
  }

  .card-content .text-title-medium {
    font-size: 18px;
  }
  
  .text-headline-large {
    font-size: 28px;
  }
}
