/* ==========================================================================
   Main Styles - Swiss Rent vs Buy Calculator
   ========================================================================== */

/* -------------------------------------------------------------------------
   Reset & Base
   ------------------------------------------------------------------------- */

*, *::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-body);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  color: var(--color-text-primary);
  background-color: var(--color-bg-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Focus styles */
:focus-visible {
  outline: 2px solid var(--color-accent-rent);
  outline-offset: 2px;
}

/* Selection */
::selection {
  background-color: var(--color-accent-rent);
  color: var(--color-text-primary);
}

/* -------------------------------------------------------------------------
   Header
   ------------------------------------------------------------------------- */

.header {
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-6);
  background-color: rgba(10, 14, 20, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--color-border);
  height: var(--header-height);
}

.header__brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.header__logo {
  display: flex;
  align-items: center;
  justify-content: center;
}

.swiss-cross {
  filter: drop-shadow(0 2px 4px rgba(255, 0, 0, 0.3));
}

.header__text {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.header__title {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: var(--weight-semibold);
  color: var(--color-text-primary);
  letter-spacing: var(--tracking-tight);
  line-height: var(--leading-none);
}

.header__subtitle {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  line-height: var(--leading-none);
}

.header__actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

/* -------------------------------------------------------------------------
   Main Layout
   ------------------------------------------------------------------------- */

.main {
  flex: 1;
  padding: var(--space-6);
}

.layout {
  display: grid;
  grid-template-columns: var(--panel-width) 1fr;
  gap: var(--space-6);
  max-width: var(--container-max);
  margin: 0 auto;
}

/* -------------------------------------------------------------------------
   Panels
   ------------------------------------------------------------------------- */

.panel {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.panel--inputs {
  position: sticky;
  top: calc(var(--header-height) + var(--space-6));
  max-height: calc(100vh - var(--header-height) - var(--space-12));
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--color-border) transparent;
}

.panel--inputs::-webkit-scrollbar {
  width: 6px;
}

.panel--inputs::-webkit-scrollbar-track {
  background: transparent;
}

.panel--inputs::-webkit-scrollbar-thumb {
  background-color: var(--color-border);
  border-radius: var(--radius-full);
}

.panel__header {
  padding-bottom: var(--space-2);
}

.panel__title {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: var(--weight-semibold);
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wider);
}

.panel--results {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-5);
  align-content: start;
}

/* -------------------------------------------------------------------------
   Input Sections
   ------------------------------------------------------------------------- */

.input-section {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.section-toggle {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  width: 100%;
  padding: var(--space-4);
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--color-text-primary);
  text-align: left;
  transition: background-color var(--duration-fast) var(--ease-out);
}

.section-toggle:hover {
  background-color: var(--color-bg-card-hover);
}

.section-toggle__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-muted);
}

.section-toggle__text {
  flex: 1;
  font-family: var(--font-display);
  font-size: var(--text-base);
  font-weight: var(--weight-medium);
}

.section-toggle__chevron {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-muted);
  transition: transform var(--duration-normal) var(--ease-out);
}

.section-toggle[aria-expanded="true"] .section-toggle__chevron {
  transform: rotate(180deg);
}

.section-content {
  padding: 0 var(--space-4) var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  animation: slideDown var(--duration-normal) var(--ease-out);
}

.section-content--collapsed {
  display: none;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.input-section--advanced .section-toggle__icon {
  color: var(--color-accent-warning);
}

/* -------------------------------------------------------------------------
   Input Groups
   ------------------------------------------------------------------------- */

.input-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.input-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3);
}

.input-label {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--color-text-secondary);
}

.input-hint {
  font-size: var(--text-xs);
  font-weight: var(--weight-normal);
  color: var(--color-text-muted);
}

.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.input-prefix {
  position: absolute;
  left: var(--space-3);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  pointer-events: none;
}

.input-suffix {
  position: absolute;
  right: var(--space-3);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  pointer-events: none;
}

.input {
  width: 100%;
  padding: var(--space-3);
  font-family: var(--font-body);
  font-size: var(--text-base);
  color: var(--color-text-primary);
  background-color: var(--color-bg-input);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  transition: all var(--duration-fast) var(--ease-out);
}

.input:hover {
  border-color: var(--color-border-light);
}

.input:focus {
  outline: none;
  background-color: var(--color-bg-input-focus);
  border-color: var(--color-accent-rent);
  box-shadow: 0 0 0 3px var(--color-accent-rent-glow);
}

.input--currency {
  padding-left: 3.5rem;
  font-family: var(--font-mono);
  font-weight: var(--weight-medium);
  text-align: right;
}

.input--percent {
  padding-right: 2.5rem;
  font-family: var(--font-mono);
  font-weight: var(--weight-medium);
  text-align: right;
}

.input--select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--space-3) center;
  padding-right: var(--space-10);
  cursor: pointer;
}

/* Slider input */
.slider-wrapper {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.input--slider {
  flex: 1;
  height: 6px;
  padding: 0;
  background: var(--color-bg-input);
  border: none;
  border-radius: var(--radius-full);
  appearance: none;
  cursor: pointer;
}

.input--slider::-webkit-slider-thumb {
  appearance: none;
  width: 18px;
  height: 18px;
  background: var(--color-accent-rent);
  border: 2px solid var(--color-bg-primary);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: transform var(--duration-fast) var(--ease-spring);
}

.input--slider::-webkit-slider-thumb:hover {
  transform: scale(1.15);
}

.input--slider::-moz-range-thumb {
  width: 18px;
  height: 18px;
  background: var(--color-accent-rent);
  border: 2px solid var(--color-bg-primary);
  border-radius: var(--radius-full);
  cursor: pointer;
}

.slider-value {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--color-accent-rent);
  min-width: 5rem;
  text-align: right;
}

/* -------------------------------------------------------------------------
   Buttons
   ------------------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--color-text-primary);
  background: transparent;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out);
}

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

.btn--ghost {
  border-color: transparent;
}

.btn--ghost:hover {
  background-color: var(--color-bg-tertiary);
  border-color: transparent;
}

.btn--link {
  padding: var(--space-1) 0;
  border: none;
  color: var(--color-accent-rent);
  font-size: var(--text-xs);
}

.btn--link:hover {
  background: transparent;
  color: var(--color-accent-rent-light);
  text-decoration: underline;
}

.btn--small {
  font-size: var(--text-xs);
}

/* -------------------------------------------------------------------------
   Footer
   ------------------------------------------------------------------------- */

.footer {
  margin-top: auto;
  padding: var(--space-8) var(--space-6);
  background-color: var(--color-bg-secondary);
  border-top: 1px solid var(--color-border);
}

.footer__content {
  max-width: var(--container-max);
  margin: 0 auto;
  text-align: center;
}

.footer__disclaimer {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  line-height: var(--leading-relaxed);
  max-width: 800px;
  margin: 0 auto var(--space-4);
}

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

.footer__copyright {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

/* -------------------------------------------------------------------------
   Toast Notifications
   ------------------------------------------------------------------------- */

.toast {
  position: fixed;
  bottom: var(--space-6);
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  padding: var(--space-3) var(--space-5);
  background-color: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  font-size: var(--text-sm);
  color: var(--color-text-primary);
  z-index: var(--z-toast);
  opacity: 0;
  transition: all var(--duration-slow) var(--ease-spring);
  pointer-events: none;
}

.toast--visible {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
  pointer-events: auto;
}

.toast--success {
  border-color: var(--color-accent-buy);
  background-color: var(--color-accent-buy-glow);
}

.toast--error {
  border-color: var(--color-accent-danger);
}

/* -------------------------------------------------------------------------
   Utility Classes
   ------------------------------------------------------------------------- */

.visually-hidden {
  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(--color-text-muted);
}

.text-buy {
  color: var(--color-accent-buy);
}

.text-rent {
  color: var(--color-accent-rent);
}

