 
/* ============================================
   GLOBAL STYLES - TERRA CORE HOME IMPROVEMENTS
   Purpose: Core styles used across all pages
   Author: Edgar Robledo - CodeDevHub
   ============================================ */

/* ============================================
   CSS VARIABLES
   ============================================ */
:root {
  /* Primary Colors - Trust & Professionalism */
  --primary-blue: #1e3a5f;
  --medium-blue: #2c5282;
  --light-blue: #4a7ba7;
  --accent-orange: #ff8c42;
  --dark-orange: #e67635;
  --accent-green: #2d6a4f;
  --light-green: #52b788;
  
  /* Neutrals */
  --charcoal: #2b2d42;
  --medium-gray: #8d99ae;
  --light-gray: #edf2f4;
  --cream-white: #fefefe;
  --pure-white: #ffffff;
  
  /* Semantic Colors */
  --success-green: #52b788;
  --error-red: #ef233c;
  --warning-yellow: #ffd60a;
  --info-blue: #4a7ba7;
  
  /* Background Colors */
  --bg-primary: #fefefe;
  --bg-secondary: #edf2f4;
  --bg-dark: #2b2d42;
  --card-bg: #ffffff;
  
  /* Text Colors */
  --text-dark: #2b2d42;
  --text-medium: #4a5568;
  --text-light: #8d99ae;
  --text-on-dark: #fefefe;
  --text-on-primary: #ffffff;
  
  /* Border Colors */
  --border-light: #e2e8f0;
  --border-medium: #cbd5e0;
  --border-dark: #4a5568;
  
  /* Typography */
  --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-page-title: 32px;
  --font-section-header: 24px;
  --font-subsection: 20px;
  --font-body: 16px;
  --font-button: 16px;
  --font-small: 14px;
  --font-tiny: 12px;
  
  /* Spacing */
  --page-padding: 20px;
  --card-padding: 20px;
  --button-padding: 14px 28px;
  --section-spacing: 60px;
  --element-spacing: 20px;
  
  /* Border Radius */
  --radius-small: 6px;
  --radius-medium: 10px;
  --radius-large: 16px;
  --radius-circle: 50%;
  
  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.15);
  --shadow-hover: 0 6px 20px rgba(0, 0, 0, 0.12);
  
  /* Transitions */
  --transition-fast: 0.2s ease;
  --transition-normal: 0.3s ease;
  --transition-slow: 0.5s ease;
  
  /* Z-index Layers */
  --z-dropdown: 1000;
  --z-sticky: 1020;
  --z-modal-backdrop: 1040;
  --z-modal: 1050;
  --z-tooltip: 1070;
}

/* Desktop Adjustments */
@media (min-width: 768px) {
  :root {
    --font-page-title: 42px;
    --font-section-header: 32px;
    --font-subsection: 24px;
    --page-padding: 40px;
    --card-padding: 30px;
    --section-spacing: 80px;
  }
}

/* ============================================
   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;
}

body {
  font-family: var(--font-family);
  font-size: var(--font-body);
  line-height: 1.7;
  color: var(--text-dark);
  background: var(--bg-primary);
  overflow-x: hidden;
}

/* ============================================
   TYPOGRAPHY
   ============================================ */
h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 16px;
  color: var(--text-dark);
}

h1 {
  font-size: var(--font-page-title);
  margin-bottom: 20px;
}

@media (min-width: 768px) {
  h1 {
    margin-bottom: 24px;
  }
}

h2 {
  font-size: var(--font-section-header);
  margin-bottom: 18px;
}

@media (min-width: 768px) {
  h2 {
    margin-bottom: 22px;
  }
}

h3 {
  font-size: var(--font-subsection);
  margin-bottom: 14px;
}

@media (min-width: 768px) {
  h3 {
    margin-bottom: 16px;
  }
}

p {
  margin-bottom: 16px;
  line-height: 1.7;
  color: var(--text-medium);
}

@media (min-width: 768px) {
  p {
    margin-bottom: 20px;
    line-height: 1.8;
  }
}

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

a:hover {
  color: var(--accent-orange);
}

strong {
  font-weight: 600;
  color: var(--text-dark);
}

ul, ol {
  margin-bottom: 16px;
  padding-left: 24px;
}

@media (min-width: 768px) {
  ul, ol {
    margin-bottom: 20px;
    padding-left: 28px;
  }
}

li {
  margin-bottom: 8px;
  line-height: 1.6;
  color: var(--text-medium);
}

@media (min-width: 768px) {
  li {
    margin-bottom: 10px;
  }
}

/* ============================================
   BUTTONS
   ============================================ */
.btn {
  display: inline-block;
  padding: var(--button-padding);
  font-size: var(--font-button);
  font-weight: 600;
  text-align: center;
  border: none;
  border-radius: var(--radius-small);
  cursor: pointer;
  transition: all var(--transition-normal);
  text-decoration: none;
  min-height: 48px;
  line-height: 1.5;
  font-family: var(--font-family);
}

@media (min-width: 768px) {
  .btn {
    min-height: 52px;
    padding: 16px 32px;
  }
}

.btn-primary {
  background: var(--accent-orange);
  color: var(--text-on-primary);
  box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
  background: var(--dark-orange);
  color: var(--text-on-primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
}

.btn-secondary {
  background: var(--primary-blue);
  color: var(--text-on-primary);
  box-shadow: var(--shadow-sm);
}

.btn-secondary:hover {
  background: var(--medium-blue);
  color: var(--text-on-primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
}

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

.btn-outline:hover {
  background: var(--primary-blue);
  color: var(--text-on-primary);
}

.btn-large {
  padding: 18px 36px;
  font-size: 18px;
  min-height: 56px;
}

@media (min-width: 768px) {
  .btn-large {
    padding: 20px 40px;
    font-size: 20px;
    min-height: 60px;
  }
}

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

.btn:disabled:hover {
  transform: none;
  box-shadow: var(--shadow-sm);
}

/* ============================================
   INPUTS & FORMS
   ============================================ */
input, textarea, select {
  width: 100%;
  padding: 14px 16px;
  font-size: var(--font-body);
  font-family: var(--font-family);
  color: var(--text-dark);
  background: var(--pure-white);
  border: 2px solid var(--border-light);
  border-radius: var(--radius-small);
  transition: border-color var(--transition-fast);
  min-height: 48px;
}

@media (min-width: 768px) {
  input, textarea, select {
    padding: 16px 18px;
    min-height: 52px;
  }
}

input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--primary-blue);
  box-shadow: 0 0 0 3px rgba(30, 58, 95, 0.1);
}

textarea {
  min-height: 120px;
  resize: vertical;
  line-height: 1.6;
}

@media (min-width: 768px) {
  textarea {
    min-height: 140px;
  }
}

label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  color: var(--text-dark);
  font-size: var(--font-small);
}

@media (min-width: 768px) {
  label {
    margin-bottom: 10px;
    font-size: var(--font-body);
  }
}

.form-group {
  margin-bottom: 20px;
}

@media (min-width: 768px) {
  .form-group {
    margin-bottom: 24px;
  }
}

.form-error {
  color: var(--error-red);
  font-size: var(--font-small);
  margin-top: 6px;
}

@media (min-width: 768px) {
  .form-error {
    margin-top: 8px;
  }
}

/* ============================================
   CARDS
   ============================================ */
.card {
  background: var(--card-bg);
  border-radius: var(--radius-medium);
  box-shadow: var(--shadow-sm);
  padding: var(--card-padding);
  transition: all var(--transition-normal);
}

@media (min-width: 768px) {
  .card {
    padding: var(--card-padding);
  }
}

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

.card-image {
  width: 100%;
  height: 200px;
  object-fit: cover;
  border-radius: var(--radius-small);
  margin-bottom: 16px;
}

@media (min-width: 768px) {
  .card-image {
    height: 240px;
    margin-bottom: 20px;
  }
}

.card-title {
  font-size: var(--font-subsection);
  margin-bottom: 12px;
  color: var(--text-dark);
}

@media (min-width: 768px) {
  .card-title {
    margin-bottom: 14px;
  }
}

.card-text {
  font-size: var(--font-body);
  color: var(--text-medium);
  line-height: 1.6;
}

@media (min-width: 768px) {
  .card-text {
    line-height: 1.7;
  }
}

/* ============================================
   UTILITY CLASSES
   ============================================ */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--page-padding);
}

@media (min-width: 768px) {
  .container {
    padding: 0 var(--page-padding);
  }
}

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

@media (min-width: 768px) {
  .section {
    padding: var(--section-spacing) 0;
  }
}

.text-center {
  text-align: center;
}

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

.text-accent {
  color: var(--accent-orange);
}

.bg-primary {
  background: var(--bg-primary);
}

.bg-secondary {
  background: var(--bg-secondary);
}

.bg-dark {
  background: var(--bg-dark);
  color: var(--text-on-dark);
}

.mb-small {
  margin-bottom: 12px;
}

@media (min-width: 768px) {
  .mb-small {
    margin-bottom: 16px;
  }
}

.mb-medium {
  margin-bottom: 20px;
}

@media (min-width: 768px) {
  .mb-medium {
    margin-bottom: 24px;
  }
}

.mb-large {
  margin-bottom: 32px;
}

@media (min-width: 768px) {
  .mb-large {
    margin-bottom: 40px;
  }
}

.hidden {
  display: none;
}

.visible {
  display: block;
}

/* ============================================
   MODALS
   ============================================ */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: var(--z-modal-backdrop);
  padding: 20px;
}

@media (min-width: 768px) {
  .modal-backdrop {
    padding: 40px;
  }
}

.modal-backdrop.active {
  display: flex;
}

.modal {
  background: var(--card-bg);
  border-radius: var(--radius-medium);
  box-shadow: var(--shadow-lg);
  max-width: 600px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  z-index: var(--z-modal);
}

@media (min-width: 768px) {
  .modal {
    max-width: 700px;
  }
}

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

@media (min-width: 768px) {
  .modal-header {
    padding: 24px 30px;
  }
}

.modal-title {
  font-size: var(--font-subsection);
  margin: 0;
  color: var(--text-dark);
}

@media (min-width: 768px) {
  .modal-title {
    font-size: var(--font-section-header);
  }
}

.modal-close-btn {
  background: none;
  border: none;
  font-size: 28px;
  color: var(--text-medium);
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color var(--transition-fast);
}

@media (min-width: 768px) {
  .modal-close-btn {
    font-size: 32px;
    width: 36px;
    height: 36px;
  }
}

.modal-close-btn:hover {
  color: var(--text-dark);
}

.modal-body {
  padding: 20px;
}

@media (min-width: 768px) {
  .modal-body {
    padding: 24px 30px;
  }
}

/* ============================================
   TOAST/NOTIFICATIONS
   ============================================ */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: var(--z-tooltip);
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 90%;
  width: 350px;
}

@media (min-width: 768px) {
  .toast-container {
    top: 24px;
    right: 24px;
    width: 400px;
  }
}

.toast {
  background: var(--card-bg);
  padding: 16px 20px;
  border-radius: var(--radius-small);
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  gap: 12px;
  border-left: 4px solid var(--primary-blue);
  animation: slideIn 0.3s ease;
}

@media (min-width: 768px) {
  .toast {
    padding: 18px 24px;
    gap: 14px;
  }
}

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

.toast-success {
  border-left-color: var(--success-green);
}

.toast-error {
  border-left-color: var(--error-red);
}

.toast-warning {
  border-left-color: var(--warning-yellow);
}

.toast-message {
  flex: 1;
  font-size: var(--font-body);
  color: var(--text-dark);
  line-height: 1.5;
}

@media (min-width: 768px) {
  .toast-message {
    font-size: var(--font-body);
  }
}

/* ============================================
   LOADING OVERLAY
   ============================================ */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.9);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: var(--z-modal);
}

.loading-overlay.active {
  display: flex;
}

.spinner {
  width: 50px;
  height: 50px;
  border: 4px solid var(--border-light);
  border-top-color: var(--accent-orange);
  border-radius: var(--radius-circle);
  animation: spin 0.8s linear infinite;
}

@media (min-width: 768px) {
  .spinner {
    width: 60px;
    height: 60px;
  }
}

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

/* ============================================
   ANIMATIONS
   ============================================ */
.fade-in {
  animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.slide-up {
  animation: slideUp 0.5s ease;
}

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

/* ============================================
   SCROLLBAR STYLING
   ============================================ */
::-webkit-scrollbar {
  width: 12px;
}

::-webkit-scrollbar-track {
  background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
  background: var(--medium-gray);
  border-radius: 6px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-medium);
}

/* ============================================
   ACCESSIBILITY
   ============================================ */
.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 {
  outline: 3px solid var(--accent-orange);
  outline-offset: 2px;
}

button:focus-visible,
a:focus-visible {
  outline: 3px solid var(--accent-orange);
  outline-offset: 2px;
}

/* ============================================
   BACK TO TOP BUTTON
   ============================================ */
.back-to-top-btn {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 50px;
  height: 50px;
  background: var(--accent-orange);
  color: var(--text-on-primary);
  border: none;
  border-radius: var(--radius-circle);
  font-size: 24px;
  font-weight: bold;
  cursor: pointer;
  box-shadow: var(--shadow-md);
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px);
  transition: all var(--transition-normal);
  z-index: var(--z-sticky);
}

@media (min-width: 768px) {
  .back-to-top-btn {
    width: 56px;
    height: 56px;
    font-size: 28px;
    bottom: 40px;
    right: 40px;
  }
}

.back-to-top-btn.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.back-to-top-btn:hover {
  background: var(--dark-orange);
  transform: translateY(-4px);
  box-shadow: var(--shadow-hover);
}

.back-to-top-btn:active {
  transform: translateY(-2px);
}