/**
 * Chemical Compatibility Checker - Frontend Styles
 *
 * All rules are scoped under .ccc-wrapper to prevent conflicts
 * with WordPress themes. Loaded only on pages that contain
 * the [chemical_compatibility_checker] shortcode.
 *
 * Color scheme based on kelco.com.au brand identity.
 */

/* ========================================================================
   Box-sizing reset
   ======================================================================== */

.ccc-wrapper,
.ccc-wrapper * {
  box-sizing: border-box;
}

/* ========================================================================
   CSS Custom Properties
   ======================================================================== */

.ccc-wrapper {
  --ccc-bg-primary: #ffffff;
  --ccc-bg-secondary: #f7f8fa;
  --ccc-bg-tertiary: #eef1f5;
  --ccc-text-primary: #1a1a1a;
  --ccc-text-secondary: #444444;
  --ccc-text-muted: #6b7280;
  --ccc-accent: #fc7702;
  --ccc-accent-hover: #e56a00;
  --ccc-accent-light: #fff3e6;
  --ccc-link-blue: #0693e3;
  --ccc-green: #16a34a;
  --ccc-green-bg: #dcfce7;
  --ccc-green-text: #166534;
  --ccc-yellow: #ca8a04;
  --ccc-yellow-bg: #fefce8;
  --ccc-yellow-text: #854d0e;
  --ccc-red: #dc2626;
  --ccc-red-bg: #fef2f2;
  --ccc-red-text: #991b1b;
  --ccc-gray: #6b7280;
  --ccc-gray-bg: #f3f4f6;
  --ccc-gray-text: #374151;
  --ccc-border: #d1d5db;
  --ccc-border-light: #e5e7eb;
  --ccc-ring: #fc7702;
  --ccc-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);
  --ccc-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
  --ccc-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
}

/* ========================================================================
   Wrapper
   ======================================================================== */

.ccc-wrapper {
  background: var(--ccc-bg-primary);
  color: var(--ccc-text-primary);
  padding: 1.5rem 1rem;
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif,
    "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1.5;
}

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

.ccc-container {
  max-width: 48rem;
  width: 100%;
  margin: 0 auto;
}

/* ========================================================================
   Header
   ======================================================================== */

.ccc-header {
  margin-bottom: 2rem;
  text-align: center;
}

/* ========================================================================
   Title
   ======================================================================== */

.ccc-title {
  font-size: 2.25rem;
  font-weight: 700;
  color: var(--ccc-accent);
  margin: 0 0 0.5rem 0;
  letter-spacing: -0.02em;
}

/* ========================================================================
   Subtitle
   ======================================================================== */

.ccc-subtitle {
  font-size: 0.9375rem;
  color: var(--ccc-text-muted);
  max-width: 42rem;
  margin: 0 auto;
}

/* ========================================================================
   Card
   ======================================================================== */

.ccc-card {
  background: var(--ccc-bg-secondary);
  box-shadow: var(--ccc-shadow-md);
  border-radius: 0.75rem;
  padding: 1.5rem;
  border: 1px solid var(--ccc-border-light);
}

/* ========================================================================
   Section
   ======================================================================== */

.ccc-section {
  margin-bottom: 1.5rem;
}

/* ========================================================================
   Labels
   ======================================================================== */

.ccc-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--ccc-text-secondary);
  margin-bottom: 0.375rem;
}

/* ========================================================================
   Select dropdowns
   ======================================================================== */

.ccc-select {
  display: block;
  width: 100%;
  border-radius: 0.5rem;
  border: 1px solid var(--ccc-border);
  padding: 0.625rem 2.5rem 0.625rem 0.75rem;
  background-color: #ffffff;
  color: var(--ccc-text-primary);
  font-size: 0.875rem;
  line-height: 1.5rem;
  transition: border-color 150ms ease-in-out,
    box-shadow 150ms ease-in-out;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3E%3Cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3E%3C/svg%3E");
  background-position: right 0.5rem center;
  background-repeat: no-repeat;
  background-size: 1.5em 1.5em;
}

.ccc-select:focus {
  border-color: var(--ccc-accent);
  box-shadow: 0 0 0 3px rgba(252, 119, 2, 0.2);
  outline: none;
}

.ccc-select:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  background-color: var(--ccc-bg-tertiary);
}

/* ========================================================================
   Grid layout
   ======================================================================== */

.ccc-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

/* ========================================================================
   Button
   ======================================================================== */

.ccc-btn {
  width: 100%;
  background-color: var(--ccc-accent);
  color: #ffffff;
  font-weight: 600;
  padding: 0.75rem 1.5rem;
  border-radius: 0.5rem;
  border: none;
  box-shadow: var(--ccc-shadow-md);
  cursor: pointer;
  transition: background-color 150ms ease-in-out, box-shadow 150ms ease-in-out;
  font-size: 1rem;
  line-height: 1.5;
}

.ccc-btn:hover {
  background-color: var(--ccc-accent-hover);
  box-shadow: var(--ccc-shadow-lg);
}

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

.ccc-btn:focus {
  outline: none;
  box-shadow:
    0 0 0 3px rgba(252, 119, 2, 0.4),
    var(--ccc-shadow-md);
}

/* ========================================================================
   Results container
   ======================================================================== */

.ccc-results {
  margin-top: 2rem;
  padding: 1.5rem;
  background: var(--ccc-bg-primary);
  border-radius: 0.75rem;
  box-shadow: var(--ccc-shadow-lg);
  border: 1px solid var(--ccc-border-light);
}

/* ========================================================================
   Product header
   ======================================================================== */

.ccc-product-header {
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--ccc-border-light);
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* ========================================================================
   Product image
   ======================================================================== */

.ccc-product-image {
  width: 6rem;
  height: 6rem;
  object-fit: contain;
  border-radius: 0.5rem;
  margin: 0 0 1rem 0;
  border: 1px solid var(--ccc-border-light);
  background: #ffffff;
  padding: 0.25rem;
}

/* ========================================================================
   Product info
   ======================================================================== */

.ccc-product-name {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--ccc-text-primary);
  margin: 0;
}

.ccc-chemical-label {
  font-size: 1rem;
  color: var(--ccc-text-muted);
  margin: 0.25rem 0 0 0;
}

.ccc-chemical-name {
  font-weight: 600;
  color: var(--ccc-accent);
}

/* ========================================================================
   Status badge
   ======================================================================== */

.ccc-status-badge {
  padding: 1rem 1.25rem;
  border-radius: 0.5rem;
  margin-bottom: 1.5rem;
  text-align: center;
}

/* Status colors — accessible with good contrast on both white and colored bg */
.ccc-status-green {
  background-color: var(--ccc-green-bg);
  color: var(--ccc-green-text);
  border: 1px solid #bbf7d0;
}

.ccc-status-yellow {
  background-color: var(--ccc-yellow-bg);
  color: var(--ccc-yellow-text);
  border: 1px solid #fef08a;
}

.ccc-status-red {
  background-color: var(--ccc-red-bg);
  color: var(--ccc-red-text);
  border: 1px solid #fecaca;
}

.ccc-status-gray {
  background-color: var(--ccc-gray-bg);
  color: var(--ccc-gray-text);
  border: 1px solid var(--ccc-border);
}

.ccc-status-slate {
  background-color: var(--ccc-bg-tertiary);
  color: var(--ccc-text-muted);
  border: 1px solid var(--ccc-border-light);
}

/* Status text */
.ccc-status-title {
  font-size: 1.25rem;
  font-weight: 700;
  margin: 0 0 0.25rem 0;
}

.ccc-status-text {
  font-size: 1.125rem;
  margin: 0;
}

.ccc-status-notes {
  font-size: 0.875rem;
  margin-top: 0.5rem;
  opacity: 0.85;
}

/* ========================================================================
   Material breakdown
   ======================================================================== */

.ccc-breakdown-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--ccc-text-secondary);
  margin-bottom: 0.75rem;
}

/* ========================================================================
   Material list
   ======================================================================== */

.ccc-material-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
}

/* ========================================================================
   Material item
   ======================================================================== */

.ccc-material-item {
  padding: 0.75rem 1rem;
  border-radius: 0.5rem;
  box-shadow: var(--ccc-shadow);
  display: flex;
  flex-direction: column;
}

/* ========================================================================
   Material text
   ======================================================================== */

.ccc-material-name {
  font-weight: 600;
  color: inherit;
}

.ccc-material-rating {
  margin-left: 0.5rem;
  color: inherit;
}

.ccc-material-notes {
  font-size: 0.8125rem;
  margin-top: 0.25rem;
  opacity: 0.8;
  font-style: italic;
}

/* ========================================================================
   Disclaimer
   ======================================================================== */

.ccc-disclaimer {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--ccc-border-light);
  font-size: 0.75rem;
  color: var(--ccc-text-muted);
  text-align: left;
  line-height: 1.5;
}

.ccc-disclaimer p {
  margin: 0.5rem 0;
}

.ccc-disclaimer p:first-child {
  margin-top: 0;
}

.ccc-disclaimer p:last-child {
  margin-bottom: 0;
}

/* ========================================================================
   Temperature info
   ======================================================================== */

.ccc-temp-info {
  margin-top: 1.5rem;
  padding: 1rem 1.25rem;
  background: var(--ccc-bg-secondary);
  border-radius: 0.5rem;
  border: 1px solid var(--ccc-border-light);
}

.ccc-temp-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--ccc-text-secondary);
  margin: 0 0 0.75rem 0;
}

.ccc-temp-details {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.ccc-temp-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  font-size: 0.8125rem;
  font-weight: 600;
}

.ccc-temp-low {
  background-color: var(--ccc-green-bg);
  color: var(--ccc-green-text);
  border: 1px solid #bbf7d0;
}

.ccc-temp-moderate {
  background-color: var(--ccc-yellow-bg);
  color: var(--ccc-yellow-text);
  border: 1px solid #fef08a;
}

.ccc-temp-high {
  background-color: var(--ccc-red-bg);
  color: var(--ccc-red-text);
  border: 1px solid #fecaca;
}

.ccc-temp-max {
  font-size: 0.875rem;
  color: var(--ccc-text-secondary);
}

.ccc-temp-note {
  margin: 0.5rem 0 0 0;
  font-size: 0.8125rem;
  color: var(--ccc-text-muted);
  line-height: 1.5;
  font-style: italic;
}

/* Standing footer disclaimer (always visible below the card) */
.ccc-footer-disclaimer {
  margin-top: 1rem;
  padding: 0.75rem 1rem;
  font-size: 0.7rem;
  color: var(--ccc-text-muted);
  text-align: center;
  line-height: 1.5;
}

.ccc-footer-disclaimer p {
  margin: 0;
}

/* ========================================================================
   Helper text
   ======================================================================== */

.ccc-helper-text {
  font-size: 0.75rem;
  color: var(--ccc-text-muted);
  margin-top: 0.25rem;
}

/* ========================================================================
   Responsive: 640px+ (sm)
   ======================================================================== */

@media (min-width: 640px) {
  .ccc-wrapper {
    padding: 2rem;
  }

  .ccc-card {
    padding: 2rem;
  }

  .ccc-product-header {
    flex-direction: row;
  }

  .ccc-product-image {
    margin: 0 1.5rem 0 0;
  }
}

/* ========================================================================
   Responsive: 768px+ (md)
   ======================================================================== */

@media (min-width: 768px) {
  .ccc-grid {
    grid-template-columns: 1fr 1fr;
  }

  .ccc-material-item {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
  }

  .ccc-material-notes {
    margin-top: 0;
    margin-left: 1rem;
  }
}
