/**
 * VertexCPM Component-Based CSS Architecture
 * Following Carbon Design System patterns
 */

/* ==========================================================================
   Design Tokens (CSS Custom Properties)
   ========================================================================== */

:root {
  /* Colors */
  --vertex-primary-blue: #0066cc;
  --vertex-primary-dark: #0052a3;
  --vertex-accent-blue: #3399ff;
  --vertex-success-green: #10b981;
  --vertex-warning-orange: #f59e0b;
  --vertex-error-red: #ef4444;
  
  /* Grays */
  --vertex-white: #ffffff;
  --vertex-gray-50: #f9fafb;
  --vertex-gray-100: #f3f4f6;
  --vertex-gray-200: #e5e7eb;
  --vertex-gray-300: #d1d5db;
  --vertex-gray-400: #9ca3af;
  --vertex-gray-500: #6b7280;
  --vertex-gray-600: #4b5563;
  --vertex-gray-700: #374151;
  --vertex-gray-800: #1f2937;
  --vertex-gray-900: #111827;
  
  /* Spacing Scale */
  --vertex-space-1: 0.25rem;  /* 4px */
  --vertex-space-2: 0.5rem;   /* 8px */
  --vertex-space-3: 0.75rem;  /* 12px */
  --vertex-space-4: 1rem;     /* 16px */
  --vertex-space-5: 1.25rem;  /* 20px */
  --vertex-space-6: 1.5rem;   /* 24px */
  --vertex-space-8: 2rem;     /* 32px */
  --vertex-space-10: 2.5rem;  /* 40px */
  --vertex-space-12: 3rem;    /* 48px */
  --vertex-space-16: 4rem;    /* 64px */
  
  /* Border Radius */
  --vertex-radius-sm: 0.25rem;
  --vertex-radius-md: 0.5rem;
  --vertex-radius-lg: 0.75rem;
  --vertex-radius-xl: 1rem;
  
  /* Shadows */
  --vertex-shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --vertex-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --vertex-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --vertex-shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  
  /* Typography */
  --vertex-font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --vertex-font-mono: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, monospace;
  
  /* Transitions */
  --vertex-transition-fast: 0.15s ease-out;
  --vertex-transition-base: 0.2s ease-out;
  --vertex-transition-slow: 0.3s ease-out;
}

/* ==========================================================================
   Base Components
   ========================================================================== */

/* Button Components */
.vertex-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--vertex-space-2);
  padding: var(--vertex-space-3) var(--vertex-space-6);
  font-family: var(--vertex-font-family);
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.25;
  border: none;
  border-radius: var(--vertex-radius-md);
  cursor: pointer;
  text-decoration: none;
  transition: all var(--vertex-transition-base);
  min-height: 44px; /* Touch target */
}

.vertex-btn:focus {
  outline: 2px solid var(--vertex-primary-blue);
  outline-offset: 2px;
}

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

/* Button Variants */
.vertex-btn--primary {
  background: linear-gradient(135deg, var(--vertex-primary-blue), var(--vertex-accent-blue));
  color: var(--vertex-white);
  box-shadow: 0 2px 8px rgba(0, 102, 204, 0.2);
}

.vertex-btn--primary:hover:not(:disabled) {
  background: linear-gradient(135deg, var(--vertex-primary-dark), var(--vertex-primary-blue));
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 102, 204, 0.3);
}

.vertex-btn--secondary {
  background: transparent;
  color: var(--vertex-gray-600);
  border: 2px solid var(--vertex-gray-300);
}

.vertex-btn--secondary:hover:not(:disabled) {
  background: var(--vertex-gray-50);
  border-color: var(--vertex-gray-400);
  color: var(--vertex-gray-700);
}

.vertex-btn--success {
  background: var(--vertex-success-green);
  color: var(--vertex-white);
}

.vertex-btn--success:hover:not(:disabled) {
  background: #0f9b75;
  transform: translateY(-1px);
}

/* Button Sizes */
.vertex-btn--sm {
  padding: var(--vertex-space-2) var(--vertex-space-4);
  font-size: 0.75rem;
  min-height: 36px;
}

.vertex-btn--lg {
  padding: var(--vertex-space-4) var(--vertex-space-8);
  font-size: 1rem;
  min-height: 52px;
}

/* Property Card Component */
.vertex-property-card {
  background: var(--vertex-white);
  border: 2px solid var(--vertex-gray-200);
  border-radius: var(--vertex-radius-xl);
  overflow: hidden;
  box-shadow: var(--vertex-shadow-lg);
  transition: all var(--vertex-transition-slow);
}

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

.vertex-property-card__image {
  width: 100%;
  height: 250px;
  background: linear-gradient(135deg, var(--vertex-gray-100) 0%, var(--vertex-gray-200) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 4rem;
  color: var(--vertex-gray-400);
  position: relative;
}

.vertex-property-card__image::after {
  content: 'Photo Gallery';
  position: absolute;
  bottom: var(--vertex-space-3);
  right: var(--vertex-space-3);
  background: rgba(0, 0, 0, 0.7);
  color: var(--vertex-white);
  padding: var(--vertex-space-1) var(--vertex-space-2);
  border-radius: var(--vertex-radius-sm);
  font-size: 0.75rem;
  font-weight: 500;
  transition: opacity var(--vertex-transition-base);
}

@media (max-width: 480px) {
  .vertex-property-card__image::after {
    font-size: 0.625rem;
    padding: var(--vertex-space-1) var(--vertex-space-1);
    bottom: var(--vertex-space-2);
    right: var(--vertex-space-2);
  }
}

.vertex-property-card__content {
  padding: var(--vertex-space-6);
}

.vertex-property-card__title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--vertex-gray-900);
  margin-bottom: var(--vertex-space-2);
}

.vertex-property-card__address {
  font-size: 0.875rem;
  color: var(--vertex-gray-600);
  margin-bottom: var(--vertex-space-4);
  display: flex;
  align-items: center;
  gap: var(--vertex-space-1);
}

/* Badge Component */
.vertex-badge {
  display: inline-block;
  padding: var(--vertex-space-1) var(--vertex-space-2);
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: var(--vertex-radius-sm);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.vertex-badge--available {
  background: var(--vertex-success-green);
  color: var(--vertex-white);
}

.vertex-badge--limited {
  background: var(--vertex-warning-orange);
  color: var(--vertex-white);
}

.vertex-badge--coming-soon {
  background: var(--vertex-gray-500);
  color: var(--vertex-white);
}

/* Detail Grid Component */
.vertex-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--vertex-space-4);
  margin-bottom: var(--vertex-space-6);
}

.vertex-detail-item {
  text-align: center;
  padding: var(--vertex-space-3);
  background: var(--vertex-gray-50);
  border-radius: var(--vertex-radius-md);
}

.vertex-detail-item__value {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--vertex-primary-blue);
  margin-bottom: var(--vertex-space-1);
}

.vertex-detail-item__label {
  font-size: 0.75rem;
  color: var(--vertex-gray-600);
  text-transform: uppercase;
  font-weight: 500;
  letter-spacing: 0.5px;
}

/* Features List Component */
.vertex-features {
  margin-bottom: var(--vertex-space-6);
}

.vertex-features__title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--vertex-gray-900);
  margin-bottom: var(--vertex-space-3);
}

.vertex-features__list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--vertex-space-2);
  list-style: none;
  padding: 0;
  margin: 0;
}

.vertex-features__item {
  font-size: 0.875rem;
  color: var(--vertex-gray-700);
  display: flex;
  align-items: center;
  gap: var(--vertex-space-2);
}

.vertex-features__item::before {
  content: '✓';
  color: var(--vertex-success-green);
  font-weight: 600;
}

/* Form Components */
.vertex-form {
  display: flex;
  flex-direction: column;
  gap: var(--vertex-space-4);
}

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

.vertex-form__label {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--vertex-gray-700);
}

.vertex-form__input,
.vertex-form__select,
.vertex-form__textarea {
  padding: var(--vertex-space-3);
  border: 2px solid var(--vertex-gray-300);
  border-radius: var(--vertex-radius-md);
  font-family: var(--vertex-font-family);
  font-size: 0.875rem;
  transition: all var(--vertex-transition-base);
  min-height: 44px; /* Touch target */
}

.vertex-form__input:focus,
.vertex-form__select:focus,
.vertex-form__textarea:focus {
  outline: none;
  border-color: var(--vertex-primary-blue);
  box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.1);
  transform: translateY(-1px);
}

.vertex-form__textarea {
  min-height: 120px;
  resize: vertical;
}

/* Section Component */
.vertex-section {
  background: var(--vertex-gray-50);
  border: 1px solid var(--vertex-gray-200);
  border-radius: var(--vertex-radius-xl);
  padding: var(--vertex-space-8);
  margin-bottom: var(--vertex-space-8);
}

.vertex-section__title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--vertex-gray-900);
  margin-bottom: var(--vertex-space-6);
  text-align: center;
}

/* ==========================================================================
   Layout Components
   ========================================================================== */

.vertex-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--vertex-space-6);
}

.vertex-grid {
  display: grid;
  gap: var(--vertex-space-8);
}

.vertex-grid--2-col {
  grid-template-columns: repeat(2, 1fr);
}

.vertex-grid--3-col {
  grid-template-columns: repeat(3, 1fr);
}

.vertex-grid--auto-fit {
  grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
}

/* ==========================================================================
   Responsive Design
   ========================================================================== */

/* Mobile-first responsive breakpoints */
@media (max-width: 768px) {
  /* Grid System Adjustments */
  .vertex-detail-grid {
    grid-template-columns: 1fr;
    gap: var(--vertex-space-3);
  }
  
  .vertex-features__list {
    grid-template-columns: 1fr;
  }
  
  .vertex-grid--2-col,
  .vertex-grid--3-col {
    grid-template-columns: 1fr;
    gap: var(--vertex-space-4);
  }
  
  .vertex-grid--auto-fit {
    grid-template-columns: 1fr;
    gap: var(--vertex-space-6);
  }
  
  /* Button Adjustments */
  .vertex-btn {
    width: 100%;
    justify-content: center;
  }
  
  .vertex-btn--lg {
    min-height: 48px;
    font-size: 1rem;
  }
  
  /* Container Adjustments */
  .vertex-container {
    padding: 0 var(--vertex-space-4);
  }
  
  /* Form Improvements */
  .vertex-form {
    gap: var(--vertex-space-5);
  }
  
  .vertex-form__input,
  .vertex-form__select,
  .vertex-form__textarea {
    font-size: 1rem; /* Prevents zoom on iOS */
    min-height: 48px; /* Better touch targets */
  }
  
  /* Property Card Adjustments */
  .vertex-property-card__image {
    height: 200px;
    font-size: 3rem;
  }
  
  /* Section Adjustments */
  .vertex-section {
    padding: var(--vertex-space-6);
    margin-bottom: var(--vertex-space-6);
  }
  
  .vertex-section__title {
    font-size: 1.25rem;
  }
}

@media (max-width: 480px) {
  /* Compact mobile styles */
  .vertex-property-card__content {
    padding: var(--vertex-space-4);
  }
  
  .vertex-property-card__image {
    height: 180px;
    font-size: 2.5rem;
  }
  
  .vertex-section {
    padding: var(--vertex-space-5);
    margin-bottom: var(--vertex-space-5);
  }
  
  .vertex-btn--lg {
    padding: var(--vertex-space-3) var(--vertex-space-6);
    font-size: 0.875rem;
    min-height: 44px;
  }
  
  .vertex-form__input,
  .vertex-form__select,
  .vertex-form__textarea {
    padding: var(--vertex-space-4);
  }
  
  .vertex-container {
    padding: 0 var(--vertex-space-3);
  }
  
  /* Tighter spacing for small screens */
  .vertex-grid {
    gap: var(--vertex-space-4);
  }
  
  .vertex-form {
    gap: var(--vertex-space-4);
  }
  
  .vertex-detail-grid {
    gap: var(--vertex-space-2);
  }
}

/* Large screen enhancements */
@media (min-width: 1200px) {
  .vertex-container {
    padding: 0 var(--vertex-space-8);
  }
  
  .vertex-grid--auto-fit {
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  }
  
  .vertex-property-card__image {
    height: 280px;
  }
}

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

.vertex-text-center { text-align: center; }
.vertex-text-left { text-align: left; }
.vertex-text-right { text-align: right; }

.vertex-mb-0 { margin-bottom: 0; }
.vertex-mb-2 { margin-bottom: var(--vertex-space-2); }
.vertex-mb-4 { margin-bottom: var(--vertex-space-4); }
.vertex-mb-6 { margin-bottom: var(--vertex-space-6); }
.vertex-mb-8 { margin-bottom: var(--vertex-space-8); }

.vertex-mt-0 { margin-top: 0; }
.vertex-mt-2 { margin-top: var(--vertex-space-2); }
.vertex-mt-4 { margin-top: var(--vertex-space-4); }
.vertex-mt-6 { margin-top: var(--vertex-space-6); }
.vertex-mt-8 { margin-top: var(--vertex-space-8); }

.vertex-p-0 { padding: 0; }
.vertex-p-2 { padding: var(--vertex-space-2); }
.vertex-p-4 { padding: var(--vertex-space-4); }
.vertex-p-6 { padding: var(--vertex-space-6); }
.vertex-p-8 { padding: var(--vertex-space-8); }

.vertex-flex { display: flex; }
.vertex-flex-col { flex-direction: column; }
.vertex-items-center { align-items: center; }
.vertex-justify-center { justify-content: center; }
.vertex-gap-2 { gap: var(--vertex-space-2); }
.vertex-gap-4 { gap: var(--vertex-space-4); }

.vertex-w-full { width: 100%; }
.vertex-h-full { height: 100%; }

/* Hide elements until defined (prevent FOUC) */
.vertex-component:not(:defined) {
  display: none;
}

/* Loading states for dynamic content */
.vertex-loading {
  position: relative;
  overflow: hidden;
}

.vertex-loading::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.6),
    transparent
  );
  animation: vertex-shimmer 1.5s infinite;
}

@keyframes vertex-shimmer {
  0% { left: -100%; }
  100% { left: 100%; }
}

/* Touch-friendly interactive elements */
@media (hover: none) and (pointer: coarse) {
  .vertex-btn {
    min-height: 48px;
  }
  
  .vertex-form__input,
  .vertex-form__select,
  .vertex-form__textarea {
    min-height: 48px;
    font-size: 16px; /* Prevents zoom on iOS */
  }
}

/* Screen reader only content */
.vertex-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;
}

/* Focus visible styles for better accessibility */
.vertex-btn:focus-visible,
.vertex-form__input:focus-visible,
.vertex-form__select:focus-visible,
.vertex-form__textarea:focus-visible {
  outline: 3px solid var(--vertex-primary-blue);
  outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .vertex-btn--primary {
    background: var(--vertex-primary-dark);
    border: 2px solid var(--vertex-white);
  }
  
  .vertex-btn--secondary {
    border-width: 3px;
  }
  
  .vertex-property-card {
    border-width: 3px;
  }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  .vertex-btn,
  .vertex-property-card,
  .vertex-form__input,
  .vertex-form__select,
  .vertex-form__textarea {
    transition: none;
  }
  
  .vertex-property-card:hover {
    transform: none;
  }
  
  .vertex-btn--primary:hover:not(:disabled) {
    transform: none;
  }
}