/* Hide content until Alpine initializes */
[x-cloak] {
  display: none !important;
}

.flag-icon {
  width: 20px;
  height: 12px;
  vertical-align: middle;
  margin-right: 4px;
}

body {
  background: #008080;
  min-height: 100vh;
  padding: 16px;
  box-sizing: border-box;
  font-family: "Pixelated MS Sans Serif", "MS Sans Serif", Tahoma, Arial, sans-serif;
}

* {
  font-family: inherit;
}

.container {
  zoom: 1.25;
  max-width: 900px;
  margin: 0 auto;
}

.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding: 8px;
  background: silver;
  border: 2px outset #dfdfdf;
}

.header h1 {
  margin: 0;
  font-size: 18px;
}

.lang-switcher button {
  min-width: 50px;
}

.lang-switcher button.active {
  background: #000080;
  color: white;
}

.window {
  margin-bottom: 16px;
}

.window-body {
  padding: 16px;
  overflow: visible;
}

.input-grid {
  display: grid;
  gap: 12px;
}

.input-grid-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 4px;
}

.input-grid-2col select {
  width: 100%;
}

.input-grid-2col .field-row-stacked {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.input-grid-2col .field-row-stacked label {
  min-height: 2em;
  display: flex;
  align-items: flex-end;
}

.field-row-stacked {
  display: flex;
  flex-direction: column;
}

.field-row-stacked label {
  margin-bottom: 4px;
}

.field-row-stacked input,
.field-row-stacked select {
  width: 100%;
  box-sizing: border-box;
}

.field-row-stacked small {
  margin-top: 4px;
}

/* Tables */
table {
  width: 100%;
  border-collapse: collapse;
}

th, td {
  text-align: left;
  padding: 6px 8px;
}

table td {
  overflow: visible;
}

tr.best {
  background: #90EE90;
}

tr.unavailable {
  background: #ffcccc;
  text-decoration: line-through;
  opacity: 0.7;
}

/* Advice box */
.advice-box {
  padding: 12px;
  background: #ffffcc;
  border: 1px solid #ccc;
}

.warning {
  color: #8B0000;
  font-weight: bold;
}

.savings {
  color: #006400;
  font-weight: bold;
}

.tip {
  margin-top: 8px;
  font-style: italic;
  color: #444;
}

/* Help tooltips */
.help-icon {
  display: inline-block;
  width: 16px;
  height: 16px;
  background: #000080;
  color: white;
  border-radius: 50%;
  text-align: center;
  font-size: 12px;
  line-height: 16px;
  cursor: help;
  margin-left: 4px;
  position: relative;
}

.help-icon:hover .tooltip {
  display: block;
}

.tooltip {
  display: none;
  position: absolute;
  bottom: 100%;
  left: 0;
  background: #ffffcc;
  border: 1px solid #000;
  padding: 8px;
  min-width: 220px;
  font-size: 11px;
  z-index: 1000;
  margin-bottom: 4px;
  box-shadow: 2px 2px 4px rgba(0,0,0,0.3);
  white-space: normal;
  line-height: 1.4;
  color: #000;
  text-align: left;
  font-weight: normal;
}

/* Structure name with checkmark */
.structure-name {
  display: flex;
  align-items: center;
}

.checkmark {
  margin-right: 4px;
}

/* Income input */
.income-input {
  font-size: 20px !important;
  font-weight: bold;
  padding: 10px 12px !important;
  letter-spacing: 1px;
  height: auto !important;
  min-height: 44px !important;
  line-height: normal !important;
  box-sizing: border-box;
}

/* Preset expense buttons */
.preset-btn {
  text-align: left;
  line-height: 1.5;
  padding: 8px 12px;
}

.preset-btn small {
  font-weight: normal;
}

/* Expense table */
.expense-table {
  table-layout: fixed;
}

.expense-table input {
  width: 100%;
  box-sizing: border-box;
}

.expense-table td:last-child {
  width: 40px;
  text-align: center;
}

.remove-btn {
  min-width: 28px;
  padding: 2px 6px;
}

.total-row td {
  padding-top: 12px !important;
  border-top: 1px solid #808080;
}

/* Responsive */
@media (max-width: 600px) {
  body {
    padding: 8px;
  }

  .header {
    flex-direction: column;
    gap: 8px;
  }

  th, td {
    padding: 4px;
    font-size: 12px;
  }

  .input-grid-2col {
    grid-template-columns: 1fr;
  }
}
