/**
 * Environmental Green Score Styles
 *
 * Green Score badges, component breakdown bars, FOE grade displays,
 * ship profile environmental tab, and environmental rankings page.
 */

/* ── CSS Variables ── */
:root {
    --stcdb-env-green: #0d9e3f;
    --stcdb-env-yellow: #f5c518;
    --stcdb-env-orange: #f57c23;
    --stcdb-env-red: #c62828;
    --stcdb-env-gray: #9ca3af;
}

/* ══════════════════════════════════════════
   GREEN SCORE BADGE
   ══════════════════════════════════════════ */

.stcdb-env-badge {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border: 3px solid;
    border-radius: 50%;
    text-align: center;
    background: #fff;
}

.stcdb-env-badge--large {
    width: 140px;
    height: 140px;
    padding: 16px;
}

.stcdb-env-badge--medium {
    width: 100px;
    height: 100px;
    padding: 10px;
}

.stcdb-env-badge--small {
    width: 60px;
    height: 60px;
    padding: 6px;
    border-width: 2px;
}

.stcdb-env-badge--nodata {
    border-color: #d1d5db;
    border-style: dashed;
}

.stcdb-env-badge-grade {
    font-weight: 800;
    line-height: 1;
}

.stcdb-env-badge--large .stcdb-env-badge-grade {
    font-size: 2.5rem;
}

.stcdb-env-badge--medium .stcdb-env-badge-grade {
    font-size: 1.75rem;
}

.stcdb-env-badge--small .stcdb-env-badge-grade {
    font-size: 1.1rem;
}

.stcdb-env-badge-score {
    font-size: 0.75rem;
    font-weight: 600;
    color: #374151;
    margin-top: 2px;
    line-height: 1;
}

.stcdb-env-badge--small .stcdb-env-badge-score {
    font-size: 0.55rem;
    margin-top: 1px;
}

.stcdb-env-badge-label {
    font-size: 0.7rem;
    font-weight: 600;
    color: #374151;
    margin-top: 4px;
}

.stcdb-env-badge--small .stcdb-env-badge-label {
    font-size: 0.55rem;
    margin-top: 2px;
}

.stcdb-env-badge-subtitle {
    font-size: 0.65rem;
    color: #9ca3af;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 2px;
}

.stcdb-env-badge--small .stcdb-env-badge-subtitle,
.stcdb-env-badge--medium .stcdb-env-badge-subtitle {
    display: none;
}

.stcdb-env-badge--nodata .stcdb-env-badge-grade {
    color: #9ca3af;
}

.stcdb-env-badge--nodata .stcdb-env-badge-score {
    color: #9ca3af;
}

/* ══════════════════════════════════════════
   COMPONENT BREAKDOWN BARS
   ══════════════════════════════════════════ */

.stcdb-env-breakdown {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.stcdb-env-breakdown-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.stcdb-env-breakdown-label {
    width: 160px;
    flex-shrink: 0;
    display: flex;
    justify-content: space-between;
    gap: 4px;
}

.stcdb-env-breakdown-name {
    font-size: 0.85rem;
    font-weight: 500;
    color: #374151;
}

.stcdb-env-breakdown-weight {
    font-size: 0.75rem;
    color: #9ca3af;
}

.stcdb-env-breakdown-bar-wrap {
    flex: 1;
    height: 8px;
    background: #f3f4f6;
    border-radius: 4px;
    overflow: hidden;
}

.stcdb-env-breakdown-bar {
    height: 100%;
    border-radius: 4px;
    transition: width 0.6s ease;
    min-width: 2px;
}

.stcdb-env-breakdown-value {
    width: 36px;
    text-align: right;
    font-size: 0.85rem;
    font-weight: 700;
    flex-shrink: 0;
}

@media (max-width: 640px) {
    .stcdb-env-breakdown-label {
        width: 120px;
    }
    .stcdb-env-breakdown-name {
        font-size: 0.78rem;
    }
}

/* ══════════════════════════════════════════
   FOE GRADES
   ══════════════════════════════════════════ */

.stcdb-env-foe-grades {
    margin-top: 20px;
    margin-bottom: 20px;
}

.stcdb-env-foe-overall {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    padding: 12px 16px;
    background: #f9fafb;
    border-radius: 10px;
    border: 1px solid #e5e7eb;
}

.stcdb-env-foe-overall-label {
    font-size: 0.92rem;
    font-weight: 600;
    color: #374151;
}

.stcdb-env-foe-overall-grade {
    font-size: 1.8rem;
    font-weight: 800;
    line-height: 1;
}

.stcdb-env-foe-categories {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}

.stcdb-env-foe-category {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 12px 8px;
    background: #f9fafb;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
    text-align: center;
}

.stcdb-env-foe-cat-label {
    font-size: 0.75rem;
    color: #6b7280;
    font-weight: 500;
    line-height: 1.3;
}

.stcdb-env-foe-cat-grade {
    font-size: 1.3rem;
    font-weight: 800;
    line-height: 1;
}

/* ══════════════════════════════════════════
   SHIP PROFILE ENVIRONMENTAL TAB
   ══════════════════════════════════════════ */

.stcdb-env-profile-header {
    display: flex;
    align-items: flex-start;
    gap: 24px;
    margin-bottom: 24px;
}

.stcdb-env-profile-summary {
    flex: 1;
    font-size: 0.92rem;
    color: #374151;
    line-height: 1.7;
}

.stcdb-env-profile-summary p {
    margin: 0 0 10px;
}

.stcdb-env-data-year {
    font-size: 0.82rem;
    color: #6b7280;
    font-weight: 500;
    margin-bottom: 8px;
}

.stcdb-env-clean-record {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    border-radius: 8px;
    color: #065f46;
    font-size: 0.88rem;
    font-weight: 600;
    margin-bottom: 16px;
}

.stcdb-env-methodology-link {
    text-align: center;
    margin-top: 24px;
    padding: 16px;
    background: #f9fafb;
    border-radius: 10px;
    border: 1px solid #e5e7eb;
}

.stcdb-env-methodology-link a {
    color: #0077B6;
    text-decoration: none;
    font-size: 0.88rem;
    font-weight: 600;
}

.stcdb-env-methodology-link a:hover {
    text-decoration: underline;
}

.stcdb-env-empty {
    color: var(--stcdb-env-gray);
    font-style: italic;
    font-size: 0.9rem;
}

/* ══════════════════════════════════════════
   ENVIRONMENTAL RANKINGS TABLE
   ══════════════════════════════════════════ */

.stcdb-env-rankings-wrapper {
    max-width: 1100px;
    margin: 0 auto;
    padding: 24px 16px 60px;
}

.stcdb-env-rankings-header {
    margin-bottom: 24px;
}

.stcdb-env-rankings-header h1 {
    font-size: 1.6rem;
    font-weight: 800;
    color: #023E73;
    margin: 0 0 8px;
}

.stcdb-env-rankings-header p {
    font-size: 0.95rem;
    color: #6b7280;
    margin: 0 0 16px;
}

.stcdb-env-rankings-filter {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.stcdb-env-rankings-filter label {
    font-size: 0.85rem;
    font-weight: 600;
    color: #374151;
}

.stcdb-env-rankings-filter select {
    padding: 6px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.85rem;
    background: #fff;
}

.stcdb-env-rankings-table-wrap {
    overflow-x: auto;
}

.stcdb-env-rankings-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}

.stcdb-env-rankings-table thead th {
    text-align: left;
    padding: 10px 12px;
    font-weight: 700;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #6b7280;
    border-bottom: 2px solid #e5e7eb;
    cursor: pointer;
    white-space: nowrap;
    user-select: none;
    position: sticky;
    top: 0;
    background: #fff;
}

.stcdb-env-rankings-table thead th:hover {
    color: #0077B6;
}

.stcdb-env-rankings-table thead th.is-sorted {
    color: #0077B6;
}

.stcdb-env-rankings-table tbody td {
    padding: 10px 12px;
    border-bottom: 1px solid #f3f4f6;
    vertical-align: middle;
}

.stcdb-env-rankings-table tbody tr:hover {
    background: #f9fafb;
}

.stcdb-env-rankings-table .stcdb-env-cell-ship a {
    color: #0077B6;
    text-decoration: none;
    font-weight: 600;
}

.stcdb-env-rankings-table .stcdb-env-cell-ship a:hover {
    text-decoration: underline;
}

.stcdb-env-rankings-table .stcdb-env-cell-line {
    font-size: 0.82rem;
    color: #6b7280;
}

.stcdb-env-rankings-table .stcdb-env-cell-score {
    font-weight: 700;
    border-radius: 4px;
    padding: 2px 8px;
    display: inline-block;
    min-width: 32px;
    text-align: center;
}

.stcdb-env-rankings-table .stcdb-env-cell-grade {
    font-weight: 800;
    font-size: 0.92rem;
    display: inline-block;
    min-width: 28px;
    text-align: center;
}

/* ══════════════════════════════════════════
   FLEET ENVIRONMENTAL TABLE (dossier page)
   ══════════════════════════════════════════ */

.stcdb-dossier-fleet-env-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
    margin-top: 12px;
}

.stcdb-dossier-fleet-env-table thead th {
    text-align: left;
    padding: 8px 10px;
    font-weight: 700;
    font-size: 0.76rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #6b7280;
    border-bottom: 2px solid #e5e7eb;
}

.stcdb-dossier-fleet-env-table tbody td {
    padding: 8px 10px;
    border-bottom: 1px solid #f3f4f6;
}

.stcdb-dossier-fleet-env-table tbody tr:hover {
    background: #f9fafb;
}

.stcdb-dossier-fleet-env-table a {
    color: #0077B6;
    text-decoration: none;
    font-weight: 500;
}

.stcdb-dossier-fleet-env-table a:hover {
    text-decoration: underline;
}

/* ══════════════════════════════════════════
   MOBILE RESPONSIVE
   ══════════════════════════════════════════ */

@media (max-width: 768px) {
    .stcdb-env-rankings-table {
        font-size: 0.8rem;
    }
    .stcdb-env-rankings-table thead th,
    .stcdb-env-rankings-table tbody td {
        padding: 8px 6px;
    }
    /* Hide MRV/FOE/PSIX detail columns on mobile */
    .stcdb-env-rankings-table .stcdb-env-col-detail {
        display: none;
    }
    .stcdb-env-foe-categories {
        grid-template-columns: 1fr 1fr;
    }
    .stcdb-env-profile-header {
        flex-direction: column;
        align-items: center;
    }
    .stcdb-env-profile-summary {
        text-align: center;
    }
    .stcdb-env-badge {
        margin: 0 auto;
    }
}

@media (max-width: 640px) {
    .stcdb-env-foe-overall {
        flex-direction: column;
        text-align: center;
        gap: 8px;
    }
    .stcdb-env-foe-categories {
        gap: 8px;
    }
    .stcdb-env-foe-category {
        padding: 10px 6px;
    }
    .stcdb-env-foe-cat-label {
        font-size: 0.7rem;
    }
    .stcdb-env-foe-cat-grade {
        font-size: 1.1rem;
    }
    .stcdb-env-rankings-header h1 {
        font-size: 1.3rem;
    }
}
