/* =================================================================== */
/* MAIN STYLESHEET FOR CHEMICAN SOLUTIONS                              */
/* Final Consolidated Version - Handles All Components & Rich Text   */
/* =================================================================== */

/* =================================================================== */
/* 1. Global Variables */
/* =================================================================== */
:root {
  --primary-dark: #121212;
  --secondary-dark: #1e1e1e;
  --accent-blue: #0078d4;
  --accent-teal: #00b7c3;
  --text-light: #ffffff;
  --text-gray: #cccccc;
  --text-muted: #999999;
  --gradient-dark: linear-gradient(135deg, #121212, #1e1e1e);
  --shadow-soft: 0 4px 6px rgba(0, 0, 0, 0.1);
  --shadow-strong: 0 10px 20px rgba(0, 0, 0, 0.2);
  --transition-standard: all 0.3s ease;
  --font-primary: 'Segoe UI', 'Open Sans', sans-serif;
  --font-heading: 'Montserrat', sans-serif;
  --font-code: 'Consolas', 'Monaco', monospace;
}

/* =================================================================== */
/* 2. General Layout & Hero Section */
/* =================================================================== */
.page-header {
  position: relative;
  color: var(--text-light);
  padding: 120px 0 80px;
  background-color: var(--primary-dark);
  background-size: cover;
  background-position: center;
  text-align: center;
}

.page-header::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 0;
}

.badge {
  display: inline-block;
  padding: 6px 12px;
  background-color: var(--accent-teal);
  color: var(--text-light);
  border-radius: 4px;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 15px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* =================================================================== */
/* 3. Main Content Layout */
/* =================================================================== */
.partner-detail-container {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 40px;
  color: var(--text-light);
}

.partner-section {
  margin-bottom: 50px;
}

.partner-section h2 {
  font-family: var(--font-heading);
  font-size: 28px;
  margin-bottom: 20px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-light);
}

/* =================================================================== */
/* 4. Unified Rich Text Content Styling                                */
/* (For Blog, Partner Descriptions, Case Studies, etc.)                */
/* =================================================================== */
.rich-text-content {
    font-family: var(--font-primary);
    color: var(--text-light);
}

.rich-text-content h2,
.rich-text-content h3,
.rich-text-content h4 {
    font-family: var(--font-heading);
    color: var(--text-light) !important;
}

.rich-text-content h2 { font-size: 28px; margin: 40px 0 20px 0; }
.rich-text-content h3 { font-size: 22px; margin: 30px 0 15px 0; }
.rich-text-content h4 { font-size: 18px; margin: 25px 0 15px 0; }

.rich-text-content p {
    margin-bottom: 20px;
    line-height: 1.7;
    color: var(--text-light) !important;
}

/* --- Defensive List & Bullet Point Styling (Corrected) --- */
/* This section is updated to mirror blog styling for consistency and to fix alignment issues. */

.rich-text-content ul,
.rich-text-content ol {
    padding-left: 25px; /* Ensures space for the bullet/number */
    margin: 20px 0;
    list-style-position: outside !important; /* Prevents bullet from overlapping text */
}

/* Define the style for bulleted vs. numbered lists directly on the list tag */
.rich-text-content ul {
    list-style-type: disc !important;
}

.rich-text-content ol {
    list-style-type: decimal !important;
}

/* Ensure list items are always treated as such by the browser */
.rich-text-content li {
    display: list-item !important; /* Crucial for fixing the rendering issue */
    margin-bottom: 10px;
    padding-left: 5px;  /* Adds slight space between bullet and text */
    line-height: 1.6;
    color: var(--text-light) !important;
}

/* * FIX: Handles cases where the rich text editor wraps list item text in a <p> tag.
 * This prevents the <p> from adding a line break, which pushes text below the bullet.
 */
.rich-text-content li p {
    display: inline; /* Makes the paragraph flow next to the bullet */
    margin: 0 !important;
    padding: 0 !important;
}

/* FIX: Adds proper spacing when a list directly follows a paragraph or heading */
.rich-text-content p + ul,
.rich-text-content p + ol,
.rich-text-content h2 + ul,
.rich-text-content h2 + ol,
.rich-text-content h3 + ul,
.rich-text-content h3 + ol,
.rich-text-content h4 + ul,
.rich-text-content h4 + ol {
    margin-top: 20px; /* Creates consistent space above the list */
}

/* Styling for nested lists */
.rich-text-content ul ul,
.rich-text-content ol ol {
    margin-top: 10px;
    margin-bottom: 10px;
}


/* --- Other Rich Content Elements --- */
.rich-text-content a {
    color: var(--accent-blue);
    text-decoration: underline;
}
.rich-text-content a:hover {
    color: var(--accent-teal);
}

.rich-text-content img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 30px 0;
    box-shadow: var(--shadow-strong);
}

.rich-text-content blockquote {
    border-left: 4px solid var(--accent-teal);
    padding: 20px;
    margin: 30px 0;
    background-color: var(--primary-dark);
    font-style: italic;
    color: var(--text-gray);
    border-radius: 4px;
}

.rich-text-content blockquote p {
    margin: 0;
}

/* =================================================================== */
/* 5. Sidebar and Reusable Components */
/* =================================================================== */

/* Info Cards (Sidebar) */
.info-card, .testimonial-card {
  background-color: var(--secondary-dark);
  border-radius: 8px;
  padding: 25px;
  margin-bottom: 30px;
  box-shadow: var(--shadow-soft);
  transition: var(--transition-standard);
}

.info-card:hover, .testimonial-card:hover {
  box-shadow: var(--shadow-strong);
}

.logo-container {
  text-align: center;
  margin-bottom: 20px;
  padding-bottom: 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.logo-container img {
  max-width: 180px;
  max-height: 80px;
  object-fit: contain;
}

.info-item {
  margin-bottom: 15px;
  color: var(--text-light);
}

.info-label {
  display: block;
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 5px;
}

.info-item a {
    color: var(--accent-blue);
    text-decoration: none;
    transition: var(--transition-standard);
}
.info-item a:hover {
    color: var(--accent-teal);
    text-decoration: underline;
}

.category-tag {
  display: inline-block;
  background-color: rgba(0, 183, 195, 0.2);
  color: var(--accent-teal);
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 13px;
  margin-right: 8px;
  margin-bottom: 8px;
  font-weight: 500;
}

/* Testimonial Card */
.quote-icon {
  color: var(--accent-teal);
  font-size: 24px;
  margin-bottom: 15px;
  opacity: 0.8;
}

.testimonial-card p {
    color: var(--text-gray);
    font-style: italic;
}

.testimonial-author { margin-top: 20px; }
.testimonial-author strong { display: block; color: var(--text-light); }
.testimonial-author span { font-size: 14px; color: var(--text-muted); }

/* Case Study, Gallery, Related Items */
.case-study-content {
  background-color: var(--secondary-dark);
  border-radius: 8px;
  padding: 30px;
}

.gallery-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 20px;
}

.gallery-item {
  border-radius: 8px;
  overflow: hidden;
  box-shadow: var(--shadow-soft);
  transition: var(--transition-standard);
}

.gallery-item:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-strong);
}

.gallery-item img {
  width: 100%;
  height: 180px;
  object-fit: cover;
  display: block;
}

#related-items-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 30px;
  margin-top: 30px;
}

.partner-item {
  background-color: var(--secondary-dark);
  border-radius: 8px;
  padding: 25px;
  box-shadow: var(--shadow-soft);
  transition: var(--transition-standard);
  display: flex;
  flex-direction: column;
}

.partner-item:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-strong);
}

.partner-item h3.partner-name { margin: 0 0 10px 0; font-size: 18px; }
.partner-item p { flex-grow: 1; margin-bottom: 15px; color: var(--text-gray); font-size: 15px; }

.partner-item .btn {
    display: inline-block;
    padding: 8px 18px;
    border: 1px solid var(--accent-teal);
    background-color: transparent;
    color: var(--accent-teal);
    border-radius: 4px;
    text-align: center;
    text-decoration: none;
    transition: var(--transition-standard);
    align-self: flex-start;
}

.partner-item .btn:hover { background-color: var(--accent-teal); color: var(--text-light); }


/* =================================================================== */
/* 6. Loading and Error States */
/* =================================================================== */
.loading-indicator,
.error-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  text-align: center;
  width: 100%;
  color: var(--text-light);
}

.loading-indicator i {
  font-size: 30px;
  color: var(--accent-teal);
  margin-bottom: 20px;
}

.loading-indicator p,
.error-container p {
  color: var(--text-gray);
  font-size: 16px;
}

.error-container h2,
.error-container h3 {
    color: var(--text-light);
    font-family: var(--font-heading);
}

/* =================================================================== */
/* 7. Responsive Adjustments */
/* =================================================================== */
@media (max-width: 992px) {
  .partner-detail-container {
    grid-template-columns: 1fr;
  }
  .partner-sidebar {
    order: -1;
  }
}

@media (max-width: 768px) {
  .page-header {
    padding: 80px 0 50px;
  }
  #related-items-container {
    grid-template-columns: 1fr;
  }
  .gallery-container {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  }
}