/**
 * Orangefield Invest - Global Styles
 * Modern, responsive design system
 */

/* =====================
   CSS VARIABLES / DESIGN TOKENS
   ===================== */

:root {
  /* Brand Colors */
  --color-primary: #FF8200;
  --color-primary-dark: #E67300;
  --color-primary-light: #FFA040;
  --color-secondary: #F7B538;
  --color-secondary-dark: #E6A520;

  /* Neutral Colors */
  --color-dark: #1A1A1A;
  --color-text: #333333;
  --color-text-light: #666666;
  --color-text-lighter: #999999;
  --color-bg: #FFFFFF;
  --color-bg-light: #F5F5F5;
  --color-bg-lighter: #FAFAFA;
  --color-border: #E0E0E0;
  --color-border-light: #F0F0F0;

  /* Semantic Colors */
  --color-success: #4CAF50;
  --color-warning: #FFC107;
  --color-error: #F44336;
  --color-info: #2196F3;

  /* Typography */
  --font-heading: 'Playfair Display', serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

  /* Font Sizes (responsive) */
  --text-xs: 0.75rem;    /* 12px */
  --text-sm: 0.875rem;   /* 14px */
  --text-base: 1rem;     /* 16px */
  --text-lg: 1.125rem;   /* 18px */
  --text-xl: 1.25rem;    /* 20px */
  --text-2xl: 1.5rem;    /* 24px */
  --text-3xl: 1.875rem;  /* 30px */
  --text-4xl: 2.25rem;   /* 36px */
  --text-5xl: 3rem;      /* 48px */
  --text-6xl: 3.75rem;   /* 60px */

  /* Spacing (8px base system) */
  --space-1: 0.5rem;   /* 8px */
  --space-2: 1rem;     /* 16px */
  --space-3: 1.5rem;   /* 24px */
  --space-4: 2rem;     /* 32px */
  --space-5: 3rem;     /* 48px */
  --space-6: 4rem;     /* 64px */
  --space-8: 6rem;     /* 96px */
  --space-10: 8rem;    /* 128px */

  /* Border Radius */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  --shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.25);

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-base: 300ms ease;
  --transition-slow: 500ms ease;

  /* Breakpoints (for media queries) */
  --breakpoint-sm: 480px;
  --breakpoint-md: 768px;
  --breakpoint-lg: 1024px;
  --breakpoint-xl: 1440px;

  /* Container widths */
  --container-sm: 640px;
  --container-md: 768px;
  --container-lg: 1024px;
  --container-xl: 1280px;
  --container-2xl: 1536px;

  /* Z-index layers */
  --z-dropdown: 1000;
  --z-sticky: 1020;
  --z-fixed: 1030;
  --z-modal-backdrop: 1040;
  --z-modal: 1050;
  --z-popover: 1060;
  --z-tooltip: 1070;
}

/* =====================
   RESET & BASE STYLES
   ===================== */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  max-width: 100%;
}

body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.6;
  color: var(--color-text);
  background-color: var(--color-bg);
  overflow-x: hidden;
  max-width: 100%;
}

* {
  max-width: 100%;
}

/* =====================
   TYPOGRAPHY
   ===================== */

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 700;
  line-height: 1.2;
  color: var(--color-dark);
  margin-bottom: var(--space-2);
}

h1 { font-size: var(--text-5xl); }
h2 { font-size: var(--text-4xl); }
h3 { font-size: var(--text-3xl); }
h4 { font-size: var(--text-2xl); }
h5 { font-size: var(--text-xl); }
h6 { font-size: var(--text-lg); }

p {
  margin-bottom: var(--space-2);
  color: var(--color-text);
}

a {
  color: var(--color-primary);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--color-primary-dark);
}

strong, b {
  font-weight: 600;
}

em, i {
  font-style: italic;
}

/* =====================
   CONTAINER & LAYOUT
   ===================== */

.container,
.container-sm,
.container-md,
.container-lg,
.container-xl,
.container-2xl {
  width: 100%;
  margin: 0 auto;
  padding: 0 var(--space-3);
}

.container { max-width: var(--container-xl); }
.container-sm { max-width: var(--container-sm); }
.container-md { max-width: var(--container-md); }
.container-lg { max-width: var(--container-lg); }
.container-xl { max-width: var(--container-xl); }
.container-2xl { max-width: var(--container-2xl); }

.section {
  padding: var(--space-8) 0;
}

.section-sm { padding: var(--space-5) 0; }
.section-lg { padding: var(--space-10) 0; }

/* =====================
   BUTTONS
   ===================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-1);
  padding: 0.75rem 1.5rem;
  font-size: var(--text-base);
  font-weight: 500;
  font-family: var(--font-body);
  line-height: 1;
  text-align: center;
  text-decoration: none;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-base);
  white-space: nowrap;
  user-select: none;
}

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

/* Button variants */
.btn-primary {
  background-color: var(--color-primary);
  color: white;
  box-shadow: var(--shadow-sm);
}

.btn-primary:hover:not(:disabled) {
  background-color: var(--color-primary-dark);
  color: white !important;
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.btn-secondary {
  background-color: var(--color-secondary);
  color: var(--color-dark);
  box-shadow: var(--shadow-sm);
}

.btn-secondary:hover:not(:disabled) {
  background-color: var(--color-secondary-dark);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.btn-outline {
  background-color: transparent;
  color: var(--color-primary);
  border: 2px solid var(--color-primary);
}

.btn-outline:hover:not(:disabled) {
  background-color: var(--color-primary);
  color: white;
}

.btn-ghost {
  background-color: transparent;
  color: var(--color-text);
}

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

/* Button sizes */
.btn-sm {
  padding: 0.5rem 1rem;
  font-size: var(--text-sm);
}

.btn-lg {
  padding: 1rem 2rem;
  font-size: var(--text-lg);
}

.btn-block {
  width: 100%;
}

/* =====================
   FORMS
   ===================== */

.form-group {
  margin-bottom: var(--space-3);
}

.form-label {
  display: block;
  margin-bottom: var(--space-1);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-text);
}

.form-label.required::after {
  content: ' *';
  color: var(--color-error);
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 0.75rem;
  font-size: var(--text-base);
  font-family: var(--font-body);
  color: var(--color-text);
  background-color: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(255, 130, 0, 0.1);
}

.form-input:disabled,
.form-select:disabled,
.form-textarea:disabled {
  background-color: var(--color-bg-light);
  cursor: not-allowed;
}

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

.form-error {
  display: block;
  margin-top: var(--space-1);
  font-size: var(--text-sm);
  color: var(--color-error);
}

.form-help {
  display: block;
  margin-top: var(--space-1);
  font-size: var(--text-sm);
  color: var(--color-text-light);
}

/* =====================
   CARDS
   ===================== */

.card {
  background-color: var(--color-bg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  transition: all var(--transition-base);
}

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

.card-image {
  width: 100%;
  height: auto;
  display: block;
}

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

.card-title {
  font-size: var(--text-xl);
  font-weight: 600;
  margin-bottom: var(--space-2);
  color: var(--color-dark);
}

.card-text {
  color: var(--color-text-light);
  margin-bottom: var(--space-2);
}

.card-footer {
  padding: var(--space-3);
  border-top: 1px solid var(--color-border-light);
  background-color: var(--color-bg-lighter);
}

/* =====================
   BADGES
   ===================== */

.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.75rem;
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-radius: var(--radius-full);
}

.badge-primary { background-color: var(--color-primary); color: white; }
.badge-secondary { background-color: var(--color-secondary); color: var(--color-dark); }
.badge-success { background-color: var(--color-success); color: white; }
.badge-warning { background-color: var(--color-warning); color: var(--color-dark); }
.badge-error { background-color: var(--color-error); color: white; }
.badge-info { background-color: var(--color-info); color: white; }

/* =====================
   LOADING & SPINNERS
   ===================== */

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid var(--color-border);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.spinner-sm { width: 20px; height: 20px; border-width: 2px; }
.spinner-lg { width: 60px; height: 60px; border-width: 6px; }

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

.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(255, 255, 255, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: var(--z-modal);
}

/* =====================
   UTILITY CLASSES
   ===================== */

/* Spacing */
.m-0 { margin: 0; }
.mt-1 { margin-top: var(--space-1); }
.mt-2 { margin-top: var(--space-2); }
.mt-3 { margin-top: var(--space-3); }
.mt-4 { margin-top: var(--space-4); }
.mb-1 { margin-bottom: var(--space-1); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-3 { margin-bottom: var(--space-3); }
.mb-4 { margin-bottom: var(--space-4); }

.p-0 { padding: 0; }
.pt-1 { padding-top: var(--space-1); }
.pt-2 { padding-top: var(--space-2); }
.pt-3 { padding-top: var(--space-3); }
.pt-4 { padding-top: var(--space-4); }
.pb-1 { padding-bottom: var(--space-1); }
.pb-2 { padding-bottom: var(--space-2); }
.pb-3 { padding-bottom: var(--space-3); }
.pb-4 { padding-bottom: var(--space-4); }

/* Text alignment */
.text-left { text-align: left; }
.text-center { text-align: center; }
.text-right { text-align: right; }

/* Text colors */
.text-primary { color: var(--color-primary); }
.text-dark { color: var(--color-dark); }
.text-light { color: var(--color-text-light); }
.text-white { color: white; }

/* Display */
.d-none { display: none; }
.d-block { display: block; }
.d-flex { display: flex; }
.d-grid { display: grid; }

/* Flex utilities */
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-col { flex-direction: column; }
.gap-1 { gap: var(--space-1); }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }

/* =====================
   PROCESS SECTION
   ===================== */

.process-section {
  background-color: var(--color-bg-light);
}

.process-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-6);
  align-items: center;
  margin-bottom: var(--space-6);
}

.process-content h2 {
  margin-bottom: var(--space-4);
}

.process-content p {
  line-height: 1.8;
  color: var(--color-text);
  margin-bottom: var(--space-3);
}

.process-image {
  position: relative;
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}

.process-img {
  width: 100%;
  height: auto;
  display: block;
}

.process-steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--space-3);
  margin-top: var(--space-6);
}

.process-step {
  background: white;
  padding: var(--space-4);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  text-align: center;
  transition: all var(--transition-base);
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 220px;
}

.process-step:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}

.step-number {
  width: 56px;
  height: 56px;
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-secondary) 100%);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-2xl);
  font-weight: 700;
  margin: 0 auto var(--space-3);
  flex-shrink: 0;
}

.process-step h4 {
  font-size: var(--text-base);
  font-weight: 600;
  margin-bottom: var(--space-2);
  color: var(--color-dark);
  line-height: 1.4;
  text-align: center;
}

.process-step p {
  font-size: var(--text-sm);
  color: var(--color-text-light);
  line-height: 1.6;
  margin: 0;
  flex-grow: 1;
}

/* =====================
   PROPERTIES GRID 3x3
   ===================== */

.filters-bar {
  display: grid;
  grid-template-columns: repeat(3, 1fr) auto auto;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
  align-items: center;
}

.filter-select,
.filter-input {
  padding: 0.75rem 1rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-size: var(--text-base);
  background-color: white;
  width: 100%;
}

.filter-select:focus,
.filter-input:focus {
  outline: none;
  border-color: var(--color-primary);
}

/* Feature Pills */
.features-pills-container {
  width: 100%;
}

.features-pills {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
}

.feature-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem 0.625rem;
  background: white;
  border: 2px solid var(--color-border);
  border-radius: 50px;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--color-text);
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.feature-pill span:first-child {
  font-size: 13px;
}

.feature-pill:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.feature-pill.active {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: white;
}

.feature-pill.active:hover {
  background: var(--color-primary-dark);
  border-color: var(--color-primary-dark);
}

.feature-pill svg {
  width: 14px;
  height: 14px;
  stroke-width: 2;
}

.properties-grid-3x3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-4);
  margin-bottom: var(--space-4);
}

.pagination-container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  margin: var(--space-4) 0;
}

.pagination-info {
  font-size: var(--text-base);
  color: var(--color-text);
  font-weight: 500;
  min-width: 100px;
  text-align: center;
}

/* =====================
   RESPONSIVE
   ===================== */

/* Medium laptops and tablets (900px - 1366px) */
@media (max-width: 1366px) {
  .container,
  .container-sm,
  .container-md,
  .container-lg,
  .container-xl,
  .container-2xl {
    padding: 0 var(--space-4);
  }

  .section {
    padding: var(--space-6) 0;
  }

  /* Ensure text doesn't touch screen edges */
  .section-header,
  .about-content,
  .process-content {
    padding-left: var(--space-2);
    padding-right: var(--space-2);
  }

  /* Adjust property grid for medium screens */
  .properties-grid-3x3 {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-3);
  }
}

@media (max-width: 768px) {
  :root {
    --text-5xl: 2.25rem;
    --text-4xl: 1.875rem;
    --text-3xl: 1.5rem;
  }

  .section { padding: var(--space-5) 0; }
  .section-lg { padding: var(--space-6) 0; }

  h1 { font-size: var(--text-4xl); }
  h2 { font-size: var(--text-3xl); }

  .process-grid {
    grid-template-columns: 1fr;
    gap: var(--space-4);
  }

  .process-steps {
    grid-template-columns: 1fr;
    gap: var(--space-3);
  }

  .properties-grid-3x3 {
    grid-template-columns: 1fr;
  }

  .filters-bar {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto auto auto;
    gap: var(--space-2);
  }

  .filters-bar button {
    grid-column: 1 / -1;
    width: 100%;
  }

  .filter-select,
  .filter-input {
    width: 100%;
  }

  .feature-pill {
    padding: 0.5rem 0.875rem;
    font-size: 0.875rem;
  }

  .feature-pill span:first-child {
    font-size: 16px;
  }
}

@media (max-width: 768px) {
  /* Prevent horizontal overflow */
  body, html {
    overflow-x: hidden !important;
    width: 100%;
  }

  /* Add horizontal padding to all containers on mobile */
  .container,
  .container-sm,
  .container-md,
  .container-lg,
  .container-xl,
  .container-2xl {
    padding: 0 var(--space-3);
    max-width: 100vw;
  }

  /* Ensure sections don't overflow */
  section {
    overflow-x: hidden;
    max-width: 100vw;
  }

  /* Ensure buttons don't touch edges */
  .btn,
  .btn-primary,
  .btn-outline {
    margin-left: var(--space-3);
    margin-right: var(--space-3);
  }

  /* Buttons in groups should not have side margins */
  .hero-cta .btn,
  .filters-bar .btn,
  .cta-buttons .btn,
  .carousel-btn,
  .contact-form .btn {
    margin-left: 0;
    margin-right: 0;
  }

  /* Section padding adjustment */
  .section {
    padding: var(--space-6) var(--space-3);
  }

  /* Form elements should have spacing */
  .contact-form,
  .admin-form {
    padding: var(--space-3);
  }

  /* Property cards and grids */
  .properties-grid-3x3 {
    padding: 0 var(--space-3);
  }

  /* Filters and feature pills */
  .filters-bar,
  .features-pills-container {
    padding: 0 var(--space-3);
  }

  /* Pagination */
  .pagination-container {
    padding: 0 var(--space-3);
  }

  /* View all button container */
  .text-center {
    padding: 0 var(--space-3);
  }
}

@media (max-width: 480px) {
  :root {
    --space-8: 4rem;
    --space-10: 5rem;
  }

  /* Tighter padding on very small screens */
  .container,
  .container-sm,
  .container-md,
  .container-lg,
  .container-xl,
  .container-2xl {
    padding: 0 var(--space-2);
  }

  .section {
    padding: var(--space-5) var(--space-2);
  }

  /* Ensure all text content has breathing room */
  p, h1, h2, h3, h4, h5, h6 {
    padding-left: var(--space-2);
    padding-right: var(--space-2);
  }

  /* But remove padding from elements already in padded containers */
  .container p,
  .container h1,
  .container h2,
  .container h3,
  .container h4,
  .container h5,
  .container h6,
  .section p,
  .section h1,
  .section h2,
  .section h3,
  .section h4,
  .section h5,
  .section h6 {
    padding-left: 0;
    padding-right: 0;
  }
}

/* =====================
   FILTER CHECKBOX
   ===================== */
.filter-checkbox {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  user-select: none;
  font-size: var(--text-base);
  color: var(--color-text);
}

.filter-checkbox input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--color-primary);
}

.filter-checkbox:hover {
  color: var(--color-primary);
}
