/**
 * SurplusChemicalsEU - Main Stylesheet
 * Professional B2B Chemical Marketplace Design
 */

/* ============================================
   CSS VARIABLES & RESET
   ============================================ */
:root {
    /* Colors - European Chemical Industry Inspired */
    --primary-blue: #0B3C5D;
    --eu-blue: #003399;
    --accent-green: #00A86B;
    --dark-blue: #082840;
    --light-gray: #F5F7FA;
    --medium-gray: #E1E8ED;
    --text-dark: #1A1A1A;
    --text-medium: #4A4A4A;
    --text-light: #6B6B6B;
    --white: #FFFFFF;
    --border-color: #D1D9E0;
    --error-red: #D32F2F;
    --success-green: #00A86B;
    --warning-orange: #F57C00;
    
    /* Typography */
    --font-primary: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-headings: 'Montserrat', 'Inter', sans-serif;
    
    /* Spacing */
    --spacing-xs: 0.5rem;
    --spacing-sm: 1rem;
    --spacing-md: 1.5rem;
    --spacing-lg: 2rem;
    --spacing-xl: 3rem;
    --spacing-2xl: 4rem;
    
    /* Transitions */
    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;
    
    /* Shadows */
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);
    --shadow-xl: 0 16px 48px rgba(0, 0, 0, 0.15);
    
    /* Border Radius */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-primary);
    color: var(--text-dark);
    line-height: 1.6;
    background-color: var(--white);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ============================================
   TYPOGRAPHY
   ============================================ */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-headings);
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: var(--spacing-md);
    color: var(--primary-blue);
}

h1 { font-size: 3rem; }
h2 { font-size: 2.5rem; }
h3 { font-size: 2rem; }
h4 { font-size: 1.5rem; }
h5 { font-size: 1.25rem; }
h6 { font-size: 1rem; }

p {
    margin-bottom: var(--spacing-sm);
    color: var(--text-medium);
}

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

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

/* ============================================
   LAYOUT
   ============================================ */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--spacing-md);
}

.container-fluid {
    width: 100%;
    padding: 0 var(--spacing-md);
}

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

.section-alt {
    background-color: var(--light-gray);
}

/* ============================================
   HEADER & NAVIGATION
   ============================================ */
.header {
    background: linear-gradient(135deg, var(--primary-blue) 0%, var(--dark-blue) 100%);
    color: var(--white);
    box-shadow: var(--shadow-md);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-main .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
}

.logo .logo-img {
    height: 70px;
    margin: 8px 0;
    width: auto;
    display: block;
    flex-shrink: 0;
}

.logo:hover {
    color: var(--accent-green);
}

.logo:hover .logo-img {
    opacity: 0.95;
}

.nav-main ul {
    display: flex;
    list-style: none;
    gap: var(--spacing-lg);
    align-items: center;
}

.nav-main a {
    color: var(--white);
    font-weight: 500;
    padding: var(--spacing-xs) var(--spacing-sm);
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.nav-main a:hover,
.nav-main a.active {
    background-color: rgba(255, 255, 255, 0.1);
    color: var(--accent-green);
}

.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--white);
    font-size: 1.5rem;
    cursor: pointer;
}

/* ============================================
   BUTTONS
   ============================================ */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    font-weight: 600;
    text-align: center;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-normal);
    border: none;
    font-size: 1rem;
    line-height: 1.5;
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--eu-blue) 0%, var(--primary-blue) 100%);
    color: var(--white);
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    color: var(--white);
}

.btn-secondary {
    background: linear-gradient(135deg, var(--accent-green) 0%, #008C5A 100%);
    color: var(--white);
    box-shadow: var(--shadow-sm);
}

.btn-secondary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    color: var(--white);
}

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

.btn-outline:hover {
    background-color: var(--eu-blue);
    color: var(--white);
}

.btn-lg {
    padding: 1rem 2rem;
    font-size: 1.125rem;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

/* ============================================
   HERO SECTION
   ============================================ */
.hero {
    position: relative;
    min-height: 600px;
    display: flex;
    align-items: center;
    background: linear-gradient(135deg, var(--primary-blue) 0%, var(--dark-blue) 50%, var(--eu-blue) 100%);
    color: var(--white);
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(circle at 20% 50%, rgba(0, 168, 107, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(0, 51, 153, 0.1) 0%, transparent 50%);
    animation: gradientShift 15s ease infinite;
}

@keyframes gradientShift {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.8; }
}

.hero-content {
    position: relative;
    z-index: 1;
    max-width: 800px;
    text-align: center;
    margin: 0 auto;
}

.hero h1 {
    font-size: 3.5rem;
    color: var(--white);
    margin-bottom: var(--spacing-md);
    line-height: 1.1;
}

.hero-subtitle {
    font-size: 1.25rem;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: var(--spacing-xl);
    line-height: 1.6;
}

.hero-cta {
    display: flex;
    gap: var(--spacing-md);
    flex-wrap: wrap;
    justify-content: center;
}

.trust-badges {
    display: flex;
    gap: var(--spacing-lg);
    margin-top: var(--spacing-xl);
    flex-wrap: wrap;
    justify-content: center;
}

.trust-badge {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.875rem;
}

.trust-badge-icon {
    width: 24px;
    height: 24px;
    background-color: var(--accent-green);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
}

/* ============================================
   CARDS
   ============================================ */
.card {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-normal);
    overflow: hidden;
}

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

.card-header {
    padding: var(--spacing-md);
    border-bottom: 1px solid var(--border-color);
}

.card-body {
    padding: var(--spacing-md);
}

/* Expertise cards: align h4 and p across cards (equal-height titles) */
.expertise-cards .card {
    display: flex;
    flex-direction: column;
}
.expertise-cards .card-body {
    display: flex;
    flex-direction: column;
    flex: 1;
}
.expertise-cards .card-body h4 {
    min-height: 2.6em;
    margin-bottom: var(--spacing-sm);
    display: flex;
    align-items: center;
    justify-content: center;
}
.expertise-cards .card-body p {
    flex: 1;
    margin-bottom: 0;
}

.card-footer {
    padding: var(--spacing-md);
    border-top: 1px solid var(--border-color);
    background-color: var(--light-gray);
}

/* ============================================
   GRID SYSTEM
   ============================================ */
.grid {
    display: grid;
    gap: var(--spacing-lg);
}

.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

/* ============================================
   FORMS
   ============================================ */
.form-group {
    margin-bottom: var(--spacing-md);
}

.form-label {
    display: block;
    margin-bottom: var(--spacing-xs);
    font-weight: 600;
    color: var(--text-dark);
}

.form-control {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 1rem;
    transition: all var(--transition-fast);
    font-family: var(--font-primary);
}

.form-control:focus {
    outline: none;
    border-color: var(--eu-blue);
    box-shadow: 0 0 0 3px rgba(0, 51, 153, 0.1);
}

textarea.form-control {
    resize: vertical;
    min-height: 120px;
}

select.form-control {
    cursor: pointer;
}

.form-text {
    font-size: 0.875rem;
    color: var(--text-light);
    margin-top: var(--spacing-xs);
}

/* ============================================
   FOOTER
   ============================================ */
.footer {
    background: linear-gradient(135deg, var(--primary-blue) 0%, var(--dark-blue) 100%);
    color: var(--white);
    padding: var(--spacing-2xl) 0 var(--spacing-md);
}

.footer-main {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--spacing-xl);
    margin-bottom: var(--spacing-xl);
}

.footer-logo-link {
    display: inline-block;
    margin-bottom: var(--spacing-sm);
}

.footer-logo-img {
    height: 48px;
    width: auto;
    display: block;
}

.footer-section h3.footer-heading,
.footer-section .footer-heading {
    color: var(--white);
    margin-bottom: var(--spacing-md);
    font-size: 1.125rem;
}

.footer-section ul {
    list-style: none;
}

.footer-section ul li {
    margin-bottom: var(--spacing-xs);
}

.footer-section p {
    color: rgba(255, 255, 255, 0.9);
}

.footer-section a {
    color: rgba(255, 255, 255, 0.9);
}

.footer-section a:hover {
    color: var(--accent-green);
}

.footer-bottom {
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    padding-top: var(--spacing-md);
    text-align: center;
    color: var(--white);
    font-size: 0.875rem;
}

.footer-bottom p {
    color: var(--white);
}

.footer-bottom a {
    color: var(--white);
}

/* ============================================
   UTILITIES
   ============================================ */
.text-center { text-align: center; }
.text-right { text-align: right; }
.mt-1 { margin-top: var(--spacing-xs); }
.mt-2 { margin-top: var(--spacing-sm); }
.mt-3 { margin-top: var(--spacing-md); }
.mt-4 { margin-top: var(--spacing-lg); }
.mb-1 { margin-bottom: var(--spacing-xs); }
.mb-2 { margin-bottom: var(--spacing-sm); }
.mb-3 { margin-bottom: var(--spacing-md); }
.mb-4 { margin-bottom: var(--spacing-lg); }

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 1024px) {
    .grid-4 { grid-template-columns: repeat(2, 1fr); }
    .footer-main { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
    html { font-size: 14px; }
    
    h1 { font-size: 2.5rem; }
    h2 { font-size: 2rem; }
    h3 { font-size: 1.5rem; }
    
    .hero h1 { font-size: 2.5rem; }
    
    .mobile-menu-toggle { display: block; }
    
    .nav-main ul {
        display: none;
        flex-direction: column;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background-color: var(--primary-blue);
        padding: var(--spacing-md);
    }
    
    .nav-main.active ul {
        display: flex;
    }
    
    .grid-2,
    .grid-3,
    .grid-4 {
        grid-template-columns: 1fr;
    }
    
    .footer-main {
        grid-template-columns: 1fr;
    }
    
    .hero-cta {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 var(--spacing-sm);
    }
    
    .section {
        padding: var(--spacing-lg) 0;
    }
}

/* Rich Text Content Styling */
.content h1,
.content h2,
.content h3,
.content h4,
.content h5,
.content h6 {
    margin: 1.5rem 0 1rem;
    color: var(--primary-blue);
}

.content h1 { font-size: 2rem; }
.content h2 { font-size: 1.75rem; }
.content h3 { font-size: 1.5rem; }
.content h4 { font-size: 1.25rem; }
.content h5 { font-size: 1.125rem; }
.content h6 { font-size: 1rem; }

.content p {
    margin-bottom: 1rem;
}

.content ul,
.content ol {
    margin-bottom: 1rem;
    padding-left: 2rem;
}

.content li {
    margin-bottom: 0.5rem;
}

.content a {
    color: var(--accent-green);
    text-decoration: underline;
}

.content a:hover {
    color: var(--secondary-green);
}

.content img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 1.5rem 0;
}

.content blockquote {
    border-left: 4px solid var(--accent-green);
    padding-left: 1.5rem;
    margin: 1.5rem 0;
    font-style: italic;
    color: var(--text-medium);
}

.content code {
    background-color: var(--light-gray);
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
}

.content pre {
    background-color: var(--light-gray);
    padding: 1rem;
    border-radius: 8px;
    overflow-x: auto;
    margin: 1.5rem 0;
}

.content pre code {
    background-color: transparent;
    padding: 0;
}

.content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
}

.content table th,
.content table td {
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    text-align: left;
}

.content table th {
    background-color: var(--light-gray);
    font-weight: 600;
    color: var(--primary-blue);
}

.content table tr:nth-child(even) {
    background-color: rgba(0, 0, 0, 0.02);
}

.content hr {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 2rem 0;
}

/* ============================================
   PRODUCTS TABLE
   ============================================ */
.products-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9375rem;
}

.products-table thead {
    background: linear-gradient(135deg, var(--primary-blue) 0%, var(--dark-blue) 100%);
    color: var(--white);
}

.products-table thead th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 2px solid var(--accent-green);
}

.products-table tbody tr {
    border-bottom: 1px solid var(--border-color);
    transition: background-color var(--transition-fast);
}

.products-table tbody tr:hover {
    background-color: var(--light-gray);
}

.products-table tbody td {
    padding: 1rem;
    vertical-align: middle;
}

.products-table tbody td:first-child {
    font-weight: 500;
}

/* Responsive table */
@media (max-width: 1024px) {
    .products-table {
        font-size: 0.875rem;
    }
    
    .products-table thead th,
    .products-table tbody td {
        padding: 0.75rem 0.5rem;
    }
}

@media (max-width: 768px) {
    /* Make grid single column on mobile */
    section .container > div[style*="grid-template-columns"] {
        display: block !important;
    }
    
    /* Make filters non-sticky on mobile */
    aside[style*="sticky"] {
        position: relative !important;
        top: auto !important;
        max-height: none !important;
        margin-bottom: 2rem;
    }
    
    .products-table thead {
        display: none;
    }
    
    .products-table tbody tr {
        display: block;
        margin-bottom: 1rem;
        border: 1px solid var(--border-color);
        border-radius: var(--radius-md);
        padding: 1rem;
        background: var(--white);
    }
    
    .products-table tbody td {
        display: block;
        padding: 0.5rem 0;
        text-align: left;
        border: none;
    }
    
    .products-table tbody td::before {
        content: attr(data-label);
        font-weight: 600;
        display: inline-block;
        margin-right: 0.5rem;
        color: var(--primary-blue);
    }
    
    .products-table tbody td:first-child::before {
        display: block;
        margin-bottom: 0.25rem;
    }
    
    .products-table tbody td:last-child {
        margin-top: 0.5rem;
    }
    
    .products-table tbody td:last-child .btn {
        width: 100%;
    }
}

/* ============================================
   MODAL / OVERLAY
   ============================================ */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 9999;
    animation: fadeIn 0.3s ease;
}

.modal-overlay.active {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal-content {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp 0.3s ease;
    position: relative;
}

.modal-header {
    background: linear-gradient(135deg, var(--primary-blue) 0%, var(--dark-blue) 100%);
    padding: 2rem;
    text-align: center;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    position: relative;
}

.modal-header h3 {
    color: var(--white);
    margin: 0;
    font-size: 1.75rem;
}

.modal-header p {
    color: rgba(255, 255, 255, 0.9);
    margin: 0.5rem 0 0 0;
    font-size: 0.95rem;
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: var(--white);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.5rem;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-fast);
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

.modal-body {
    padding: 2rem;
}

.modal-body .form-group {
    margin-bottom: 1.25rem;
}

.modal-body .form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text-dark);
    font-size: 0.95rem;
}

.modal-body .form-label .required {
    color: var(--error-red);
    margin-left: 0.25rem;
}

.modal-body .form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 1rem;
    transition: var(--transition-fast);
}

.modal-body .form-control:focus {
    outline: none;
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 3px rgba(11, 60, 93, 0.1);
}

.modal-body .form-helper {
    font-size: 0.875rem;
    color: var(--text-light);
    margin-top: 0.25rem;
}

.modal-footer {
    padding: 1.5rem 2rem;
    background-color: var(--light-gray);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    display: flex;
    gap: 1rem;
    align-items: center;
}

.modal-footer .btn {
    flex: 1;
}

#newsletterModalMessage {
    margin-top: 1rem;
    padding: 0.75rem;
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    text-align: center;
}

#newsletterModalMessage.success {
    background-color: rgba(0, 168, 107, 0.1);
    color: var(--success-green);
    border: 1px solid var(--success-green);
}

#newsletterModalMessage.error {
    background-color: rgba(211, 47, 47, 0.1);
    color: var(--error-red);
    border: 1px solid var(--error-red);
}

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

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

/* Blog posts grid - consistent layout with/without images */
.blog-posts-grid {
    display: grid;
    grid-template-columns: repeat(1, 1fr);
    gap: 2rem;
}

.blog-post-card {
    background: var(--white);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: box-shadow 0.2s ease;
}

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

.blog-post-card-link {
    display: block;
    text-decoration: none;
    color: inherit;
}

.blog-post-card-image {
    aspect-ratio: 16 / 9;
    background: var(--light-gray);
    overflow: hidden;
}

.blog-post-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.blog-post-card:hover .blog-post-card-image img {
    transform: scale(1.03);
}

.blog-post-card-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--light-gray);
    color: var(--text-light);
}

.blog-post-card-placeholder svg {
    opacity: 0.4;
}

.blog-post-card-body {
    padding: 1.5rem;
}

.blog-post-card-meta {
    font-size: 0.875rem;
    color: var(--text-light);
    margin-bottom: 0.75rem;
}

.blog-post-card-sep {
    margin: 0 0.35rem;
}

.blog-post-card-title {
    font-size: 1.35rem;
    margin: 0 0 0.75rem;
    line-height: 1.35;
    color: var(--primary-blue);
    transition: color 0.2s ease;
}

.blog-post-card:hover .blog-post-card-title {
    color: var(--accent-green);
}

.blog-post-card-excerpt {
    font-size: 1rem;
    color: var(--text-medium);
    line-height: 1.6;
    margin: 0 0 1rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.blog-post-card-cta {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--accent-green);
}

@media (min-width: 992px) {
    .blog-posts-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Mobile responsive */
@media (max-width: 768px) {
    .modal-content {
        margin: auto 1rem;
        max-height: 85vh;
    }
    
    .modal-header {
        padding: 1.5rem;
    }
    
    .modal-header h3 {
        font-size: 1.5rem;
    }
    
    .modal-body {
        padding: 1.5rem;
    }
    
    .modal-footer {
        flex-direction: column;
    }
    
    .modal-footer .btn {
        width: 100%;
    }
}
