/* ==========================================================================
   TruckerPro Tools Shared Components
   Requires: tools-design-system.css (loaded first)
   ========================================================================== */


/* ==========================================================================
   Hero Background
   ========================================================================== */

.hero-bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--tp-gradient-hero);
  pointer-events: none;
  z-index: 0;
}


/* ==========================================================================
   Page Header
   ========================================================================== */

.tp-page-header {
  text-align: center;
  padding: calc(var(--tp-space-8) + 60px) var(--tp-space-5) var(--tp-space-6);
  position: relative;
  z-index: 1;
}

.tp-page-title {
  font-family: var(--tp-font-heading);
  font-size: 2.5rem;
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: var(--tp-space-3);
  color: var(--tp-text-primary);
}

.tp-page-title span {
  background: var(--tp-gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.tp-page-subtitle {
  font-size: 1.125rem;
  color: var(--tp-text-secondary);
  max-width: 600px;
  margin: 0 auto;
  line-height: 1.6;
}


/* ==========================================================================
   Calculator Section
   ========================================================================== */

.tp-calculator-section {
  position: relative;
  z-index: 1;
  padding: 0 var(--tp-space-5) var(--tp-space-7);
}


/* ==========================================================================
   Cards
   ========================================================================== */

.tp-card {
  background: var(--tp-bg-card);
  border: 1px solid var(--tp-border-default);
  border-radius: var(--tp-radius-lg);
  box-shadow: var(--tp-shadow-card);
  padding: var(--tp-space-6);
}

.tp-results-card {
  background: linear-gradient(
    135deg,
    var(--tp-bg-card),
    var(--tp-bg-elevated)
  );
  border: 1px solid var(--tp-border-default);
  border-radius: var(--tp-radius-lg);
  box-shadow: var(--tp-shadow-card);
  padding: var(--tp-space-6);
  display: none;
}

.tp-results-card.show {
  display: block;
}


/* ==========================================================================
   Form Controls
   ========================================================================== */

.tp-form-label {
  display: block;
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--tp-text-primary);
  margin-bottom: var(--tp-space-2);
}

.tp-form-control {
  width: 100%;
  background: var(--tp-bg-input);
  border: 1px solid var(--tp-border-default);
  border-radius: var(--tp-radius-md);
  padding: var(--tp-space-3) var(--tp-space-4);
  font-family: var(--tp-font-body);
  font-size: 1rem;
  color: var(--tp-text-primary);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.tp-form-control::placeholder {
  color: var(--tp-text-muted);
}

.tp-form-control:focus,
.tp-form-control:focus-visible {
  outline: none;
  border-color: var(--tp-border-focus);
  box-shadow: var(--tp-shadow-focus);
  background: var(--tp-bg-input);
}

/* Bootstrap overrides for .form-control inside tools pages */
.tp-form-control.form-control {
  background: var(--tp-bg-input);
  border: 1px solid var(--tp-border-default);
  color: var(--tp-text-primary);
}

.tp-form-control.form-control:focus {
  background: var(--tp-bg-input);
  border-color: var(--tp-border-focus);
  box-shadow: var(--tp-shadow-focus);
}

.tp-form-select {
  width: 100%;
  background: var(--tp-bg-input);
  border: 1px solid var(--tp-border-default);
  border-radius: var(--tp-radius-md);
  padding: var(--tp-space-3) var(--tp-space-4);
  font-family: var(--tp-font-body);
  font-size: 1rem;
  color: var(--tp-text-primary);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='rgba(255,255,255,0.5)' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--tp-space-4) center;
  padding-right: var(--tp-space-7);
}

.tp-form-select:focus,
.tp-form-select:focus-visible {
  outline: none;
  border-color: var(--tp-border-focus);
  box-shadow: var(--tp-shadow-focus);
}

/* Bootstrap overrides for .form-select inside tools pages */
.tp-form-select.form-select {
  background-color: var(--tp-bg-input);
  border: 1px solid var(--tp-border-default);
  color: var(--tp-text-primary);
}

.tp-form-select.form-select:focus {
  background-color: var(--tp-bg-input);
  border-color: var(--tp-border-focus);
  box-shadow: var(--tp-shadow-focus);
}

.tp-form-hint {
  display: block;
  font-size: 0.75rem;
  color: var(--tp-text-muted);
  margin-top: var(--tp-space-1);
}


/* ==========================================================================
   Buttons
   ========================================================================== */

.tp-btn-calculate {
  display: block;
  width: 100%;
  padding: var(--tp-space-4) var(--tp-space-6);
  background: var(--tp-gradient-primary);
  color: var(--tp-text-primary);
  font-family: var(--tp-font-heading);
  font-size: 1rem;
  font-weight: 600;
  border: none;
  border-radius: var(--tp-radius-md);
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.tp-btn-calculate:hover {
  transform: translateY(-2px);
  box-shadow: var(--tp-shadow-hover);
}

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

.tp-btn-calculate:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.tp-btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--tp-space-2);
  padding: var(--tp-space-3) var(--tp-space-5);
  background: transparent;
  color: var(--tp-text-secondary);
  font-family: var(--tp-font-heading);
  font-size: 0.875rem;
  font-weight: 600;
  border: 1px solid var(--tp-border-default);
  border-radius: var(--tp-radius-md);
  cursor: pointer;
  transition: border-color 0.2s ease, color 0.2s ease;
}

.tp-btn-secondary:hover {
  border-color: var(--tp-primary);
  color: var(--tp-text-primary);
}

.tp-btn-ai {
  display: inline-flex;
  align-items: center;
  gap: var(--tp-space-2);
  padding: var(--tp-space-2) var(--tp-space-4);
  background: var(--tp-gradient-ai);
  color: var(--tp-text-primary);
  font-family: var(--tp-font-heading);
  font-size: 0.8125rem;
  font-weight: 600;
  border: none;
  border-radius: var(--tp-radius-pill);
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.tp-btn-ai:hover {
  transform: translateY(-1px);
  box-shadow: 0 0 16px rgba(139, 92, 246, 0.3);
}


/* ==========================================================================
   Result Rows
   ========================================================================== */

.tp-result-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--tp-space-3) 0;
  border-bottom: 1px solid var(--tp-border-subtle);
}

.tp-result-row:last-child {
  border-bottom: none;
}

.tp-result-label {
  font-size: 0.9375rem;
  color: var(--tp-text-secondary);
}

.tp-result-value {
  font-family: var(--tp-font-heading);
  font-weight: 700;
  font-size: 1rem;
  color: var(--tp-text-primary);
}

.tp-result-value.tp-total {
  font-size: 1.375rem;
  color: var(--tp-primary);
}

.tp-result-value.tp-positive {
  color: var(--tp-success);
}

.tp-result-value.tp-negative {
  color: var(--tp-danger);
}


/* ==========================================================================
   Verdict Boxes
   ========================================================================== */

.tp-verdict {
  padding: var(--tp-space-4) var(--tp-space-5);
  border-radius: var(--tp-radius-md);
  font-weight: 600;
  text-align: center;
}

.tp-verdict-good {
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.25);
  color: var(--tp-success);
}

.tp-verdict-warning {
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.25);
  color: var(--tp-warning);
}

.tp-verdict-danger {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.25);
  color: var(--tp-danger);
}


/* ==========================================================================
   Progress Bar
   ========================================================================== */

.tp-progress {
  width: 100%;
  height: 6px;
  background: var(--tp-bg-elevated);
  border-radius: var(--tp-radius-pill);
  overflow: hidden;
}

.tp-progress-bar {
  height: 100%;
  background: var(--tp-gradient-primary);
  border-radius: var(--tp-radius-pill);
  transition: width 0.4s ease;
}


/* ==========================================================================
   Info Section & Cards
   ========================================================================== */

.tp-info-section {
  position: relative;
  z-index: 1;
  padding: var(--tp-space-6) var(--tp-space-5) var(--tp-space-8);
}

.tp-info-card {
  background: var(--tp-bg-card);
  border: 1px solid var(--tp-border-subtle);
  border-radius: var(--tp-radius-lg);
  padding: var(--tp-space-5);
  height: 100%;
}

.tp-info-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: var(--tp-radius-md);
  background: rgba(193, 74, 23, 0.12);
  color: var(--tp-primary);
  font-size: 1.25rem;
  margin-bottom: var(--tp-space-4);
}


/* ==========================================================================
   Breakdown Panel
   ========================================================================== */

.tp-breakdown {
  background: var(--tp-bg-elevated);
  border-radius: var(--tp-radius-md);
  padding: var(--tp-space-5);
  margin-top: var(--tp-space-4);
}

.tp-breakdown-title {
  display: flex;
  align-items: center;
  gap: var(--tp-space-2);
  font-family: var(--tp-font-heading);
  font-weight: 700;
  font-size: 1rem;
  color: var(--tp-text-primary);
  margin-bottom: var(--tp-space-4);
}

.tp-breakdown-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--tp-space-2) 0;
  font-size: 0.875rem;
  color: var(--tp-text-secondary);
}


/* ==========================================================================
   Chips
   ========================================================================== */

.tp-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--tp-space-1);
  padding: var(--tp-space-1) var(--tp-space-3);
  background: var(--tp-bg-elevated);
  border: 1px solid var(--tp-border-default);
  border-radius: var(--tp-radius-pill);
  font-size: 0.8125rem;
  color: var(--tp-text-secondary);
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.tp-chip:hover,
.tp-chip.active {
  background: rgba(193, 74, 23, 0.12);
  border-color: var(--tp-primary);
  color: var(--tp-text-primary);
}


/* ==========================================================================
   Toggle Group
   ========================================================================== */

.tp-toggle-group {
  display: inline-flex;
  border: 1px solid var(--tp-border-default);
  border-radius: var(--tp-radius-md);
  overflow: hidden;
}

.tp-toggle-btn {
  padding: var(--tp-space-2) var(--tp-space-4);
  background: transparent;
  color: var(--tp-text-secondary);
  font-family: var(--tp-font-body);
  font-size: 0.875rem;
  font-weight: 500;
  border: none;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}

.tp-toggle-btn:not(:last-child) {
  border-right: 1px solid var(--tp-border-default);
}

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

.tp-toggle-btn.active {
  background: var(--tp-gradient-primary);
  color: var(--tp-text-primary);
}


/* ==========================================================================
   Spinner
   ========================================================================== */

.tp-spinner {
  display: none;
  width: 18px;
  height: 18px;
  border: 2px solid var(--tp-border-default);
  border-top-color: var(--tp-primary);
  border-radius: 50%;
  animation: tp-spin 0.6s linear infinite;
}

.tp-spinner.show {
  display: inline-block;
}

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


/* ==========================================================================
   CTA Banner
   ========================================================================== */

.tp-cta-banner {
  text-align: center;
  background: var(--tp-bg-card);
  border: 1px solid var(--tp-border-default);
  border-radius: var(--tp-radius-lg);
  padding: var(--tp-space-7) var(--tp-space-6);
  max-width: 640px;
  margin: 0 auto var(--tp-space-8);
}


/* ==========================================================================
   Authenticated Tool Wrapper
   ========================================================================== */

.tp-auth-tool-wrapper {
  position: relative;
  z-index: 1;
  padding: 0 var(--tp-space-5) var(--tp-space-7);
}

.tp-auth-tool-header {
  text-align: center;
  padding: calc(var(--tp-space-8) + 60px) var(--tp-space-5) var(--tp-space-6);
}

.tp-auth-tool-title {
  font-family: var(--tp-font-heading);
  font-size: 2rem;
  font-weight: 700;
  color: var(--tp-text-primary);
  margin-bottom: var(--tp-space-2);
}

.tp-auth-tool-subtitle {
  font-size: 1rem;
  color: var(--tp-text-secondary);
  max-width: 480px;
  margin: 0 auto;
}


/* ==========================================================================
   Responsive: Tablet (max-width: 991px)
   ========================================================================== */

@media (max-width: 991px) {
  .tp-page-title {
    font-size: 2rem;
  }

  .tp-card,
  .tp-results-card {
    padding: var(--tp-space-5);
  }

  .tp-auth-tool-title {
    font-size: 1.75rem;
  }
}


/* ==========================================================================
   Responsive: Mobile (max-width: 767px)
   ========================================================================== */

@media (max-width: 767px) {
  .tp-page-header {
    padding-top: calc(var(--tp-space-7) + 60px);
    padding-bottom: var(--tp-space-5);
  }

  .tp-page-title {
    font-size: 1.75rem;
  }

  .tp-page-subtitle {
    font-size: 1rem;
  }

  .tp-card,
  .tp-results-card {
    padding: var(--tp-space-4);
  }

  .tp-result-row {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--tp-space-1);
  }

  .tp-result-value.tp-total {
    font-size: 1.125rem;
  }

  .tp-breakdown-item {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--tp-space-1);
  }

  .tp-cta-banner {
    padding: var(--tp-space-5) var(--tp-space-4);
  }

  .tp-auth-tool-header {
    padding-top: calc(var(--tp-space-7) + 60px);
  }

  .tp-auth-tool-title {
    font-size: 1.5rem;
  }
}


/* ==========================================================================
   Responsive: Small Mobile (max-width: 480px)
   ========================================================================== */

@media (max-width: 480px) {
  .tp-page-title {
    font-size: 1.5rem;
  }

  .tp-page-subtitle {
    font-size: 0.9375rem;
  }

  .tp-btn-calculate {
    padding: var(--tp-space-3) var(--tp-space-5);
    font-size: 0.9375rem;
  }

  .tp-btn-secondary {
    width: 100%;
    justify-content: center;
  }

  .tp-card,
  .tp-results-card {
    padding: var(--tp-space-3);
    border-radius: var(--tp-radius-md);
  }

  .tp-toggle-btn {
    padding: var(--tp-space-2) var(--tp-space-3);
    font-size: 0.8125rem;
  }

  .tp-info-card {
    padding: var(--tp-space-4);
  }
}
