/**
 * PCC Webflow Defaults Stylesheet
 * 
 * This stylesheet provides default styling for PCC Lit components that matches
 * the Webflow design system used in the PCC application.
 * 
 * Usage:
 * 1. In Webflow: Add to Project Settings → Custom Code → Head Code
 * 2. In HTML: <link rel="stylesheet" href="path/to/pcc-webflow-defaults.css">
 * 
 * All styles use CSS custom properties that can be overridden externally.
 */

/* ============================================ */
/* Global Colors & Variables */
/* ============================================ */

:root {
  /* Brand Colors */
  --respect-pink: #dd4e7e;
  --respect-pink-light: #f9e3eb;
  --premium-blue: #51b2cf;
  --premium-blue-light: #ddf0f6;
  
  /* Neutral Colors */
  --text-dark: #222;
  --text-secondary: #333;
  --text-muted: #555;
  --text-light: #94a3b8;
  --border-color: #ccc;
  --border-light: #ebebeb;
  --bg-white: #ffffff;
  --bg-alt: #fafafa;
  --bg-gray: #fafbfc;
  --bg-header: #ebebef;
  --bg-hover: #ddf0f6;
  
  /* Spacing */
  --spacing-xs: 0.25rem;
  --spacing-sm: 0.5rem;
  --spacing-md: 0.75rem;
  --spacing-lg: 1rem;
  --spacing-xl: 1.25rem;
  
  /* Typography */
  --font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-family-mono: monospace;
  
  /* Border Radius */
  --radius-sm: 0.25rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
  
  /* Transitions */
  --transition-speed: 0.2s;
  --transition-timing: ease;
}

/* ============================================ */
/* Container Styles */
/* ============================================ */

.parser-container {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin: 1rem auto;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: flex-start;
  align-items: center;
  margin-top: 1rem;
}

.results {
  margin-top: 1.5rem;
  border-radius: var(--radius-lg);
  background: var(--bg-white);
  overflow-x: auto;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

/* ============================================ */
/* Button Component Styling */
/* ============================================ */

pcc-button {
  --button-padding: 0.85rem 1.25rem 0.65rem 1.25rem;
  --button-radius: var(--radius-md);
  --button-font-size: 0.9rem;
  --transition-speed: var(--transition-speed);
}

/* Primary Button (Premium Blue) */
pcc-button[variant="primary"] {
  --button-bg: var(--premium-blue);
  --button-color: white;
  --button-border: 2px solid var(--premium-blue);
  --button-hover-bg: #3da9c9;
}

/* Secondary Button (Light Gray) */
pcc-button[variant="secondary"] {
  --button-bg: #f5f5f5;
  --button-color: var(--text-secondary);
  --button-border: 1px solid var(--border-color);
  --button-hover-bg: #e0e0e0;
}

/* Outline Button (Transparent with Premium Blue border) */
pcc-button[variant="outline"],
pcc-button[variant="primary"][outline] {
  --button-bg: transparent;
  --button-color: var(--premium-blue);
  --button-border: 2px solid var(--premium-blue);
  --button-hover-bg: var(--premium-blue-light);
}

/* ============================================ */
/* Textarea Component Styling */
/* ============================================ */

pcc-textarea {
  --textarea-bg: var(--bg-alt);
  --textarea-border: 1px solid var(--border-color);
  --textarea-border-focus: #0057d8;
  --textarea-radius: var(--radius-md);
  --textarea-padding: var(--spacing-md);
  
  display: block;
  width: 100%;
}

pcc-textarea::part(textarea) {
  background-color: var(--textarea-bg);
  border: var(--textarea-border);
  border-radius: var(--textarea-radius);
  padding: var(--textarea-padding);
  line-height: 1.5;
  color: var(--text-dark);
  resize: vertical;
  min-height: 10rem;
  transition: border-color var(--transition-speed) var(--transition-timing), 
              box-shadow var(--transition-speed) var(--transition-timing);
}

pcc-textarea::part(textarea):focus-within {
  border-color: var(--textarea-border-focus);
  box-shadow: 0 0 0 2px rgba(0, 87, 216, 0.15);
  outline: none;
}

/* ============================================ */
/* Table Styling (Webflow-aligned) */
/* ============================================ */

.residents-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-family);
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.residents-table thead {
  background-color: var(--bg-header);
}

.residents-table th {
  text-align: left;
  padding: 0.75rem 1rem;
  font-weight: 600;
  color: #2c3e50;
  white-space: nowrap;
}

.residents-table td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border-light);
  vertical-align: middle;
}

/* Zebra Striping */
.residents-table tbody tr:nth-child(even) {
  background-color: var(--bg-gray);
}

/* Hover Highlight */
.residents-table tbody tr:hover {
  background-color: var(--bg-hover);
  transition: background-color var(--transition-speed) var(--transition-timing);
}

/* Field Count Badge */
.field-count {
  display: inline-block;
  background: var(--respect-pink-light);
  color: var(--respect-pink);
  font-weight: 500;
  font-size: 0.85rem;
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  text-align: center;
  min-width: 1.5rem;
}

.field-count:hover {
  background: #f5cedc;
}

/* Error Handling Cells */
.no-errors {
  color: var(--text-light);
  font-style: italic;
}

/* ============================================ */
/* Modal Component Styling */
/* ============================================ */

pcc-modal {
  --modal-overlay-bg: rgba(0, 0, 0, 0.45);
  --modal-bg: var(--bg-white);
  --modal-radius: 16px;
  --modal-shadow: 0 6px 24px rgba(0, 0, 0, 0.25);
  --modal-max-width: 900px;
  --modal-max-height: 75vh;
  --modal-padding: 2rem;
  --modal-z-index: 999;
  
  /* Header */
  --modal-header-border: 2px solid #f2f2f2;
  --modal-header-margin: 1.25rem;
  --modal-header-padding: 1rem;
  --modal-title-size: 1.5rem;
  --modal-title-color: var(--text-secondary);
  
  /* Close Button */
  --modal-close-bg: var(--respect-pink);
  --modal-close-color: white;
  --modal-close-padding: 0.25rem 0.5rem;
  --modal-close-radius: var(--radius-md);
  --modal-close-size: 1.25rem;
  --modal-close-hover-bg: #c43d6a;
}

/* ============================================ */
/* Info Tables (inside modals) */
/* ============================================ */

.info-table,
.fields-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 0;
  font-size: 0.9rem;
}

.info-table th,
.info-table td,
.fields-table th,
.fields-table td {
  padding: 8px 12px;
  border: 1px solid #ddd;
  text-align: left;
  vertical-align: top;
}

.info-table th,
.fields-table th {
  background: #f2f2f2;
  font-weight: 800;
  color: var(--text-secondary);
}

.info-table tr:nth-child(even),
.fields-table tr:nth-child(even) {
  background: var(--bg-alt);
}

.info-table th {
  width: 10rem;
}

/* Inline Code Formatting */
.fields-table code {
  font-family: var(--font-family-mono);
  background: var(--premium-blue-light);
  padding: 2px 8px;
  border-radius: 4px;
  color: #444;
  font-weight: 500;
}

/* ============================================ */
/* Responsive Adjustments */
/* ============================================ */

@media (max-width: 768px) {
  /* Buttons */
  pcc-button {
    --button-padding: 0.65rem 1rem 0.5rem 1rem;
    --button-font-size: 0.85rem;
  }
  
  /* Tables */
  .residents-table th,
  .residents-table td {
    padding: 0.5rem 0.75rem;
    font-size: 0.8rem;
  }
  
  /* Info Tables */
  .info-table th,
  .info-table td,
  .fields-table th,
  .fields-table td {
    font-size: 0.85rem;
    padding: 6px 8px;
  }
  
  /* Modal */
  pcc-modal {
    --modal-padding: 1rem;
    --modal-title-size: 1.25rem;
  }
}

/* ============================================ */
/* Print Styles */
/* ============================================ */

@media print {
  /* Ensure colors print correctly */
  .residents-table,
  .field-count,
  pcc-button,
  pcc-modal {
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }
  
  /* Hide interactive elements */
  .button-row,
  pcc-modal::part(close) {
    display: none;
  }
}
