/* ========================================
   Base Styles - Reset & Typography
   ======================================== */

/* === Reset === */

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

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  font-weight: var(--font-regular);
  line-height: var(--leading-normal);
  color: var(--text-primary);
  background: var(--bg-base);
  min-height: 100vh;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
}





/* Smooth theme transitions - wildcard for buttery theme switching */
*,
*::before,
*::after {
  transition:
    background-color 0.35s ease,
    color 0.35s ease,
    border-color 0.35s ease,
    box-shadow 0.35s ease,
    fill 0.35s ease,
    stroke 0.35s ease !important;
}

/* Override for interactive elements - keep snappy hover/transform feel */
.btn,
.preset-btn,
.icon-btn,
.filter-btn,
.trade-card,
.result-card {
  transition:
    transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1),
    box-shadow 0.25s ease,
    background-color 0.35s ease,
    color 0.35s ease,
    border-color 0.35s ease !important;
}

/* Table row hover stays fast */
.journal-table tbody tr,
.scenarios-table tr {
  transition: background-color 0.15s ease !important;
}

/* Toggle switch components */
.toggle-switch__slider {
  transition: background-color 0.35s ease !important;
}

/* Settings panel & overlay - custom slide animation */
.settings-panel,
.settings-overlay {
  transition:
    transform 0.35s cubic-bezier(0.32, 0.72, 0, 1),
    opacity 0.3s ease-out,
    visibility 0.35s ease,
    background-color 0.35s ease !important;
}

.toggle-switch__slider::after {
  transition:
    transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1),
    background-color 0.35s ease !important;
}

/* Chevron rotation stays smooth */
.card__chevron,
.scenarios-toggle__icon {
  transition: transform 0.25s ease !important;
}

/* Collapsible content - keep expand/collapse animation */
.card__body--collapsible,
.scenarios-content {
  transition:
    max-height 0.3s ease-out,
    opacity 0.2s ease-out,
    padding 0.3s ease-out,
    background-color 0.35s ease,
    border-color 0.35s ease !important;
}

/* Settings card has custom fade animation */
.card--settings .card__body--collapsible {
  transition: opacity 0.25s ease-out, border-color 0.25s ease-out, box-shadow 0.25s ease-out !important;
}

/* === Typography === */

h1, h2, h3, h4, h5, h6 {
  font-weight: var(--font-semibold);
  line-height: var(--leading-tight);
  color: var(--text-primary);
}

h1 { font-size: var(--text-2xl); }
h2 { font-size: var(--text-xl); }
h3 { font-size: var(--text-lg); }

p {
  color: var(--text-secondary);
}

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

a:hover {
  color: var(--primary-hover);
}

/* Monospace text */
.mono,
code,
kbd {
  font-family: var(--font-mono);
}

/* === Focus States === */

:focus {
  outline: none;
}

:focus-visible {
  outline: none;
}

/* Only show focus ring on keyboard navigation for accessibility */
button:focus-visible,
a:focus-visible {
  box-shadow: 0 0 0 2px var(--bg-base), 0 0 0 4px var(--primary);
}

/* === Selection === */

::selection {
  background: var(--primary);
  color: var(--text-inverse);
}

/* === Scrollbar === */

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-surface);
}

::-webkit-scrollbar-thumb {
  background: var(--border-default);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--border-strong);
}

/* Firefox */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--border-default) var(--bg-surface);
}

/* === Utility Classes === */

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.text-mono {
  font-family: var(--font-mono);
}

.text-muted {
  color: var(--text-muted);
}

.text-secondary {
  color: var(--text-secondary);
}

.text-success {
  color: var(--success);
}

.text-warning {
  color: var(--warning);
}

.text-danger {
  color: var(--danger);
}
.auth-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-6);
  background:
    radial-gradient(circle at top left, var(--primary-muted), transparent 30%),
    linear-gradient(180deg, var(--bg-base) 0%, var(--bg-surface) 100%);
  color: var(--text-primary);
}

.auth-shell {
  width: 100%;
  max-width: 460px;
}

.auth-card {
  width: 100%;
  padding: var(--space-8);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.02), rgba(255, 255, 255, 0)),
    var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--border-radius-xl);
  box-shadow: var(--shadow-lg);
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  margin-bottom: var(--space-8);
}

.auth-brand__mark {
  width: 52px;
  height: 52px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--border-radius-lg);
  background:
    linear-gradient(135deg, var(--primary), var(--primary-hover));
  color: var(--text-primary);
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: var(--font-bold);
  box-shadow: 0 0 0 1px var(--primary-muted), var(--shadow-glow);
}

.auth-brand__text h1 {
  margin: 0 0 var(--space-1);
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: var(--font-bold);
  line-height: var(--leading-tight);
  color: var(--text-primary);
}

.auth-brand__text p {
  margin: 0;
  color: var(--text-secondary);
  font-size: var(--text-base);
}

.auth-form {
  display: flex;
  flex-direction: column;
}

.auth-form-group {
  margin-bottom: var(--space-5);
}

.auth-form-group label {
  display: block;
  margin-bottom: var(--space-2);
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  color: var(--text-primary);
}

.auth-form-group input {
  width: 100%;
  min-height: 48px;
  padding: 0 var(--space-4);
  border-radius: var(--border-radius);
  border: 1px solid var(--border-default);
  background: var(--bg-elevated);
  color: var(--text-primary);
  font-size: var(--text-base);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.02);
}

.auth-form-group input::placeholder {
  color: var(--text-muted);
}

.auth-form-group input:hover {
  border-color: var(--border-strong);
  background: var(--bg-hover);
}

.auth-form-group input:focus {
  border-color: var(--primary);
  box-shadow:
    0 0 0 3px var(--primary-muted),
    inset 0 1px 0 rgba(255, 255, 255, 0.02);
  background: var(--bg-elevated);
}

.password-field {
  position: relative;
}

.password-field input {
  padding-right: 76px;
}

.password-toggle {
  position: absolute;
  top: 50%;
  right: var(--space-2);
  transform: translateY(-50%);
  min-width: 52px;
  height: 34px;
  padding: 0 var(--space-3);
  border: 1px solid transparent;
  border-radius: var(--border-radius-sm);
  background: transparent;
  color: var(--text-secondary);
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  cursor: pointer;
}

.password-toggle:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.auth-btn {
  width: 100%;
  min-height: 50px;
  margin-top: var(--space-1);
  border: 1px solid transparent;
  border-radius: var(--border-radius);
  background: linear-gradient(135deg, var(--primary), var(--primary-hover));
  color: var(--text-primary);
  font-size: var(--text-base);
  font-weight: var(--font-semibold);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  box-shadow: var(--shadow-md);
}

.auth-btn:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md), var(--shadow-glow);
}

.auth-btn:active {
  transform: translateY(0);
}

.auth-btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.auth-btn__spinner {
  width: 16px;
  height: 16px;
  display: none;
  border: 2px solid rgba(255, 255, 255, 0.28);
  border-top-color: #ffffff;
  border-radius: 999px;
  animation: auth-spin 0.8s linear infinite;
}

.auth-btn.is-loading .auth-btn__spinner {
  display: inline-block;
}

.auth-error {
  min-height: 22px;
  margin-top: var(--space-3);
  color: var(--danger);
  font-size: var(--text-sm);
  line-height: var(--leading-normal);
}

.auth-footer {
  margin-top: var(--space-6);
  display: flex;
  justify-content: center;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
  color: var(--text-muted);
  font-size: var(--text-xs);
}

.auth-footer__dot {
  width: 4px;
  height: 4px;
  border-radius: 999px;
  background: var(--border-strong);
}

@keyframes auth-spin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 520px) {
  .auth-screen {
    padding: var(--space-4);
  }

  .auth-card {
    padding: var(--space-6);
    border-radius: var(--border-radius-lg);
  }

  .auth-brand {
    align-items: flex-start;
  }

  .auth-brand__text h1 {
    font-size: var(--text-xl);
  }

  .auth-brand__text p {
    font-size: var(--text-sm);
  }
}



#app-root {
  min-height: 100dvh;
  display: flex !important;
  flex-direction: column;
}

main {
  flex: 1; /* This is the key — makes main grow to fill remaining space */
}

.journal-modal {
  width: min(920px, calc(100vw - 32px));
  max-height: 88vh;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 18px;
  background: var(--color-surface, #16181d);
  color: var(--color-text, #f5f7fa);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.28);
  overflow: hidden;
}

.journal-modal::backdrop {
  background: rgba(7, 10, 18, 0.6);
  backdrop-filter: blur(4px);
}

.journal-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: var(--color-surface, #16181d);
}

.journal-modal__title {
  margin: 0;
  font-size: 20px;
  line-height: 1.2;
  font-weight: 700;
  color: var(--color-text, #f5f7fa);
}

.journal-modal__close {
  width: 40px;
  height: 40px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  background: transparent;
  color: inherit;
  font-size: 18px;
  cursor: pointer;
}

.journal-modal__close:hover {
  background: rgba(255, 255, 255, 0.06);
}

.journal-modal__body {
  padding: 20px;
  max-height: calc(88vh - 76px);
  overflow-y: auto;
}

/* Content cards inside modal */
.journal-row-details {
  display: grid;
  gap: 14px;
}

.journal-row-details__section {
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.02);
}

.journal-row-details__label {
  display: block;
  margin-bottom: 10px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-text-muted, #9ca3af);
}

.journal-row-details__trade-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.journal-row-details__trade-item {
  padding: 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
}

.journal-row-details__trade-label {
  display: block;
  margin-bottom: 6px;
  font-size: 12px;
  color: var(--color-text-muted, #9ca3af);
}

.journal-row-details__trade-value,
.journal-row-details__value {
  font-size: 14px;
  line-height: 1.5;
  color: var(--color-text, #f5f7fa);
}

.journal-row-details__trade-view,
.journal-row-details__notes-view {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.journal-row-details__trade-edit,
.journal-row-details__notes-edit {
  display: grid;
  gap: 12px;
}

.journal-row-details__trade-actions,
.journal-row-details__notes-actions,
.journal-row-details__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.journal-row-details__trade-input,
.journal-row-details__notes-input {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  color: inherit;
}

.journal-row-details__trade-input:focus,
.journal-row-details__notes-input:focus {
  outline: none;
  border-color: var(--color-primary, #14b8a6);
  box-shadow: 0 0 0 3px rgba(20, 184, 166, 0.12);
}

.trade-log-entry {
  padding: 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  line-height: 1.5;
}

@media (max-width: 768px) {
  .journal-modal {
    width: min(100vw - 20px, 920px);
    max-height: 90vh;
    border-radius: 16px;
  }

  .journal-modal__header,
  .journal-modal__body {
    padding: 16px;
  }

  .journal-row-details__trade-grid {
    grid-template-columns: 1fr;
  }

  .journal-row-details__trade-view,
  .journal-row-details__notes-view {
    flex-direction: column;
    align-items: stretch;
  }
}

@media (max-width: 640px) {
  .journal-modal {
    width: 100vw;
    max-width: 100vw;
    height: 100dvh;
    max-height: 100dvh;
    margin: 0;
    border: none;
    border-radius: 0;
  }

  .journal-modal__body {
    max-height: calc(100dvh - 72px);
    padding: 14px;
  }

  .journal-modal__header {
    padding: 14px;
  }

  .journal-modal__title {
    font-size: 18px;
  }

  .journal-row-details__section {
    padding: 14px;
    border-radius: 14px;
  }

  .journal-row-details__actions .btn,
  .journal-row-details__trade-actions .btn,
  .journal-row-details__notes-actions .btn {
    width: 100%;
  }
}

.journal-modal {
  width: min(920px, calc(100vw - 32px));
  max-height: 88vh;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 18px;
  background: var(--color-surface, #16181d);
  color: var(--color-text, #f5f7fa);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.28);
  overflow: hidden;

  /* important for centering */
  margin: auto;
}

.journal-modal::backdrop {
  background: rgba(7, 10, 18, 0.6);
  backdrop-filter: blur(4px);
}