/* ==========================================================================
   PeachBudget CSS
   ========================================================================== */

/* ==========================================================================
   1. Color Palette
   ========================================================================== */

:root {
  /* Brand Colors */
  --color-red: #F82315;
  --color-blue: #23BBF7;
  --color-green: #45B349;
  --color-yellow: #EDC515;
  --color-dark-blue: #1D48B3;

  /* Semantic Colors */
  --color-error: var(--color-red);
  --color-success: var(--color-green);
  --color-warning: var(--color-yellow);
  --color-info: var(--color-blue);
  --color-primary: var(--color-dark-blue);

  /* Neutral Colors */
  --color-text: #212529;
  --color-text-muted: #666;
  --color-text-light: #888;
  --color-text-inactive: #aaa;
  --color-border: #ccc;
  --color-border-light: #ddd;
  --color-bg-light: #f8f9fa;
  --color-bg-highlight: #fff9c4;

  /* Alert Background Colors */
  --color-alert-success-bg: #d4edda;
  --color-alert-success-border: #c3e6cb;
  --color-alert-success-text: #155724;
  --color-alert-warning-bg: #fff3cd;
  --color-alert-warning-border: #ffeeba;
  --color-alert-warning-text: #856404;
  --color-alert-danger-bg: #f8d7da;
  --color-alert-danger-border: #f5c6cb;
  --color-alert-danger-text: #721c24;
  --color-alert-info-bg: #d1ecf1;
  --color-alert-info-border: #bee5eb;
  --color-alert-info-text: #0c5460;

  /* Shadows */
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 4px 8px rgba(0, 0, 0, 0.1);
  --shadow-highlight: 2px 2px 4px rgba(0, 0, 0, 0.15);
}

/* ==========================================================================
   2. Reset & Base Styles
   ========================================================================== */

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

body {
  margin: 0 auto;
  max-width: 60em;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.5;
  padding: 4em 1em;
  font-size: 16px;
  color: var(--color-text);
}

/* ==========================================================================
   3. Typography
   ========================================================================== */

h1, h2, h3, h4, h5, h6 {
  margin-bottom: 1rem;
  font-weight: 600;
  line-height: 1.3;
}

h1 { font-size: 2rem; }
h2 { font-size: 1.75rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }
h5 { font-size: 1.1rem; }
h6 { font-size: 1rem; }

p { margin-bottom: 1rem; }

a {
  color: var(--color-primary);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

small {
  font-size: 0.875rem;
}

/* Monospace (for budget displays) */
.mono {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

/* ==========================================================================
   4. Layout
   ========================================================================== */

.container {
  width: 100%;
  max-width: 50rem;
  margin: 0 auto;
  padding: 0 1rem;
}

.row {
  display: flex;
  flex-wrap: wrap;
}

.col { flex: 1 0 0%; }
.col-4 { flex: 0 0 33.333333%; max-width: 33.333333%; }
.col-6 { flex: 0 0 50%; max-width: 50%; }
.col-8 { flex: 0 0 66.666667%; max-width: 66.666667%; }
.col-12 { flex: 0 0 100%; max-width: 100%; }

@media (max-width: 768px) {
  .col-4, .col-6, .col-8 {
    flex: 0 0 100%;
    max-width: 100%;
  }
  .row {
    flex-direction: column;
  }
}

/* Budget Page Layout */
.budget-layout {
  display: block;
}

@media (min-width: 768px) {
  .budget-layout {
    display: flex;
    gap: 3em;
  }
  .budget-main {
    flex: 1;
  }
  .budget-history {
    width: 220px;
    flex-shrink: 0;
  }
}

/* ==========================================================================
   5. Navigation
   ========================================================================== */

nav {
  margin-bottom: 2em;
  padding-bottom: 1em;
  border-bottom: 1px solid var(--color-border-light);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

nav ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

nav li {
  display: inline;
  margin-right: 1em;
}

nav a {
  text-decoration: none;
}

.nav-brand {
  font-size: 1.5rem;
  font-weight: bold;
}

.nav-link {
  color: var(--color-text);
}

.nav-link:hover {
  color: var(--color-dark-blue);
  text-decoration: none;
}

/* Mobile Navigation */
.nav-toggle {
  display: none;
  cursor: pointer;
}

@media (max-width: 768px) {
  .nav-toggle {
    display: block;
  }
  .nav-menu {
    display: none;
    flex-direction: column;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    padding: 1rem;
  }
  .nav-menu.active {
    display: flex;
  }
  .nav-item {
    margin: 0.5rem 0;
  }
}

/* ==========================================================================
   6. Forms
   ========================================================================== */

form {
  margin-bottom: 1rem;
}

.form-group {
  margin-bottom: 1rem;
}

label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
}

input,
textarea,
select,
button {
  box-sizing: border-box;
  font: inherit;
  color: inherit;
  margin: 0;
  padding: 0.5em;
  border: 1px solid var(--color-border);
  background-color: #fff;
  line-height: 1.2;
  border-radius: 4px;
}

input[type="text"],
input[type="number"],
input[type="date"],
input[type="email"],
input[type="password"],
select {
  padding: 0.5em;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  box-sizing: border-box;
}

.form-control {
  display: block;
  width: 100%;
  padding: 0.375rem 0.75rem;
  font-size: 1rem;
  line-height: 1.5;
  color: var(--color-text);
  background-color: #fff;
  border: 1px solid var(--color-border-light);
  border-radius: 0.25rem;
}

.form-select {
  display: block;
  width: 100%;
  padding: 0.375rem 0.75rem;
  font-size: 1rem;
  line-height: 1.5;
  color: var(--color-text);
  background-color: #fff;
  border: 1px solid var(--color-border-light);
  border-radius: 0.25rem;
}

.form-check {
  display: block;
  min-height: 1.5rem;
  margin-bottom: 0.5rem;
}

.form-check-input {
  margin-right: 0.5rem;
}

.form-check-label {
  display: inline-block;
}

/* ==========================================================================
   7. Buttons
   ========================================================================== */

button {
  cursor: pointer;
}

.btn {
  display: inline-block;
  font-weight: 400;
  text-align: center;
  vertical-align: middle;
  cursor: pointer;
  padding: 0.375rem 0.75rem;
  font-size: 1rem;
  line-height: 1.5;
  border-radius: 0.25rem;
  transition: all 0.15s ease-in-out;
  text-decoration: none;
}

.btn:hover {
  opacity: 0.9;
  text-decoration: none;
}

.btn-primary {
  background-color: var(--color-primary);
  border: 1px solid var(--color-primary);
  color: white;
}

.btn-primary:hover {
  background-color: #162d7a;
}

.btn-outline {
  background-color: transparent;
  border: 1px solid var(--color-border-light);
}

.btn-outline:hover {
  background-color: var(--color-bg-light);
}

.btn-sm {
  padding: 0.25rem 0.5rem;
  font-size: 0.875rem;
}

.btn-lg {
  padding: 0.5rem 1rem;
  font-size: 1.125rem;
}

/* ==========================================================================
   8. Cards
   ========================================================================== */

.card {
  margin-bottom: 1rem;
  border: 1px solid var(--color-border-light);
  border-radius: 0.25rem;
}

.card-header {
  padding: 0.75rem 1rem;
  background-color: var(--color-bg-light);
  border-bottom: 1px solid var(--color-border-light);
}

.card-body {
  padding: 1rem;
}

.card-footer {
  padding: 0.75rem 1rem;
  background-color: var(--color-bg-light);
  border-top: 1px solid var(--color-border-light);
}

.card-title {
  margin-bottom: 0.5rem;
}

.account-card {
  transition: all 0.3s ease;
}

.account-card:hover {
  box-shadow: var(--shadow-md);
}

/* ==========================================================================
   9. Alerts
   ========================================================================== */

.alert {
  padding: 0.75rem 1.25rem;
  margin-bottom: 1rem;
  border: 1px solid transparent;
  border-radius: 0.25rem;
}

.alert-success {
  color: var(--color-alert-success-text);
  background-color: var(--color-alert-success-bg);
  border-color: var(--color-alert-success-border);
}

.alert-warning {
  color: var(--color-alert-warning-text);
  background-color: var(--color-alert-warning-bg);
  border-color: var(--color-alert-warning-border);
}

.alert-danger {
  color: var(--color-alert-danger-text);
  background-color: var(--color-alert-danger-bg);
  border-color: var(--color-alert-danger-border);
}

.alert-info {
  color: var(--color-alert-info-text);
  background-color: var(--color-alert-info-bg);
  border-color: var(--color-alert-info-border);
}

/* Inline warning box */
.warning-box {
  background-color: var(--color-alert-warning-bg);
  border: 1px solid #ffeaa7;
  padding: 1em;
  margin-bottom: 1em;
}

.warning-box h3 {
  margin-top: 0;
}

/* ==========================================================================
   10. Badges
   ========================================================================== */

.badge {
  display: inline-block;
  padding: 0.25em 0.5em;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 0.25rem;
}

.bg-light {
  background-color: var(--color-bg-light);
}

.bg-secondary {
  background-color: var(--color-text-muted);
  color: white;
}

/* ==========================================================================
   11. Budget Display
   ========================================================================== */

.budget-breakdown {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  margin: 1.5em 0;
  line-height: 1.8;
}

.budget-line {
  display: flex;
  align-items: baseline;
}

.budget-sign {
  display: inline-block;
  width: 2ch;
  text-align: right;
}

.budget-amount {
  display: inline-block;
  width: 5ch;
  text-align: right;
}

.budget-highlight {
  background-color: var(--color-bg-highlight);
  padding: 0.1em 0.4em;
  box-shadow: var(--shadow-highlight);
}

.budget-detail {
  margin-left: 8ch;
  color: var(--color-text-muted);
}

.budget-detail a {
  color: var(--color-text-muted);
  text-decoration: none;
}

.budget-shortfall {
  margin-left: 8ch;
  color: var(--color-red);
  font-weight: bold;
}

.budget-divider {
  border-top: 1px solid var(--color-border);
  margin: 0.5em 0;
  width: 20em;
}

/* Priority borders */
.priority-1 {
  border-left: 4px solid var(--color-success);
}

.priority-2 {
  border-left: 4px solid var(--color-warning);
}

.priority-3 {
  border-left: 4px solid var(--color-info);
}

/* ==========================================================================
   12. History Map
   ========================================================================== */

.history-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  max-width: 200px;
  margin-bottom: 0.75em;
}

.history-dot {
  width: 24px;
  height: 24px;
  border-radius: 3px;
  cursor: pointer;
}

.history-month-label {
  margin-bottom: 0.25em;
}

/* ==========================================================================
   13. Status Indicators
   ========================================================================== */

.status-on-track {
  color: var(--color-success);
}

.status-slightly-behind {
  color: var(--color-warning);
}

.status-behind {
  color: var(--color-error);
}

/* ==========================================================================
   14. Footer
   ========================================================================== */

footer {
  margin-top: 3em;
  padding-top: 1em;
  font-size: 0.8rem;
}

/* ==========================================================================
   15. Utility Classes
   ========================================================================== */

/* Text Alignment */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-end { text-align: right; }

/* Text Colors */
.text-success { color: var(--color-success); }
.text-danger { color: var(--color-error); }
.text-warning { color: var(--color-warning); }
.text-info { color: var(--color-info); }
.text-muted { color: var(--color-text-muted); }
.text-dark { color: var(--color-text); }
.text-inactive { color: var(--color-text-inactive); }

/* Display */
.d-flex { display: flex; }
.d-block { display: block; }
.d-inline-block { display: inline-block; }

/* Flexbox */
.justify-content-between { justify-content: space-between; }
.justify-content-center { justify-content: center; }
.align-items-center { align-items: center; }
.flex-wrap { flex-wrap: wrap; }
.gap-1 { gap: 0.25rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 1rem; }

/* Margins */
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 1rem; }
.mb-4 { margin-bottom: 1.5rem; }
.mb-5 { margin-bottom: 3rem; }

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 1rem; }
.mt-4 { margin-top: 1.5rem; }
.mt-5 { margin-top: 3rem; }

.me-1 { margin-right: 0.25rem; }
.me-2 { margin-right: 0.5rem; }
.me-3 { margin-right: 1rem; }

.ms-1 { margin-left: 0.25rem; }
.ms-2 { margin-left: 0.5rem; }
.ms-3 { margin-left: 1rem; }

/* Padding */
.p-0 { padding: 0; }
.p-1 { padding: 0.25rem; }
.p-2 { padding: 0.5rem; }
.p-3 { padding: 1rem; }

.py-1 { padding-top: 0.25rem; padding-bottom: 0.25rem; }
.py-2 { padding-top: 0.5rem; padding-bottom: 0.5rem; }
.py-3 { padding-top: 1rem; padding-bottom: 1rem; }

.px-1 { padding-left: 0.25rem; padding-right: 0.25rem; }
.px-2 { padding-left: 0.5rem; padding-right: 0.5rem; }
.px-3 { padding-left: 1rem; padding-right: 1rem; }

/* Width */
.w-100 { width: 100%; }

/* Height */
.h-100 { height: 100%; }

/* ==========================================================================
   16. JS Toggle (Collapse)
   ========================================================================== */

.collapse {
  display: none;
}

.collapse.show {
  display: block;
}

/* ==========================================================================
   17. Attitude Indicator (Altimeter)
   ========================================================================== */

.attitude-indicator {
  width: 128px;
  height: 128px;
  overflow: hidden;
  position: relative;
  border: 1px solid #333;
  background: #1a1a1a;
  margin-bottom: 1rem;
}

.attitude-horizon {
  position: absolute;
  width: 200%;
  height: 200%;
  left: -50%;
  top: -50%;
  transition: transform 0.5s ease-out;
}

.attitude-sky {
  position: absolute;
  width: 100%;
  height: 50%;
  top: 0;
  background: linear-gradient(to bottom, #0066cc 0%, #87CEEB 100%);
}

/* Clouds made of currency symbols */
.attitude-sky::before {
  content: '';
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 400 100'%3E%3Cstyle%3Etext%7Bfont-family:system-ui,sans-serif;font-weight:bold%7D%3C/style%3E%3Ctext x='30' y='75' font-size='18' fill='rgba(255,255,255,0.8)'%3E%24%3C/text%3E%3Ctext x='50' y='68' font-size='22' fill='rgba(255,255,255,0.85)'%3E%24%3C/text%3E%3Ctext x='75' y='73' font-size='16' fill='rgba(255,255,255,0.75)'%3E%24%3C/text%3E%3Ctext x='160' y='42' font-size='24' fill='rgba(255,255,255,0.7)'%3E%24%3C/text%3E%3Ctext x='185' y='38' font-size='20' fill='rgba(255,255,255,0.8)'%3E%24%3C/text%3E%3Ctext x='210' y='45' font-size='18' fill='rgba(255,255,255,0.75)'%3E%24%3C/text%3E%3Ctext x='235' y='40' font-size='15' fill='rgba(255,255,255,0.65)'%3E%24%3C/text%3E%3Ctext x='295' y='58' font-size='20' fill='rgba(255,255,255,0.8)'%3E%24%3C/text%3E%3Ctext x='320' y='52' font-size='24' fill='rgba(255,255,255,0.85)'%3E%24%3C/text%3E%3Ctext x='350' y='60' font-size='16' fill='rgba(255,255,255,0.7)'%3E%24%3C/text%3E%3Ctext x='120' y='28' font-size='14' fill='rgba(255,255,255,0.5)'%3E%24%3C/text%3E%3Ctext x='140' y='22' font-size='12' fill='rgba(255,255,255,0.45)'%3E%24%3C/text%3E%3Ctext x='270' y='25' font-size='13' fill='rgba(255,255,255,0.5)'%3E%24%3C/text%3E%3Ctext x='370' y='30' font-size='11' fill='rgba(255,255,255,0.4)'%3E%24%3C/text%3E%3Ctext x='90' y='85' font-size='14' fill='rgba(255,255,255,0.6)'%3E%24%3C/text%3E%3C/svg%3E") no-repeat center center;
  background-size: 100% 100%;
}

.attitude-ground {
  position: absolute;
  width: 100%;
  height: 50%;
  bottom: 0;
  background:
    /* Sea near horizon */
    linear-gradient(to bottom,
      #1E90FF 0%,
      #1E90FF 8%,
      #4AA3DF 8%,
      #2E8B57 15%,
      #228B22 20%,
      #8B4513 40%,
      #5D3A1A 100%
    );
}

/* Mountains silhouette */
.attitude-ground::before {
  content: '';
  position: absolute;
  width: 100%;
  height: 25%;
  top: 0;
  background:
    /* Mountain range - peaks and valleys */
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 400 50' preserveAspectRatio='none'%3E%3Cpath d='M0,50 L0,35 L30,20 L50,30 L80,10 L110,25 L130,15 L160,30 L180,8 L210,28 L240,12 L270,25 L290,18 L320,30 L350,5 L380,22 L400,15 L400,50 Z' fill='%234a6741'/%3E%3Cpath d='M0,50 L0,40 L40,30 L70,38 L100,25 L140,35 L170,22 L200,38 L230,28 L260,35 L300,20 L340,32 L370,25 L400,30 L400,50 Z' fill='%23355E3B'/%3E%3C/svg%3E") no-repeat center top;
  background-size: 100% 100%;
}

.attitude-horizon-line {
  position: absolute;
  width: 100%;
  height: 2px;
  top: 50%;
  background: #fff;
  transform: translateY(-50%);
  box-shadow: 0 0 4px rgba(0,0,0,0.5);
}

/* Fixed aircraft symbol (center reference) */
.attitude-aircraft {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 10;
  pointer-events: none;
}

.attitude-aircraft-wings {
  width: 70px;
  height: 6px;
  background: #ff6600;
  border-radius: 3px;
  position: relative;
}

.attitude-aircraft-wings::before {
  content: '';
  position: absolute;
  width: 8px;
  height: 8px;
  background: #ff6600;
  border-radius: 3px;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

