:root {
    --chem-primary: #0073aa;
    --chem-secondary: #005177;
    --chem-bg: #f8f9fa;
    --chem-card-bg: #ffffff;
    --chem-text: #333333;
    --chem-text-light: #666666;
    --chem-border: #e1e4e8;
    --chem-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    --chem-radius: 12px;
    --chem-accent: #eef2f7;
    --chem-icon-color: #475569;
    --chem-icon-bg: #f1f5f9;
}

.chemsearch-container {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    max-width: 1100px;
    margin: 40px auto;
    padding: 0 20px;
    color: var(--chem-text);
}

/* Header & Search Bar */
.chemsearch-header { text-align: center; margin-bottom: 40px; }

.chemsearch-search-wrapper {
    position: relative; max-width: 600px; margin: 0 auto; display: flex; align-items: center;
    background: var(--chem-card-bg); border: 2px solid var(--chem-border); border-radius: 50px;
    padding: 5px 10px; transition: all 0.3s ease; box-shadow: var(--chem-shadow);
}
.chemsearch-search-wrapper:focus-within { border-color: var(--chem-primary); box-shadow: 0 0 0 4px rgba(0, 115, 170, 0.1); }

#chemsearch-input { flex: 1; border: none; background: transparent; padding: 12px 20px; font-size: 18px; outline: none; color: var(--chem-text); }

#chemsearch-submit {
    background: var(--chem-primary); color: white; border: none; border-radius: 50%;
    width: 44px; height: 44px; display: flex; align-items: center; justify-content: center;
    cursor: pointer; transition: background 0.2s;
}
#chemsearch-submit:hover { background: var(--chem-secondary); }

/* Results Grid */
.chemsearch-results-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 25px; }
@media (max-width: 900px) { .chemsearch-results-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px) { .chemsearch-results-grid { grid-template-columns: 1fr; } .chemsearch-header { position: sticky; top: 10px; z-index: 100; } }

/* Result Card */
.chem-card {
    background: var(--chem-card-bg); border-radius: var(--chem-radius); border: 1px solid var(--chem-border);
    overflow: hidden; transition: transform 0.3s ease, box-shadow 0.3s ease; display: flex; flex-direction: column;
}
.chem-card:hover { transform: translateY(-5px); box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12); }
.chem-card-content { padding: 20px; flex-grow: 1; }
.chem-card-title { font-size: 18px; font-weight: 700; margin: 0 0 12px 0; color: var(--chem-primary); line-height: 1.3; }

/* Loader & Skeleton */
.chemsearch-loader { width: 100%; }
.skeleton-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 25px; }
.skeleton-card { height: 300px; background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%); background-size: 200% 100%; animation: skeleton-loading 1.5s infinite; border-radius: var(--chem-radius); }
@keyframes skeleton-loading { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* Error Message */
.chemsearch-error { text-align: center; padding: 40px; background: #fff5f5; color: #c53030; border-radius: var(--chem-radius); border: 1px solid #feb2b2; }

/* ========================================
   Modal
   ======================================== */
.chemsearch-modal {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.6); display: flex; align-items: center; justify-content: center;
    z-index: 2147483647 !important; backdrop-filter: blur(4px); padding: 16px; box-sizing: border-box;
}
.chemsearch-modal-content {
    background: white; padding: 32px; border-radius: 16px; max-width: 800px; width: 100%;
    max-height: calc(100vh - 32px); overflow-y: auto; position: relative;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2); -webkit-overflow-scrolling: touch;
}
.chemsearch-modal-close {
    position: absolute; top: 12px; right: 16px; font-size: 28px; cursor: pointer; color: #999;
    width: 40px; height: 40px; display: flex; align-items: center; justify-content: center;
    border-radius: 50%; transition: background 0.2s, color 0.2s; z-index: 10;
}
.chemsearch-modal-close:hover { background: #f1f5f9; color: #333; }

/* Modal Header Section */
.modal-header-section { text-align: center; margin-bottom: 24px; padding-bottom: 24px; border-bottom: 1px solid var(--chem-border); }
.modal-compound-image { max-width: 200px; height: auto; margin-bottom: 16px; }
.modal-compound-title { margin: 0; color: var(--chem-primary); font-size: 22px; font-weight: 700; line-height: 1.3; word-break: break-word; }

/* Modal Details Grid */
.modal-details-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; margin-bottom: 24px; }
.modal-detail-item { padding: 12px; background: var(--chem-accent); border-radius: 8px; }
.modal-detail-full { grid-column: 1 / -1; }
.modal-label { font-weight: 700; color: var(--chem-text-light); font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 6px; }
.modal-value { font-size: 15px; color: var(--chem-text); word-break: break-word; line-height: 1.4; }
.synonyms-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.synonym-item { background: white; padding: 4px 12px; border-radius: 20px; font-size: 13px; color: #495057; border: 1px solid var(--chem-border); }

/* External Link */
.modal-external-link { margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--chem-border); }
.pubchem-link { display: inline-flex; align-items: center; gap: 6px; color: var(--chem-primary); text-decoration: none; font-weight: 600; transition: color 0.2s; }
.pubchem-link:hover { color: var(--chem-secondary); }
.pubchem-link svg { flex-shrink: 0; }

/* ========================================
   Shared Section Styles
   ======================================== */
.section-title { font-size: 17px; font-weight: 700; margin: 0 0 20px 0; display: flex; align-items: center; gap: 10px; }
.section-title svg { flex-shrink: 0; }

.section-loading { min-height: 80px; display: flex; align-items: center; justify-content: center; }
.props-loader { display: flex; align-items: center; justify-content: center; gap: 12px; color: var(--chem-text-light); }
.props-spinner { width: 24px; height: 24px; border: 3px solid var(--chem-border); border-top-color: var(--chem-primary); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.props-error, .no-data-message { padding: 20px; text-align: center; color: var(--chem-text-light); background: #f8f9fa; border-radius: 8px; }

/* ========================================
   1. Physical Properties Section
   ======================================== */
.physical-props-section { margin-top: 24px; padding-top: 24px; border-top: 2px solid var(--chem-border); }
.physical-props-title { color: var(--chem-primary); }

.physical-props-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.prop-item {
    display: flex; align-items: flex-start; gap: 12px; padding: 14px;
    background: var(--chem-icon-bg); border-radius: 10px;
    transition: transform 0.2s ease, box-shadow 0.2s ease; border: 1px solid transparent;
}
.prop-item:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08); border-color: var(--chem-border); }
.prop-icon {
    width: 40px; height: 40px; border-radius: 10px; display: flex; align-items: center; justify-content: center;
    flex-shrink: 0; background: white; border: 1px solid var(--chem-border); box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
}
.prop-icon svg { width: 20px; height: 20px; }
.prop-details { flex: 1; min-width: 0; }
.prop-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; color: var(--chem-icon-color); margin-bottom: 4px; }
.prop-value { font-size: 14px; color: var(--chem-text); line-height: 1.4; word-break: break-word; }

/* ========================================
   2. Safety and Hazards Section
   ======================================== */
.safety-hazards-section { margin-top: 24px; padding-top: 24px; border-top: 2px solid var(--chem-border); }
.safety-hazards-title { color: #dc2626; }
.safety-content-wrapper { display: flex; flex-direction: column; gap: 20px; }
.safety-section { background: #fafafa; border-radius: 12px; overflow: hidden; border: 1px solid var(--chem-border); }
.safety-section-header { padding: 14px 18px; background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%); border-bottom: 1px solid var(--chem-border); }
.safety-section-title { font-size: 13px; font-weight: 700; color: var(--chem-text); text-transform: uppercase; letter-spacing: 0.5px; }
.safety-section-content { padding: 18px; }
.ghs-section .safety-section-header { background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%); }
.nfpa-section .safety-section-header { background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%); }

/* No Hazards */
.no-hazards-container { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 40px 20px; background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%); border-radius: 12px; border: 1px solid #86efac; }
.no-hazards-icon { margin-bottom: 16px; }
.no-hazards-text { font-size: 18px; font-weight: 700; color: #166534; margin-bottom: 8px; }
.no-hazards-subtext { font-size: 14px; color: #15803d; text-align: center; }

/* GHS Pictograms */
.ghs-pictograms { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 18px; justify-content: center; }
.ghs-pictogram { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.ghs-pictogram img { width: 56px; height: 56px; object-fit: contain; transition: transform 0.2s ease; }
.ghs-pictogram img:hover { transform: scale(1.1); }
.pictogram-label { font-size: 10px; color: var(--chem-text-light); text-align: center; max-width: 70px; line-height: 1.2; }

/* GHS Signal Word */
.ghs-signal-word { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: 8px; margin-bottom: 18px; }
.ghs-signal-word.signal-danger { background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%); border: 1px solid #fca5a5; }
.ghs-signal-word.signal-warning { background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%); border: 1px solid #fcd34d; }
.signal-label { font-size: 12px; font-weight: 600; color: var(--chem-text-light); }
.signal-value { font-size: 16px; font-weight: 800; text-transform: uppercase; letter-spacing: 1px; }
.signal-danger .signal-value { color: #dc2626; }
.signal-warning .signal-value { color: #d97706; }

/* GHS Hazard Statements */
.ghs-hazard-statements { background: white; border-radius: 10px; padding: 16px; border: 1px solid var(--chem-border); }
.hazard-statements-title { font-size: 12px; font-weight: 700; color: var(--chem-text-light); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 14px; }
.hazard-statements-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; max-height: 280px; overflow-y: auto; padding-right: 4px; }
.hazard-statement-item { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; background: #f8fafc; border-radius: 8px; border-left: 3px solid #ef4444; }
.hazard-code { font-size: 10px; font-weight: 700; color: white; background: #ef4444; padding: 3px 7px; border-radius: 4px; flex-shrink: 0; white-space: nowrap; }
.hazard-desc { font-size: 12px; color: var(--chem-text); line-height: 1.4; }

/* NFPA */
.nfpa-content-wrapper { display: flex; flex-direction: column; gap: 20px; }
.nfpa-diamond-container { display: flex; justify-content: center; }
.nfpa-diamond { width: 110px; height: 110px; position: relative; transform: rotate(45deg); }
.nfpa-quadrant { position: absolute; width: 50%; height: 50%; display: flex; align-items: center; justify-content: center; font-size: 22px; font-weight: 800; color: #000; border: 1px solid rgba(0,0,0,0.2); }
.nfpa-quadrant span { transform: rotate(-45deg); }
.nfpa-fire { top: 0; left: 0; background: #dc2626; color: white; border-radius: 4px 0 0 0; }
.nfpa-instability { top: 0; right: 0; background: #fbbf24; color: #000; border-radius: 0 4px 0 0; }
.nfpa-special { bottom: 0; right: 0; background: white; color: #000; border-radius: 0 0 4px 0; }
.nfpa-health { bottom: 0; left: 0; background: #2563eb; color: white; border-radius: 0 0 0 4px; }
.nfpa-ratings-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.nfpa-rating-item { display: flex; align-items: center; gap: 12px; padding: 12px; background: white; border-radius: 8px; border: 1px solid var(--chem-border); }
.nfpa-rating-badge { width: 36px; height: 36px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 16px; font-weight: 800; flex-shrink: 0; }
.nfpa-rating-health .nfpa-rating-badge { background: #2563eb; color: white; }
.nfpa-rating-fire .nfpa-rating-badge { background: #dc2626; color: white; }
.nfpa-rating-instability .nfpa-rating-badge { background: #fbbf24; color: #000; }
.nfpa-special-item .nfpa-rating-badge.special { background: #ffffff; color: #000; border: 2px solid #333; font-size: 11px; min-width: 36px; width: auto; padding: 0 8px; }
.nfpa-rating-info { flex: 1; min-width: 0; }
.nfpa-rating-label { font-size: 12px; font-weight: 700; color: var(--chem-text); margin-bottom: 2px; }
.nfpa-rating-desc { font-size: 11px; color: var(--chem-text-light); line-height: 1.3; }

/* ========================================
   3. Flammability & Explosivity Section
   ======================================== */
.flammability-section {
    margin-top: 24px; padding: 20px; border-radius: var(--chem-radius);
    background: linear-gradient(135deg, #fff7ed 0%, #ffedd5 100%); border: 1px solid #fed7aa;
}
.flammability-title { color: #c2410c; }
.flammability-title svg { stroke: #c2410c; }

/* ========================================
   4. Toxicity & Health Effects Section
   ======================================== */
.toxicity-section {
    margin-top: 24px; padding: 20px; border-radius: var(--chem-radius);
    background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%); border: 1px solid #fecaca;
}
.toxicity-title { color: #991b1b; }
.toxicity-title svg { stroke: #991b1b; }

.toxicity-item { margin-bottom: 0; }
.toxicity-label { font-weight: 700; }
.toxicity-value { line-height: 1.6; }
.info-meta { font-size: 11px; color: var(--chem-text-light); margin-top: 4px; font-style: italic; }

/* ========================================
   5. First Aid Measures Section
   ======================================== */
.first-aid-section {
    margin-top: 24px; padding: 20px; border-radius: var(--chem-radius);
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%); border: 1px solid #bbf7d0;
}
.first-aid-title { color: #166534 !important; }
.first-aid-title svg { stroke: #166534; }

.first-aid-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.first-aid-item { background: white; border-radius: 10px; padding: 16px; border: 1px solid #bbf7d0; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05); }
.first-aid-header { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; padding-bottom: 10px; border-bottom: 1px solid #dcfce7; }
.first-aid-icon { display: flex; align-items: center; justify-content: center; width: 36px; height: 36px; background: #dcfce7; border-radius: 8px; flex-shrink: 0; }
.first-aid-icon svg { stroke: #166534; }
.first-aid-label { font-weight: 600; font-size: 14px; color: #166534; }
.first-aid-text { font-size: 13px; line-height: 1.6; color: #374151; }

/* ========================================
   6. Personal Protection & PPE Section
   ======================================== */
.protection-section {
    margin-top: 24px; padding: 20px; border-radius: var(--chem-radius);
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%); border: 1px solid #bfdbfe;
}
.protection-title { color: #1e3a8a; }
.protection-title svg { stroke: #1e3a8a; }

/* ========================================
   7. Occupational Exposure Limits Section
   ======================================== */
.exposure-limits-section {
    margin-top: 24px; padding: 20px; border-radius: var(--chem-radius);
    background: linear-gradient(135deg, #eef2ff 0%, #e0e7ff 100%); border: 1px solid #c7d2fe;
}
.exposure-limits-title { color: #1e40af; }

.exposure-limits-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 15px; }
.exposure-limit-item { background: white; border-radius: 10px; padding: 15px; border: 1px solid #e0e7ff; transition: all 0.2s ease; }
.exposure-limit-item:hover { box-shadow: 0 4px 12px rgba(30, 64, 175, 0.1); transform: translateY(-2px); }
.exposure-limit-header { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 10px; }
.exposure-limit-icon { flex-shrink: 0; width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; background: #eff6ff; border-radius: 8px; border: 1px solid #bfdbfe; }
.exposure-limit-icon svg { width: 20px; height: 20px; stroke: #1e40af; }
.exposure-limit-labels { display: flex; flex-direction: column; gap: 2px; }
.exposure-limit-label { font-weight: 600; font-size: 14px; color: #1e40af; }
.exposure-limit-sublabel { font-size: 11px; color: #6b7280; line-height: 1.3; }
.exposure-limit-value { font-size: 13px; color: #374151; line-height: 1.5; padding-left: 46px; }

/* ========================================
   8. Storage & Handling Section
   ======================================== */
.storage-section {
    margin-top: 24px; padding: 20px; border-radius: var(--chem-radius);
    background: linear-gradient(135deg, #faf5ff 0%, #f3e8ff 100%); border: 1px solid #e9d5ff;
}
.storage-title { color: #6b21a8; }
.storage-title svg { stroke: #6b21a8; }

/* ========================================
   9. Cleanup & Disposal Section
   ======================================== */
.cleanup-section {
    margin-top: 24px; padding: 20px; border-radius: var(--chem-radius);
    background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%); border: 1px solid #fde68a;
}
.cleanup-title { color: #92400e; }
.cleanup-title svg { stroke: #92400e; }

/* ========================================
   10. Stability & Reactivity Section
   ======================================== */
.stability-section {
    margin-top: 24px; padding: 20px; border-radius: var(--chem-radius);
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%); border: 1px solid #e2e8f0;
}
.stability-title { color: #334155; }
.stability-title svg { stroke: #334155; }

/* ========================================
   Shared Info Blocks Grid (used by multiple sections)
   ======================================== */
.info-blocks-grid {
    display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px;
}
.info-block {
    background: white; border-radius: 10px; padding: 16px;
    border: 1px solid rgba(0,0,0,0.08); box-shadow: 0 2px 4px rgba(0,0,0,0.04);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.info-block:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.08); }

/* Info block type colors */
.info-block.type-fire { border-left: 4px solid #ef4444; }
.info-block.type-warning { border-left: 4px solid #f59e0b; }
.info-block.type-danger { border-left: 4px solid #dc2626; }
.info-block.type-info { border-left: 4px solid #3b82f6; }
.info-block.type-success { border-left: 4px solid #22c55e; }

.info-block .info-label,
.info-block .data-label {
    font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px;
    color: var(--chem-icon-color); margin-bottom: 8px;
}
.info-block .info-value,
.info-block .data-value {
    font-size: 13px; color: var(--chem-text); line-height: 1.6; word-break: break-word;
}

/* Full width info blocks for long content */
.info-block.full-width { grid-column: 1 / -1; }

/* ========================================
   Autocomplete Suggestions
   ======================================== */
.chemsearch-autocomplete {
    position: absolute; top: 100%; left: 0; right: 0; background: white;
    border: 1px solid var(--chem-border); border-top: none; border-radius: 0 0 12px 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12); max-height: 300px; overflow-y: auto; z-index: 1000;
}
.autocomplete-item { padding: 12px 20px; cursor: pointer; font-size: 15px; color: var(--chem-text); border-bottom: 1px solid #f1f5f9; transition: background 0.15s ease; }
.autocomplete-item:last-child { border-bottom: none; border-radius: 0 0 12px 12px; }
.autocomplete-item:hover, .autocomplete-item.selected { background: var(--chem-accent); }
.autocomplete-item.selected { background: #e0f2fe; }

/* ========================================
   Card Action Buttons (View English / عرض بالعربي)
   ======================================== */
.chem-card-actions {
    display: flex; gap: 0; border-top: 1px solid var(--chem-border);
}
.chem-btn {
    flex: 1; padding: 12px 16px; border: none; font-size: 14px; font-weight: 600;
    cursor: pointer; transition: all 0.2s ease; text-align: center;
}
.chem-btn-en {
    background: linear-gradient(135deg, #0073aa 0%, #005177 100%); color: white;
    border-radius: 0 0 0 var(--chem-radius);
}
.chem-btn-en:hover { background: linear-gradient(135deg, #005177 0%, #003d5c 100%); }
.chem-btn-ar {
    background: linear-gradient(135deg, #059669 0%, #047857 100%); color: white;
    border-radius: 0 0 var(--chem-radius) 0; font-family: 'Segoe UI', Tahoma, Arial, sans-serif;
}
.chem-btn-ar:hover { background: linear-gradient(135deg, #047857 0%, #065f46 100%); }

/* ========================================
   Language Switch Buttons in Modal
   ======================================== */
.modal-lang-switch {
    display: flex; justify-content: center; gap: 8px; margin-top: 16px; margin-bottom: 12px;
}
.lang-switch-btn {
    padding: 8px 20px; border: 2px solid var(--chem-border); background: white;
    border-radius: 20px; font-size: 13px; font-weight: 600; cursor: pointer;
    transition: all 0.2s ease; color: var(--chem-text);
}
.lang-switch-btn:hover { border-color: var(--chem-primary); color: var(--chem-primary); }
.lang-switch-btn.active {
    background: var(--chem-primary); color: white; border-color: var(--chem-primary);
}

/* ========================================
   PDF Buttons Group
   ======================================== */
.pdf-buttons-group {
    display: flex; justify-content: center; gap: 10px; margin-top: 12px; flex-wrap: wrap;
}
.pdf-btn-en {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%) !important;
}
.pdf-btn-ar {
    background: linear-gradient(135deg, #059669 0%, #047857 100%) !important;
    box-shadow: 0 2px 8px rgba(5, 150, 105, 0.3) !important;
}
.pdf-btn-ar:hover {
    box-shadow: 0 4px 12px rgba(5, 150, 105, 0.4) !important;
}
.pdf-btn-both {
    background: linear-gradient(135deg, #7c3aed 0%, #6d28d9 100%) !important;
    box-shadow: 0 2px 8px rgba(124, 58, 237, 0.3) !important;
}
.pdf-btn-both:hover {
    box-shadow: 0 4px 12px rgba(124, 58, 237, 0.4) !important;
}

/* ========================================
   RTL Support for Arabic
   ======================================== */
.lang-ar { direction: rtl; text-align: right; }
.lang-ar .prop-item { flex-direction: row-reverse; }
.lang-ar .prop-details { text-align: right; }
.lang-ar .first-aid-header { flex-direction: row-reverse; }
.lang-ar .first-aid-text { text-align: right; }
.lang-ar .exposure-limit-header { flex-direction: row-reverse; }
.lang-ar .exposure-limit-labels { text-align: right; }
.lang-ar .exposure-limit-value { padding-left: 0; padding-right: 46px; text-align: right; }
.lang-ar .nfpa-rating-item { flex-direction: row-reverse; }
.lang-ar .nfpa-rating-info { text-align: right; }
.lang-ar .info-block { text-align: right; }
.lang-ar .hazard-statement-item { flex-direction: row-reverse; border-left: none; border-right: 3px solid #ef4444; }
.lang-ar .hazard-desc { text-align: right; }
.lang-ar .modal-detail-item { text-align: right; }
.lang-ar .section-title { flex-direction: row-reverse; }
.lang-ar .ghs-signal-word { flex-direction: row-reverse; }
.lang-ar .chem-card-row { flex-direction: row-reverse; }
.lang-ar .toxicity-item { text-align: right; }
.lang-ar .info-meta { text-align: right; }

[dir="rtl"] .section-title { flex-direction: row-reverse; }
[dir="rtl"] .chemsearch-modal-close { right: auto; left: 16px; }
[dir="rtl"] .modal-header-section { text-align: center; }

/* ========================================
   Simplified Result Cards
   ======================================== */
.chem-card-clickable { cursor: pointer; }
.chem-card-clickable:hover { border-color: var(--chem-primary); }
.chem-card-clickable .chem-card-content { padding: 20px; }
.chem-card-clickable .chem-card-title { font-size: 16px; margin-bottom: 14px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.chem-card-info { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.chem-card-row { display: flex; align-items: baseline; gap: 8px; }
.chem-card-row .info-label { font-size: 12px; font-weight: 600; color: var(--chem-text-light); flex-shrink: 0; }
.chem-card-row .info-value { font-size: 14px; color: var(--chem-text); word-break: break-word; }
.chem-card-row .info-value.formula { font-family: 'Courier New', monospace; font-weight: 600; color: var(--chem-primary); }
.chem-card-synonyms { padding-top: 12px; border-top: 1px solid var(--chem-border); }
.chem-card-synonyms .synonyms-label { font-size: 11px; font-weight: 600; color: var(--chem-text-light); text-transform: uppercase; letter-spacing: 0.3px; display: block; margin-bottom: 6px; }
.chem-card-synonyms .synonyms-list { font-size: 12px; color: #64748b; line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* ========================================
   PDF Download Button
   ======================================== */
.pdf-download-btn {
    display: inline-flex; align-items: center; gap: 8px; padding: 10px 20px; margin-top: 16px;
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%); color: white; border: none;
    border-radius: 8px; font-size: 14px; font-weight: 600; cursor: pointer;
    transition: all 0.2s ease; box-shadow: 0 2px 8px rgba(220, 38, 38, 0.3);
}
.pdf-download-btn:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(220, 38, 38, 0.4); }
.pdf-download-btn:active { transform: translateY(0); }
.pdf-download-btn:disabled { opacity: 0.7; cursor: not-allowed; transform: none; }
.pdf-download-btn svg { flex-shrink: 0; }
.pdf-loading { display: inline-flex; align-items: center; gap: 8px; }
.pdf-loading::before { content: ''; width: 16px; height: 16px; border: 2px solid rgba(255, 255, 255, 0.3); border-top-color: white; border-radius: 50%; animation: spin 0.8s linear infinite; }

/* ========================================
   Mobile Responsive Styles
   ======================================== */
@media (max-width: 768px) {
    .chemsearch-modal { padding: 12px; }
    .chemsearch-modal-content { padding: 20px; border-radius: 12px; max-height: calc(100vh - 24px); }
    .chemsearch-modal-close { top: 8px; right: 12px; font-size: 24px; width: 36px; height: 36px; }
    .modal-compound-image { max-width: 160px; }
    .modal-compound-title { font-size: 18px; }
    .modal-details-grid { gap: 12px; }
    .modal-detail-item { padding: 10px; }
    .section-title { font-size: 15px; }
    .exposure-limits-grid { grid-template-columns: 1fr; }
    .exposure-limit-value { padding-left: 0; margin-top: 8px; }
    .info-blocks-grid { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
    .chemsearch-modal { padding: 8px; align-items: flex-end; }
    .chemsearch-modal-content { padding: 20px 16px; border-radius: 16px 16px 0 0; max-height: calc(100vh - 16px); margin-bottom: 0; }
    .modal-header-section { margin-bottom: 20px; padding-bottom: 20px; }
    .modal-compound-image { max-width: 140px; }
    .modal-compound-title { font-size: 16px; }
    .modal-details-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .modal-detail-item { padding: 10px; }
    .modal-label { font-size: 10px; }
    .modal-value { font-size: 13px; }
    .physical-props-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .prop-item { padding: 10px; gap: 10px; }
    .prop-icon { width: 36px; height: 36px; border-radius: 8px; }
    .prop-icon svg { width: 18px; height: 18px; }
    .prop-label { font-size: 10px; }
    .prop-value { font-size: 12px; }
    .section-title { font-size: 14px; gap: 8px; }
    .section-title svg { width: 18px; height: 18px; }
    .safety-section-content { padding: 14px; }
    .ghs-pictogram img { width: 48px; height: 48px; }
    .pictogram-label { font-size: 9px; }
    .ghs-signal-word { padding: 10px 14px; flex-wrap: wrap; }
    .hazard-statements-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; max-height: 200px; }
    .hazard-statement-item { padding: 8px 10px; flex-direction: column; gap: 6px; }
    .hazard-code { font-size: 9px; padding: 2px 6px; }
    .hazard-desc { font-size: 11px; }
    .nfpa-diamond { width: 90px; height: 90px; }
    .nfpa-quadrant { font-size: 18px; }
    .nfpa-ratings-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
    .nfpa-rating-item { padding: 10px; gap: 10px; }
    .nfpa-rating-badge { width: 32px; height: 32px; font-size: 14px; }
    .nfpa-rating-label { font-size: 11px; }
    .nfpa-rating-desc { font-size: 10px; }
    .synonym-item { padding: 3px 10px; font-size: 12px; }
    .no-hazards-container { padding: 30px 16px; }
    .no-hazards-icon svg { width: 40px; height: 40px; }
    .no-hazards-text { font-size: 16px; }
    .no-hazards-subtext { font-size: 13px; }
    .first-aid-grid { grid-template-columns: 1fr; }
    .first-aid-section { padding: 16px; }
    .first-aid-item { padding: 14px; }
    .first-aid-text { font-size: 12px; }
    .pdf-download-btn { width: 100%; justify-content: center; padding: 12px 16px; font-size: 12px; }
    .pdf-buttons-group { flex-direction: column; gap: 8px; }
    .chem-btn { padding: 10px 12px; font-size: 13px; }
    .flammability-section, .toxicity-section, .protection-section, .storage-section, .cleanup-section, .stability-section { padding: 16px; }
    .info-blocks-grid { grid-template-columns: 1fr; gap: 10px; }
    .info-block { padding: 14px; }
}

/* Extra small screens */
@media (max-width: 380px) {
    .chemsearch-modal-content { padding: 16px 12px; }
    .modal-details-grid { grid-template-columns: 1fr; }
    .physical-props-grid { grid-template-columns: 1fr; }
    .hazard-statements-grid { grid-template-columns: 1fr; }
    .nfpa-ratings-grid { grid-template-columns: 1fr; }
}

/* Scrollbar styling */
.hazard-statements-grid::-webkit-scrollbar { width: 6px; }
.hazard-statements-grid::-webkit-scrollbar-track { background: #f1f5f9; border-radius: 3px; }
.hazard-statements-grid::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
.hazard-statements-grid::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* Touch-friendly improvements */
@media (hover: none) and (pointer: coarse) {
    .prop-item:hover { transform: none; box-shadow: none; }
    .ghs-pictogram img:hover { transform: none; }
    .chemsearch-modal-close { width: 44px; height: 44px; }
    .info-block:hover { transform: none; box-shadow: 0 2px 4px rgba(0,0,0,0.04); }
    .exposure-limit-item:hover { transform: none; box-shadow: none; }
}
