/* ============================================
   Safety Data Sheets — Front-end Styles
   ============================================ */

.sds-container {
    max-width: 960px;
    margin: 0 auto;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, sans-serif;
    color: #1a1a2e;
}

/* ── Search ─────────────────────────────────── */

.sds-search-wrap {
    margin-bottom: 20px;
}

.sds-search-inner {
    position: relative;
    display: flex;
    align-items: center;
}

.sds-search-icon {
    position: absolute;
    left: 16px;
    width: 20px;
    height: 20px;
    color: #94a3b8;
    pointer-events: none;
}

.sds-search-input {
    width: 100%;
    padding: 14px 44px 14px 52px !important;
    font-size: 15px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    background: #f8fafc;
    transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
    outline: none;
}

.sds-search-input:focus {
    border-color: #3b82f6;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.sds-search-input::placeholder {
    color: #94a3b8;
}

.sds-search-clear {
    position: absolute;
    right: 12px;
    background: none;
    border: none;
    font-size: 22px;
    color: #94a3b8;
    cursor: pointer;
    padding: 4px 8px;
    line-height: 1;
    border-radius: 4px;
    transition: color 0.15s, background 0.15s;
}

.sds-search-clear:hover {
    color: #475569;
    background: #e2e8f0;
}

/* ── Alphabet Bar ───────────────────────────── */

.sds-alpha-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 16px;
    padding: 12px 0;
    border-bottom: 1px solid #e2e8f0;
}

.sds-alpha-btn {
    min-width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 600;
    color: #475569;
    background: #f1f5f9;
    border: 1px solid transparent;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s;
    padding: 0 6px;
}

.sds-alpha-btn:hover:not(.disabled) {
    background: #e2e8f0;
    color: #1e293b;
}

.sds-alpha-btn.active {
    background: #1e40af;
    color: #fff;
    border-color: #1e40af;
}

.sds-alpha-btn.disabled {
    color: #cbd5e1;
    background: #f8fafc;
    cursor: default;
}

/* ── Results Count ──────────────────────────── */

.sds-results-bar {
    font-size: 14px;
    color: #64748b;
    margin-bottom: 16px;
    padding: 0 4px;
}

#sds-results-count {
    font-weight: 700;
    color: #1e293b;
}

/* ── Letter Group Heading ───────────────────── */

.sds-letter-group {
    margin-bottom: 8px;
}

.sds-letter-heading {
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #94a3b8;
    padding: 10px 16px 6px;
    position: sticky;
    top: 0;
    background: #fff;
    z-index: 2;
    border-bottom: 1px solid #f1f5f9;
}

/* ── Individual Sheet Item ──────────────────── */

.sds-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 16px;
    border-radius: 8px;
    transition: background 0.15s;
}

.sds-item:hover {
    background: #f8fafc;
}

.sds-item-main {
    display: flex;
    align-items: center;
    gap: 14px;
    flex: 1;
    min-width: 0;
}

.sds-item-icon {
    flex-shrink: 0;
    width: 32px;
    height: 40px;
}

.sds-item-icon svg {
    width: 100%;
    height: 100%;
}

.sds-item-content {
    flex: 1;
    min-width: 0;
}

.sds-item-title {
    display: block;
    font-size: 15px;
    font-weight: 500;
    color: #1e293b;
    text-decoration: none;
    line-height: 1.4;
    transition: color 0.15s;
    word-break: break-word;
}

.sds-item-title:hover {
    color: #2563eb;
}

.sds-material-num {
    font-weight: 700;
    color: #475569;
    margin-right: 6px;
}

.sds-version {
    font-size: 13px;
    color: #94a3b8;
    font-weight: 400;
    margin-left: 6px;
}

/* ── Meta Tags (dates, size) ────────────────── */

.sds-item-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 6px;
}

.sds-meta-tag {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 12.5px;
    color: #64748b;
    line-height: 1;
}

.sds-meta-tag svg {
    flex-shrink: 0;
    color: #94a3b8;
}

/* ── Status Badges ──────────────────────────── */

.sds-status-badge {
    display: inline-block;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 2px 7px;
    border-radius: 4px;
    margin-left: 4px;
    line-height: 1.3;
}

.sds-badge-current {
    background: #dcfce7;
    color: #166534;
}

.sds-badge-expiring {
    background: #fef3c7;
    color: #92400e;
}

.sds-badge-expired {
    background: #fee2e2;
    color: #991b1b;
}

.sds-status-expired {
    color: #991b1b;
}

.sds-status-expired svg {
    color: #ef4444;
}

.sds-status-expiring {
    color: #92400e;
}

.sds-status-expiring svg {
    color: #f59e0b;
}

/* ── Download Button ────────────────────────── */

.sds-download-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 600;
    color: #2563eb;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 6px;
    text-decoration: none;
    white-space: nowrap;
    transition: all 0.15s;
    flex-shrink: 0;
}

.sds-download-btn:hover {
    background: #2563eb;
    color: #fff;
    border-color: #2563eb;
}

.sds-download-btn:hover svg {
    stroke: #fff;
}

/* ── No Results ─────────────────────────────── */

.sds-no-results {
    text-align: center;
    padding: 48px 24px;
    color: #94a3b8;
}

.sds-no-results svg {
    margin-bottom: 12px;
    color: #cbd5e1;
}

.sds-no-results p {
    font-size: 16px;
    margin: 0 0 16px;
}

.sds-clear-btn {
    display: inline-flex;
    align-items: center;
    padding: 8px 20px;
    font-size: 14px;
    font-weight: 600;
    color: #2563eb;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s;
}

.sds-clear-btn:hover {
    background: #2563eb;
    color: #fff;
}

/* ── Empty State ────────────────────────────── */

.sds-empty {
    text-align: center;
    padding: 40px;
    color: #94a3b8;
    font-size: 15px;
}

/* ── Hidden helper ──────────────────────────── */

.sds-hidden {
    display: none !important;
}

/* ── Responsive ─────────────────────────────── */

@media (max-width: 640px) {
    .sds-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .sds-download-btn {
        width: 100%;
        justify-content: center;
    }

    .sds-alpha-bar {
        gap: 3px;
    }

    .sds-alpha-btn {
        min-width: 28px;
        height: 28px;
        font-size: 11px;
    }

    .sds-item-meta {
        flex-direction: column;
        gap: 6px;
    }
}
