/**
 * Axom Home - UI Components & Reusable Elements
 */

/* ==========================================
   BUTTONS
   ========================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.95rem;
  transition: all var(--transition-normal);
  text-decoration: none;
  cursor: pointer;
  border: 1px solid transparent;
  white-space: nowrap;
}

.btn-primary {
  background-color: var(--primary);
  color: var(--text-inverse);
  box-shadow: var(--shadow-sm);
}
.btn-primary:hover {
  background-color: var(--primary-hover);
  color: var(--text-inverse);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-secondary {
  background-color: var(--primary-subtle);
  color: var(--primary);
  border-color: var(--border-brand);
}
.btn-secondary:hover {
  background-color: #D3EDE0;
  color: var(--primary-hover);
}

.btn-accent {
  background-color: var(--accent-gold);
  color: white;
}
.btn-accent:hover {
  background-color: var(--accent-gold-hover);
  transform: translateY(-1px);
}

.btn-outline {
  background-color: transparent;
  color: var(--text-main);
  border-color: var(--border-light);
}
.btn-outline:hover {
  background-color: var(--bg-muted);
  border-color: var(--border-brand);
  color: var(--primary);
}

.btn-danger {
  background-color: var(--accent-red);
  color: white;
}
.btn-danger:hover {
  background-color: #B91C1C;
}

.btn-sm {
  padding: 6px 14px;
  font-size: 0.85rem;
  border-radius: var(--radius-sm);
}

.btn-lg {
  padding: 14px 28px;
  font-size: 1.05rem;
  border-radius: var(--radius-lg);
}

.btn-full {
  width: 100%;
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none !important;
}

/* Icon Buttons */
.btn-icon {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* ==========================================
   BADGES & PILLS
   ========================================== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.badge-buy {
  background-color: #DCFCE7;
  color: #166534;
}

.badge-rent {
  background-color: #DBEAFE;
  color: #1E40AF;
}

.badge-sell {
  background-color: #FEF3C7;
  color: #92400E;
}

.badge-type {
  background-color: rgba(15, 23, 42, 0.75);
  color: #FFFFFF;
  backdrop-filter: blur(4px);
}

.badge-status {
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 600;
}

.badge-status-pending { background: #FEF3C7; color: #B45309; }
.badge-status-approved { background: #DCFCE7; color: #15803D; }
.badge-status-rejected { background: #FEE2E2; color: #B91C1C; }
.badge-status-sold { background: #E2E8F0; color: #475569; }
.badge-status-rented { background: #E0E7FF; color: #4338CA; }

/* ==========================================
   PROPERTY CARD COMPONENT
   ========================================== */
.property-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-light);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-normal);
  display: flex;
  flex-direction: column;
  position: relative;
}

.property-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-card-hover);
  border-color: var(--border-brand);
}

.card-media {
  position: relative;
  width: 100%;
  padding-top: 62%; /* ~16:10 aspect ratio */
  background: var(--bg-muted);
  overflow: hidden;
}

.card-media img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.property-card:hover .card-media img {
  transform: scale(1.04);
}

.card-badges {
  position: absolute;
  top: 12px;
  left: 12px;
  display: flex;
  gap: 6px;
  z-index: 2;
}

.card-favorite-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  z-index: 2;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-fast);
}

.card-favorite-btn:hover {
  transform: scale(1.1);
  color: var(--accent-red);
  background: #FFFFFF;
}

.card-favorite-btn.favorited {
  color: var(--accent-red);
  background: #FFFFFF;
}

.card-favorite-btn.favorited svg {
  fill: var(--accent-red);
}

.card-body {
  padding: var(--space-md);
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: var(--space-xs);
}

.card-price-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}

.card-price {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: -0.02em;
}

.card-price-unit {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
}

.card-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.7rem;
}

.card-title a {
  color: inherit;
}
.card-title a:hover {
  color: var(--primary);
}

.card-location {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.card-location svg {
  color: var(--accent-gold);
  flex-shrink: 0;
}

.card-specs {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding-top: var(--space-xs);
  margin-top: auto;
  border-top: 1px dashed var(--border-light);
  font-size: 0.85rem;
  color: var(--text-main);
  font-weight: 600;
}

.card-spec-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.card-spec-item svg {
  color: var(--primary-light);
}

.card-footer {
  padding: 8px var(--space-md) 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-subtle);
  background: var(--bg-app);
  border-top: 1px solid var(--border-subtle);
}

/* ==========================================
   FORM CONTROLS & INPUTS
   ========================================== */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: var(--space-md);
}

.form-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-main);
}

.form-label .required {
  color: var(--accent-red);
}

.form-control {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  background: var(--bg-card);
  font-size: 0.95rem;
  color: var(--text-main);
  transition: all var(--transition-fast);
  outline: none;
}

.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-focus);
}

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

.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2364748B'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px;
  padding-right: 36px;
}

textarea.form-control {
  min-height: 100px;
  resize: vertical;
}

.form-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.form-error {
  font-size: 0.8rem;
  color: var(--accent-red);
  font-weight: 500;
}

/* ==========================================
   MODAL DIALOGS
   ========================================== */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: var(--z-modal-backdrop);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-md);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-normal);
}

.modal-backdrop.show {
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-xl);
  overflow: hidden;
  transform: translateY(20px) scale(0.96);
  transition: transform var(--transition-normal);
}

.modal-backdrop.show .modal-card {
  transform: translateY(0) scale(1);
}

.modal-header {
  padding: var(--space-lg);
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h3 {
  font-size: 1.25rem;
}

.modal-close {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: all var(--transition-fast);
}

.modal-close:hover {
  background: var(--bg-muted);
  color: var(--text-main);
}

.modal-body {
  padding: var(--space-lg);
  overflow-y: auto;
}

.modal-footer {
  padding: var(--space-md) var(--space-lg);
  background: var(--bg-app);
  border-top: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-sm);
}

/* ==========================================
   TABS COMPONENT
   ========================================== */
.tabs-nav {
  display: flex;
  gap: var(--space-xs);
  border-bottom: 2px solid var(--border-light);
  margin-bottom: var(--space-lg);
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs-nav::-webkit-scrollbar { display: none; }

.tab-btn {
  padding: 10px 18px;
  font-weight: 600;
  font-size: 0.925rem;
  color: var(--text-muted);
  position: relative;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  white-space: nowrap;
  transition: all var(--transition-fast);
}

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

.tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

/* ==========================================
   TOAST ALERTS
   ========================================== */
#toast-container {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
  max-width: 380px;
  width: calc(100% - 48px);
}

.toast {
  pointer-events: auto;
  padding: 12px 18px;
  border-radius: var(--radius-md);
  background: #FFFFFF;
  color: var(--text-main);
  box-shadow: var(--shadow-lg);
  border-left: 4px solid var(--primary);
  display: flex;
  align-items: flex-start;
  gap: 12px;
  animation: slideInRight 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  font-size: 0.9rem;
}

.toast-success { border-left-color: #10B981; }
.toast-error { border-left-color: var(--accent-red); }
.toast-info { border-left-color: var(--accent-blue); }

@keyframes slideInRight {
  from { opacity: 0; transform: translateX(30px); }
  to { opacity: 1; transform: translateX(0); }
}

/* ==========================================
   LOADING SKELETONS & SPINNERS
   ========================================== */
.skeleton {
  background: linear-gradient(90deg, #E2E8F0 25%, #F1F5F9 37%, #E2E8F0 63%);
  background-size: 400% 100%;
  animation: skeletonLoading 1.4s ease infinite;
  border-radius: var(--radius-sm);
}

@keyframes skeletonLoading {
  0% { background-position: 100% 50%; }
  100% { background-position: 0 50%; }
}

.spinner {
  width: 24px;
  height: 24px;
  border: 3px solid rgba(12, 90, 55, 0.2);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* Empty State Card */
.empty-state {
  text-align: center;
  padding: var(--space-3xl) var(--space-lg);
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  border: 1px dashed var(--border-light);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-md);
  margin: var(--space-lg) 0;
}

.empty-state-icon {
  width: 72px;
  height: 72px;
  border-radius: var(--radius-full);
  background: var(--primary-subtle);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
}

.empty-state h3 {
  font-size: 1.3rem;
  color: var(--text-main);
}

.empty-state p {
  max-width: 400px;
  font-size: 0.925rem;
}
