/* ============================================
   LocalPlanner.ai - REA Components
   ============================================ */

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  font-weight: var(--font-semibold);
  font-size: 16px;
  line-height: 1;
  border-radius: var(--radius-lg);
  border: none;
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-default);
  white-space: nowrap;
  text-decoration: none;
}

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

/* Primary Button - REA Red */
.btn-primary {
  background-color: var(--rea-red);
  color: var(--text-on-red);
  padding: 12px 24px;
  height: 40px;
}

.btn-primary:hover:not(:disabled) {
  background-color: var(--rea-red-hover);
  transform: scale(1.02);
}

.btn-primary:active:not(:disabled) {
  transform: scale(0.98);
}

/* Secondary Button - Bluestone Outline */
.btn-secondary {
  background-color: transparent;
  color: var(--bluestone);
  border: 1px solid var(--pebble);
  padding: 11px 23px;
  height: 40px;
}

.btn-secondary:hover:not(:disabled) {
  background-color: var(--pebble-light);
  border-color: var(--bluestone);
}

/* Tertiary Button - Ghost */
.btn-tertiary {
  background-color: transparent;
  color: var(--text-primary);
  padding: 12px;
  height: 40px;
}

.btn-tertiary:hover:not(:disabled) {
  background-color: var(--pebble-light);
}

/* Button Sizes */
.btn-lg {
  height: 48px;
  padding: 14px 28px;
  font-size: 16px;
}

.btn-sm {
  height: 32px;
  padding: 6px 16px;
  font-size: 14px;
}

/* Full Width Button */
.btn-block {
  width: 100%;
}

/* Icon Button */
.btn-icon {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: var(--radius-md);
}

.btn-icon.btn-lg {
  width: 48px;
  height: 48px;
}

.btn-icon.btn-sm {
  width: 32px;
  height: 32px;
}

/* ---- Cards ---- */
.card {
  background: var(--white);
  border: 1px solid var(--pebble);
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--duration-normal) var(--ease-default),
              transform var(--duration-normal) var(--ease-default);
}

.card-hover:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.card-image {
  aspect-ratio: 16/9;
  object-fit: cover;
  width: 100%;
}

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

.card-body-lg {
  padding: var(--space-6);
}

.card-title {
  font-size: 20px;
  font-weight: var(--font-semibold);
  line-height: 28px;
  margin-bottom: var(--space-2);
}

.card-text {
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 20px;
}

.card-footer {
  padding: var(--space-4);
  border-top: 1px solid var(--pebble);
  background: var(--pebble-light);
}

/* Feature Card */
.feature-card {
  text-align: center;
  padding: var(--space-6);
}

.feature-card .icon-wrapper {
  width: 48px;
  height: 48px;
  margin: 0 auto var(--space-4);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--pebble-light);
  border-radius: var(--radius-xl);
  color: var(--bluestone);
}

.feature-card .icon-wrapper svg {
  width: 24px;
  height: 24px;
}

/* ---- Forms ---- */
.form-group {
  margin-bottom: var(--space-4);
}

.form-label {
  display: block;
  font-size: 14px;
  font-weight: var(--font-medium);
  color: var(--text-primary);
  margin-bottom: var(--space-2);
}

.form-input {
  width: 100%;
  height: 48px;
  padding: 0 var(--space-4);
  font-size: 16px;
  color: var(--text-primary);
  background: var(--white);
  border: 1px solid var(--pebble);
  border-radius: var(--radius-lg);
  transition: border-color var(--duration-fast) var(--ease-default),
              box-shadow var(--duration-fast) var(--ease-default);
}

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

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

.form-input:focus {
  border-color: var(--bluestone);
  outline: none;
  box-shadow: 0 0 0 3px rgba(88, 114, 132, 0.2);
}

.form-input:disabled {
  background: var(--pebble-light);
  cursor: not-allowed;
}

/* Textarea */
.form-textarea {
  min-height: 120px;
  padding: var(--space-3) var(--space-4);
  resize: vertical;
}

/* Select */
.form-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' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  padding-right: 48px;
}

/* Checkbox & Radio */
.form-check {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  cursor: pointer;
}

.form-check-input {
  width: 20px;
  height: 20px;
  margin-top: 2px;
  accent-color: var(--rea-red);
  cursor: pointer;
}

.form-check-label {
  font-size: 14px;
  color: var(--text-primary);
  cursor: pointer;
}

/* Form Help Text */
.form-help {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: var(--space-1);
}

/* Form Error */
.form-error {
  font-size: 12px;
  color: var(--error);
  margin-top: var(--space-1);
}

.form-input.is-error {
  border-color: var(--error);
}

/* Search Hero */
.search-hero {
  background: var(--white);
  border-radius: var(--radius-xl);
  padding: var(--space-2);
  box-shadow: var(--shadow-lg);
  display: flex;
  gap: var(--space-2);
}

.search-hero .form-input {
  border: none;
  box-shadow: none;
  flex: 1;
}

.search-hero .form-input:focus {
  box-shadow: none;
}

.search-hero .btn {
  flex-shrink: 0;
}

@media (max-width: 639px) {
  .search-hero {
    flex-direction: column;
    padding: var(--space-3);
  }

  .search-hero .btn {
    width: 100%;
  }
}

/* ---- Header / Navigation ---- */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--pebble);
  height: var(--header-height);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 var(--space-4);
}

.logo {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: 20px;
  font-weight: var(--font-bold);
  color: var(--rea-red);
  text-decoration: none;
}

.logo-mark {
  width: 32px;
  height: 32px;
  background: var(--rea-red);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: var(--font-bold);
  font-size: 14px;
}

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

.nav-link {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  font-size: 14px;
  font-weight: var(--font-medium);
  color: var(--text-primary);
  text-decoration: none;
  border-radius: var(--radius-md);
  transition: background-color var(--duration-fast) var(--ease-default);
}

.nav-link:hover {
  background: var(--pebble-light);
}

.nav-link.active {
  color: var(--rea-red);
}

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

/* Mobile Menu */
.menu-toggle {
  display: none;
  background: none;
  border: none;
  padding: var(--space-2);
  cursor: pointer;
  color: var(--text-primary);
}

@media (max-width: 768px) {
  .nav {
    display: none;
  }

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

  .mobile-nav {
    position: fixed;
    top: var(--header-height);
    left: 0;
    right: 0;
    background: var(--white);
    padding: var(--space-4);
    display: none;
    flex-direction: column;
    gap: 0;
    z-index: 99;
    border-bottom: 1px solid var(--pebble);
    box-shadow: var(--shadow-md);
  }

  .mobile-nav.is-open {
    display: flex;
  }

  .mobile-nav .nav-link {
    padding: var(--space-4);
    font-size: 16px;
    border-bottom: 1px solid var(--pebble);
  }

  .mobile-nav .nav-link:last-child {
    border-bottom: none;
  }
}

@media (min-width: 769px) {
  .nav {
    display: flex;
  }

  .menu-toggle {
    display: none;
  }

  .mobile-nav {
    display: none !important;
  }
}

@media (min-width: 1024px) {
  .nav {
    display: flex;
  }

  .header-actions .btn {
    display: inline-flex;
  }
}

/* ---- Footer ---- */
.footer {
  background: var(--pebble-light);
  border-top: 1px solid var(--pebble);
  padding: var(--space-12) 0 var(--space-8);
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr repeat(3, 1fr);
  gap: var(--space-8);
}

.footer-brand {
  max-width: 300px;
}

.footer-brand .logo {
  margin-bottom: var(--space-4);
}

.footer-brand p {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
}

.footer-heading {
  font-size: 14px;
  font-weight: var(--font-semibold);
  color: var(--text-primary);
  margin-bottom: var(--space-4);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.footer-links {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.footer-link {
  font-size: 14px;
  color: var(--text-secondary);
  text-decoration: none;
  transition: color var(--duration-fast) var(--ease-default);
}

.footer-link:hover {
  color: var(--bluestone);
  text-decoration: underline;
}

.footer-bottom {
  margin-top: var(--space-8);
  padding-top: var(--space-6);
  border-top: 1px solid var(--pebble);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-4);
}

.footer-copyright {
  font-size: 12px;
  color: var(--text-muted);
}

.footer-legal {
  display: flex;
  gap: var(--space-4);
}

.footer-legal a {
  font-size: 12px;
  color: var(--text-muted);
  text-decoration: none;
}

.footer-legal a:hover {
  text-decoration: underline;
}

@media (max-width: 1023px) {
  .footer-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .footer-brand {
    grid-column: span 2;
  }
}

@media (max-width: 639px) {
  .footer-grid {
    grid-template-columns: 1fr;
  }

  .footer-brand {
    grid-column: span 1;
  }

  .footer-bottom {
    flex-direction: column;
    text-align: center;
  }
}

/* ---- Badges ---- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-2);
  font-size: 12px;
  font-weight: var(--font-medium);
  line-height: 1;
  border-radius: var(--radius-sm);
}

.badge-red {
  background: var(--rea-red);
  color: var(--white);
}

.badge-bluestone {
  background: var(--bluestone);
  color: var(--white);
}

.badge-success {
  background: rgba(46, 125, 50, 0.1);
  color: var(--success);
}

.badge-warning {
  background: rgba(252, 202, 54, 0.2);
  color: #946F00;
}

.badge-error {
  background: rgba(228, 0, 43, 0.1);
  color: var(--error);
}

.badge-outline {
  background: transparent;
  border: 1px solid var(--pebble);
  color: var(--text-secondary);
}

/* ---- Tabs ---- */
.tabs {
  display: flex;
  gap: var(--space-1);
  background: var(--pebble-light);
  padding: var(--space-1);
  border-radius: var(--radius-lg);
}

.tab {
  flex: 1;
  padding: var(--space-3) var(--space-4);
  font-size: 14px;
  font-weight: var(--font-medium);
  color: var(--text-secondary);
  background: transparent;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-default);
  text-align: center;
}

.tab:hover {
  color: var(--text-primary);
}

.tab.active {
  background: var(--white);
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
}

/* ---- Accordion ---- */
.accordion {
  border: 1px solid var(--pebble);
  border-radius: var(--radius-xl);
  overflow: hidden;
}

.accordion-item {
  border-bottom: 1px solid var(--pebble);
}

.accordion-item:last-child {
  border-bottom: none;
}

.accordion-header {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4);
  font-size: 16px;
  font-weight: var(--font-medium);
  color: var(--text-primary);
  background: var(--white);
  border: none;
  cursor: pointer;
  text-align: left;
  transition: background-color var(--duration-fast) var(--ease-default);
}

.accordion-header:hover {
  background: var(--pebble-light);
}

.accordion-icon {
  width: 20px;
  height: 20px;
  color: var(--text-secondary);
  transition: transform var(--duration-normal) var(--ease-default);
}

.accordion-item.is-open .accordion-icon {
  transform: rotate(180deg);
}

.accordion-content {
  display: none;
  padding: 0 var(--space-4) var(--space-4);
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.6;
}

.accordion-item.is-open .accordion-content {
  display: block;
}

/* ---- Progress Steps ---- */
.steps {
  display: flex;
  justify-content: center;
  gap: var(--space-8);
  position: relative;
}

.steps::before {
  content: '';
  position: absolute;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 150px);
  height: 2px;
  background: var(--pebble);
}

.step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
  position: relative;
  z-index: 1;
}

.step-number {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--white);
  border: 2px solid var(--pebble);
  border-radius: var(--radius-full);
  font-size: 16px;
  font-weight: var(--font-semibold);
  color: var(--text-secondary);
}

.step.active .step-number {
  background: var(--rea-red);
  border-color: var(--rea-red);
  color: var(--white);
}

.step.completed .step-number {
  background: var(--success);
  border-color: var(--success);
  color: var(--white);
}

.step-label {
  font-size: 14px;
  font-weight: var(--font-medium);
  color: var(--text-secondary);
  text-align: center;
}

.step.active .step-label {
  color: var(--text-primary);
}

@media (max-width: 639px) {
  .steps {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-4);
  }

  .steps::before {
    top: 0;
    left: 19px;
    width: 2px;
    height: calc(100% - 40px);
    transform: none;
  }

  .step {
    flex-direction: row;
    gap: var(--space-4);
  }
}

/* ---- Rating Stars ---- */
.rating {
  display: flex;
  gap: var(--space-1);
}

.rating-star {
  width: 20px;
  height: 20px;
  color: var(--pebble);
}

.rating-star.filled {
  color: var(--warning);
}

/* ---- Dropzone ---- */
.dropzone {
  border: 2px dashed var(--pebble);
  border-radius: var(--radius-xl);
  padding: var(--space-12);
  text-align: center;
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-default);
}

.dropzone:hover,
.dropzone.is-dragover {
  border-color: var(--bluestone);
  background: var(--pebble-light);
}

.dropzone-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto var(--space-4);
  color: var(--bluestone);
}

.dropzone-text {
  font-size: 16px;
  color: var(--text-primary);
  margin-bottom: var(--space-2);
}

.dropzone-hint {
  font-size: 14px;
  color: var(--text-secondary);
}

/* ---- Data Table ---- */
.table-wrapper {
  overflow-x: auto;
  border: 1px solid var(--pebble);
  border-radius: var(--radius-xl);
}

.table {
  width: 100%;
  border-collapse: collapse;
}

.table th,
.table td {
  padding: var(--space-3) var(--space-4);
  text-align: left;
  border-bottom: 1px solid var(--pebble);
}

.table th {
  font-size: 12px;
  font-weight: var(--font-semibold);
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: var(--pebble-light);
}

.table tr:last-child td {
  border-bottom: none;
}

.table tbody tr {
  transition: background-color var(--duration-fast) var(--ease-default);
}

.table tbody tr:hover {
  background: var(--pebble-light);
}

/* ---- Alert / Notice ---- */
.alert {
  padding: var(--space-4);
  border-radius: var(--radius-lg);
  display: flex;
  gap: var(--space-3);
  align-items: flex-start;
}

.alert-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.alert-content {
  flex: 1;
}

.alert-title {
  font-size: 14px;
  font-weight: var(--font-semibold);
  margin-bottom: var(--space-1);
}

.alert-text {
  font-size: 14px;
  line-height: 1.5;
}

.alert-info {
  background: rgba(88, 114, 132, 0.1);
  color: var(--bluestone-dark);
}

.alert-success {
  background: rgba(46, 125, 50, 0.1);
  color: var(--success);
}

.alert-warning {
  background: rgba(252, 202, 54, 0.15);
  color: #7A5A00;
}

.alert-error {
  background: rgba(228, 0, 43, 0.1);
  color: var(--error);
}

/* ---- Chip / Tag ---- */
.chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  font-size: 14px;
  color: var(--text-primary);
  background: var(--pebble-light);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: background-color var(--duration-fast) var(--ease-default);
}

.chip:hover {
  background: var(--pebble);
}

.chip-close {
  width: 16px;
  height: 16px;
  color: var(--text-secondary);
}

/* ---- Trust Bar ---- */
.trust-bar {
  background: var(--pebble-light);
  padding: var(--space-6) 0;
}

.trust-logos {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-8);
  flex-wrap: wrap;
}

.trust-logo {
  height: 40px;
  opacity: 0.6;
  filter: grayscale(100%);
  transition: opacity var(--duration-fast) var(--ease-default);
}

.trust-logo:hover {
  opacity: 1;
}

/* ---- Stat Card ---- */
.stat-card {
  padding: var(--space-6);
  text-align: center;
}

.stat-value {
  font-size: 36px;
  font-weight: var(--font-bold);
  color: var(--rea-red);
  line-height: 1;
  margin-bottom: var(--space-2);
}

.stat-label {
  font-size: 14px;
  color: var(--text-secondary);
}

/* ---- Priority Dot ---- */
.priority-dot {
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  display: inline-block;
}

.priority-dot.high {
  background: var(--error);
}

.priority-dot.medium {
  background: var(--warning);
}

.priority-dot.low {
  background: var(--success);
}

/* ---- Avatar ---- */
.avatar {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  background: var(--bluestone);
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: var(--font-semibold);
}

.avatar-sm {
  width: 32px;
  height: 32px;
  font-size: 12px;
}

.avatar-lg {
  width: 48px;
  height: 48px;
  font-size: 18px;
}

/* ---- Divider ---- */
.divider {
  height: 1px;
  background: var(--pebble);
  margin: var(--space-6) 0;
}

/* ---- Empty State ---- */
.empty-state {
  text-align: center;
  padding: var(--space-12);
}

.empty-state-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto var(--space-4);
  color: var(--text-muted);
}

.empty-state-title {
  font-size: 18px;
  font-weight: var(--font-semibold);
  color: var(--text-primary);
  margin-bottom: var(--space-2);
}

.empty-state-text {
  font-size: 14px;
  color: var(--text-secondary);
  max-width: 400px;
  margin: 0 auto;
}
