/* 
 * Main Styles - Paso a Casa
 * Mobile-First Base Styles
 * 
 * Order:
 * 1. Import reset and variables
 * 2. Base HTML/Body styles
 * 3. Typography (mobile-first)
 * 4. Layout utilities
 * 5. Buttons
 * 6. Forms
 * 7. Components
 * 8. Utility classes
 * 9. Desktop overrides (media queries)
 */

/* ===== IMPORTS ===== */
@import './reset.css';
@import './variables.css';


/* ===== BASE STYLES ===== */
body {
  font-family: var(--font-sans);
  font-size: var(--font-size-base);
  line-height: var(--line-height-normal);
  color: var(--color-text);
  background-color: var(--color-background);
  /* Better font smoothing on retina displays */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}


/* ===== TYPOGRAPHY (Mobile-First) ===== */

/* Headings - Mobile sizes */
h1, h2, h3, h4, h5, h6 {
  font-weight: var(--font-weight-bold);
  line-height: var(--line-height-tight);
  letter-spacing: var(--letter-spacing-tight);
  color: var(--color-text);
  margin-bottom: var(--space-md);
}

h1 {
  font-size: var(--font-size-3xl);  /* 30px on mobile */
  margin-bottom: var(--space-lg);
}

h2 {
  font-size: var(--font-size-2xl);  /* 24px on mobile */
  font-weight: var(--font-weight-semibold);
}

h3 {
  font-size: var(--font-size-xl);   /* 20px on mobile */
  font-weight: var(--font-weight-semibold);
}

h4 {
  font-size: var(--font-size-lg);   /* 18px on mobile */
  font-weight: var(--font-weight-medium);
}

h5, h6 {
  font-size: var(--font-size-base); /* 16px on mobile */
  font-weight: var(--font-weight-medium);
}

/* Desktop heading sizes */
@media (min-width: 768px) {
  h1 {
    font-size: var(--font-size-4xl);  /* 36px on desktop */
  }
  
  h2 {
    font-size: var(--font-size-3xl);  /* 30px on desktop */
  }
  
  h3 {
    font-size: var(--font-size-2xl);  /* 24px on desktop */
  }
}

/* Large heading variant (hero titles) */
.heading-hero {
  font-size: 2rem;  /* 32px mobile */
  line-height: 1.1;
}

@media (min-width: 768px) {
  .heading-hero {
    font-size: 3rem;  /* 48px desktop */
  }
}

/* Paragraphs */
p {
  margin-bottom: var(--space-md);
  color: var(--color-text);
  max-width: var(--content-width);
}

.lead {
  font-size: var(--font-size-lg);
  line-height: var(--line-height-relaxed);
  color: var(--color-text-light);
}

/* Links */
a {
  color: var(--color-primary);
  transition: color var(--transition-fast);
}

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

a:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* Strong, emphasis */
strong, b {
  font-weight: var(--font-weight-semibold);
}

em, i {
  font-style: italic;
}

/* Small text */
small {
  font-size: var(--font-size-sm);
  color: var(--color-text-light);
}


/* ===== LAYOUT ===== */

/* Container - Mobile-first with horizontal padding */
.container {
  width: 100%;
  max-width: var(--container-xl);
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--space-md);  /* 16px on mobile */
  padding-right: var(--space-md);
}

@media (min-width: 768px) {
  .container {
    padding-left: var(--space-lg);  /* 24px on tablet+ */
    padding-right: var(--space-lg);
  }
}

@media (min-width: 1024px) {
  .container {
    padding-left: var(--space-xl);  /* 32px on desktop */
    padding-right: var(--space-xl);
  }
}

/* Content wrapper (for articles) */
.content-wrapper {
  max-width: var(--content-width);
  margin-left: auto;
  margin-right: auto;
}

/* Section spacing */
section {
  padding-top: var(--space-2xl);
  padding-bottom: var(--space-2xl);
}

@media (min-width: 768px) {
  section {
    padding-top: var(--space-3xl);
    padding-bottom: var(--space-3xl);
  }
}


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

.btn {
  /* Base button styles */
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  
  /* Sizing - minimum touch target */
  min-height: var(--touch-target-min);
  padding: 12px 20px;
  
  /* Typography */
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-semibold);
  line-height: 1;
  text-align: center;
  
  /* Visual */
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  
  /* Transitions */
  transition: all var(--transition-base);
  
  /* Remove tap highlight on mobile */
  -webkit-tap-highlight-color: transparent;
  
  /* Prevent text selection */
  user-select: none;
}

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

/* Primary Button */
.btn-primary {
  background-color: var(--color-primary);
  color: var(--color-text-inverse);
}

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

.btn-primary:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: var(--shadow-sm);
}

/* Secondary Button */
.btn-secondary {
  background-color: transparent;
  color: var(--color-primary);
  border: 2px solid var(--color-primary);
}

.btn-secondary:hover:not(:disabled) {
  background-color: var(--color-primary-bg);
  border-color: var(--color-primary-dark);
}

/* Success Button */
.btn-success {
  background-color: var(--color-success);
  color: var(--color-text-inverse);
}

.btn-success:hover:not(:disabled) {
  background-color: var(--color-success-dark);
}

/* Button Sizes */
.btn-sm {
  min-height: 36px;
  padding: 8px 16px;
  font-size: var(--font-size-sm);
}

.btn-lg {
  min-height: var(--touch-target-comfortable);
  padding: 16px 32px;
  font-size: var(--font-size-lg);
}

/* Block Button (full width on mobile) */
.btn-block {
  width: 100%;
}

@media (min-width: 768px) {
  .btn-block {
    width: auto;
  }
}

/* Icon Button (square) */
.btn-icon {
  width: var(--touch-target-min);
  height: var(--touch-target-min);
  padding: 0;
  border-radius: var(--radius-full);
}


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

/* Form Group */
.form-group {
  margin-bottom: var(--space-md);
}

/* Labels */
label {
  display: block;
  margin-bottom: var(--space-2);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  color: var(--color-text);
}

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

/* Input, Select, Textarea */
input[type="text"],
input[type="email"],
input[type="tel"],
input[type="number"],
input[type="password"],
input[type="url"],
select,
textarea {
  width: 100%;
  min-height: var(--touch-target-min);
  padding: 12px 16px;
  
  font-size: var(--font-size-base);  /* 16px - prevents iOS zoom */
  line-height: var(--line-height-normal);
  
  color: var(--color-text);
  background-color: var(--color-background);
  
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

/* Focus state */
input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: var(--shadow-focus);
}

/* Error state */
input.error,
select.error,
textarea.error {
  border-color: var(--color-error);
}

input.error:focus,
select.error:focus,
textarea.error:focus {
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.2);
}

/* Success state */
input.success,
select.success,
textarea.success {
  border-color: var(--color-success);
}

/* Disabled state */
input:disabled,
select:disabled,
textarea:disabled {
  background-color: var(--color-background-dark);
  cursor: not-allowed;
  opacity: 0.6;
}

/* Textarea specific */
textarea {
  min-height: 120px;
  resize: vertical;
}

/* Select specific (custom arrow) */
select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7280' d='M10.293 3.293L6 7.586 1.707 3.293A1 1 0 00.293 4.707l5 5a1 1 0 001.414 0l5-5a1 1 0 10-1.414-1.414z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 40px;
}

/* Checkbox and Radio */
input[type="checkbox"],
input[type="radio"] {
  width: 20px;
  height: 20px;
  margin-right: var(--space-2);
  cursor: pointer;
  /* Remove default appearance to style custom */
  appearance: none;
  border: 2px solid var(--color-border);
  background-color: var(--color-background);
  transition: all var(--transition-fast);
}

input[type="checkbox"] {
  border-radius: var(--radius-sm);
}

input[type="radio"] {
  border-radius: var(--radius-full);
}

input[type="checkbox"]:checked,
input[type="radio"]:checked {
  background-color: var(--color-primary);
  border-color: var(--color-primary);
}

/* Checkbox checkmark */
input[type="checkbox"]:checked::after {
  content: '✓';
  display: block;
  color: white;
  font-size: 14px;
  text-align: center;
  line-height: 16px;
}

/* Radio dot */
input[type="radio"]:checked::after {
  content: '';
  display: block;
  width: 8px;
  height: 8px;
  margin: 4px;
  border-radius: var(--radius-full);
  background-color: white;
}

/* Helper text */
.form-helper {
  margin-top: var(--space-2);
  font-size: var(--font-size-sm);
  color: var(--color-text-light);
}

.form-error {
  margin-top: var(--space-2);
  font-size: var(--font-size-sm);
  color: var(--color-error);
}


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

.card {
  background-color: var(--color-background);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  transition: box-shadow var(--transition-base), transform var(--transition-base);
}

.card:hover {
  box-shadow: var(--shadow-md);
}

.card-interactive {
  cursor: pointer;
}

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


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

/* 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-secondary { color: var(--color-secondary); }
.text-light { color: var(--color-text-light); }
.text-lighter { color: var(--color-text-lighter); }
.text-error { color: var(--color-error); }
.text-success { color: var(--color-success); }

/* Font Weights */
.font-normal { font-weight: var(--font-weight-normal); }
.font-medium { font-weight: var(--font-weight-medium); }
.font-semibold { font-weight: var(--font-weight-semibold); }
.font-bold { font-weight: var(--font-weight-bold); }

/* Margin Utilities */
.m-0 { margin: 0; }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mt-xl { margin-top: var(--space-xl); }
.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }
.mb-xl { margin-bottom: var(--space-xl); }

/* Padding Utilities */
.p-0 { padding: 0; }
.pt-sm { padding-top: var(--space-sm); }
.pt-md { padding-top: var(--space-md); }
.pt-lg { padding-top: var(--space-lg); }
.pb-sm { padding-bottom: var(--space-sm); }
.pb-md { padding-bottom: var(--space-md); }
.pb-lg { padding-bottom: var(--space-lg); }

/* Display */
.hidden { display: none; }
.block { display: block; }
.inline-block { display: inline-block; }
.flex { display: flex; }
.inline-flex { display: inline-flex; }

/* Flexbox Utilities */
.flex-col { flex-direction: column; }
.flex-row { flex-direction: row; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.items-end { align-items: flex-end; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.justify-around { justify-content: space-around; }
.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }
.gap-lg { gap: var(--space-lg); }

/* Responsive Utilities */
@media (max-width: 767px) {
  .mobile-hidden { display: none; }
}

@media (min-width: 768px) {
  .desktop-hidden { display: none; }
}


/* ===== ACCESSIBILITY ===== */

/* Screen reader only (for 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-width: 0;
}

/* Skip to main content link */
.skip-to-main {
  position: absolute;
  top: -100px;
  left: 0;
  background: var(--color-primary);
  color: white;
  padding: var(--space-md);
  text-decoration: none;
  z-index: var(--z-toast);
}

.skip-to-main:focus {
  top: 0;
}
