/* ============================================================
   SERTİFİKALI FİRMALAR
   Üst: açıklama (sol) + arama (sağ), tablar üstte  ·  Tablo: ortak .dtable
   Detay: ortak .modal kabuğu + ince alan-ızgara tasarımı
   ============================================================ */

.cc-section {
    --cc-line: var(--neutral-E0E0E0);
    --cc-line-soft: #f3f3f3;
    --cc-smoke: #f7f6f5;
}

/* ---------- Üst alan (açıklama + arama) ---------- */

.cc-section .dtable-legend > p {
    margin: 0;
}

.cc-section .dtable-search {
    display: flex;
    flex-direction: column;
}

.cc-count {
    margin-top: .65rem;
    text-align: right;
    font-size: var(--df-text-fs-14);
    color: var(--neutral-666666);
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

    .cc-count b {
        color: var(--neutral-1A1818);
        font-weight: 600;
    }

/* ---------- Tablo (dtable ince ayarları) ---------- */

/* Sabit yerleşim: kolon genişlikleri sayfa değişince oynamaz, içerik alt satıra kırılır */
.cc-table {
    table-layout: fixed;
}

    .cc-table thead th,
    .cc-table tbody td {
        white-space: normal;
        word-break: break-word;
    }

    .cc-table tbody tr.cc-row {
        cursor: pointer;
    }

    .cc-table tbody tr.cc-row:focus-visible {
        outline: 2px solid var(--red-F8777E);
        outline-offset: -2px;
    }

.cc-cell-muted {
    color: var(--neutral-666666);
}

/* Kolon genişlikleri — firma listesi */
.cc-col-firma { width: 23%; }
.cc-col-no { width: 13%; }
.cc-col-durum { width: 12%; }
.cc-col-faaliyet { width: 16%; }
.cc-col-il { width: 10%; }
.cc-col-ilce { width: 11%; }
.cc-col-status { width: 15%; }

/* Kolon genişlikleri — performans raporu (8 kolon) */
.cc-perf-table .pc-gdf { width: 11%; }
.cc-perf-table .pc-firma { width: 21%; }
.cc-perf-table .pc-num { width: 13%; }

/* Uzun firma ünvanı sola hizalı okunur; sayı kolonları ortalı kalır */
.cc-perf-table thead th:nth-child(2),
.cc-perf-table tbody td:nth-child(2) {
    text-align: left;
}

/* Veri henüz yokken (ör. Yalova sekmesi) gösterilen mesaj kutusu */
.cc-soon {
    padding: clamp(3rem, 7vw, 5.5rem) 1.5rem;
    text-align: center;
    border: 1px solid var(--cc-line);
    border-radius: 4px;
    background: var(--neutral-FFFFFF);
    font-size: var(--df-text-fs-18);
    color: var(--neutral-666666);
}

/* Durum rozeti */
.cc-status {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    font-size: var(--df-text-fs-12);
    font-weight: 500;
    padding: .24rem .55rem;
    border-radius: 999px;
    white-space: nowrap;
}

    .cc-status .dot {
        width: 8px;
        height: 8px;
        border-radius: 50%;
        flex: none;
    }

    .cc-status.is-active {
        background: var(--red-FEECED);
        color: var(--red-980B12);
    }

        .cc-status.is-active .dot {
            background: var(--red-D11019);
            box-shadow: 0 0 0 3px var(--red-FCC5C8);
        }

    .cc-status.is-passive {
        background: var(--cc-smoke);
        color: var(--neutral-666666);
    }

        .cc-status.is-passive .dot {
            background: var(--neutral-858585);
            box-shadow: 0 0 0 3px #e9e9e9;
        }

/* ---------- Durum renkleri: yeşil (aktif) · sarı (vize/mühendis eksik) · gri (sertifika süresi dolmuş) · kırmızı (diğer) ---------- */
.cc-status--green {
    background: #E9F7EE;
    color: #1C7A3D;
}

    .cc-status--green .dot {
        background: #22A55A;
        box-shadow: 0 0 0 3px #BFE3CB;
    }

.cc-status--yellow {
    background: #FEF9C3;
    color: #854D0E;
}

    .cc-status--yellow .dot {
        background: #D9A400;
        box-shadow: 0 0 0 3px #FDE68A;
    }

.cc-status--gray {
    background: var(--cc-smoke);
    color: var(--neutral-666666);
}

    .cc-status--gray .dot {
        background: var(--neutral-858585);
        box-shadow: 0 0 0 3px #e9e9e9;
    }

.cc-status--red {
    background: var(--red-FEECED);
    color: var(--red-980B12);
}

    .cc-status--red .dot {
        background: var(--red-D11019);
        box-shadow: 0 0 0 3px var(--red-FCC5C8);
    }

/* ---------- Durum kutusu (yükleniyor / hata / boş) ---------- */

.cc-state {
    padding: 3.5rem 1.5rem;
    text-align: center;
    border: 1px solid var(--cc-line);
    border-top: none;
    border-radius: 0 0 4px 4px;
}

    .cc-state h3 {
        font-family: var(--font-display);
        font-weight: 600;
        font-size: 1.3rem;
        margin: 0 0 .4rem;
        color: var(--neutral-1A1818);
    }

    .cc-state p {
        margin: 0 0 1.25rem;
        color: var(--neutral-666666);
        font-size: var(--df-text-fs-16);
    }

    .cc-state button {
        font-family: var(--font-body);
        font-size: .9rem;
        font-weight: 500;
        color: var(--red-BF0D16);
        background: var(--red-FEECED);
        border: none;
        border-radius: 999px;
        padding: .55rem 1.1rem;
        cursor: pointer;
        transition: background var(--transition-fast);
    }

        .cc-state button:hover {
            background: var(--red-FCC5C8);
        }

.cc-spinner {
    width: 36px;
    height: 36px;
    margin: 0 auto 1.1rem;
    border: 3px solid var(--red-FCC5C8);
    border-top-color: var(--red-D11019);
    border-radius: 50%;
    animation: cc-spin .7s linear infinite;
}

@keyframes cc-spin {
    to { transform: rotate(360deg); }
}

.cc-state-icon {
    width: 46px;
    height: 46px;
    margin: 0 auto 1.1rem;
    display: grid;
    place-items: center;
    border-radius: 50%;
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1;
    background: var(--red-FEECED);
    color: var(--red-D11019);
    border: 1px solid var(--red-FCC5C8);
}

/* ---------- Sayfalama ---------- */

.cc-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .35rem;
    margin-top: 1.75rem;
    flex-wrap: wrap;
}

    .cc-pagination button {
        min-width: 38px;
        height: 38px;
        padding: 0 .65rem;
        border: 1px solid var(--cc-line);
        border-radius: 6px;
        background: var(--neutral-FFFFFF);
        color: var(--neutral-3D3D3D);
        font-family: var(--font-body);
        font-size: .88rem;
        font-weight: 500;
        cursor: pointer;
        line-height: 1;
        transition: all var(--transition-fast);
        font-variant-numeric: tabular-nums;
        display: flex;
        align-items: center;
        justify-content: center;
    }

        .cc-pagination button:hover:not(:disabled):not(.is-current) {
            border-color: var(--red-F8777E);
            color: var(--red-BF0D16);
            background: var(--red-FEECED);
        }

        .cc-pagination button.is-current {
            background: var(--neutral-1A1818);
            border-color: var(--neutral-1A1818);
            color: var(--neutral-FFFFFF);
            cursor: default;
        }

        .cc-pagination button:disabled {
            opacity: .4;
            cursor: not-allowed;
        }

    .cc-pagination .gap {
        color: var(--neutral-858585);
        padding: 0 .25rem;
        user-select: none;
    }

    .cc-pagination .nav {
        font-size: 1.05rem;
    }

/* ============================================================
   DETAY MODALI — ortak .modal kabuğu + ince tasarım
   ============================================================ */

.cc-modal .modal__dialog {
    display: flex;
    flex-direction: column;
    width: min(780px, 100%);
    max-height: 84vh;
}

.cc-modal .modal__wave {
    flex: none;
    height: clamp(14px, 1.6vw, 24px);
}

.cc-modal .modal__body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding: clamp(24px, 2.6vw, 40px) clamp(24px, 2.8vw, 46px);
    /* ince scrollbar */
    scrollbar-width: thin;
    scrollbar-color: var(--red-FA9EA3) transparent;
}

    .cc-modal .modal__body::-webkit-scrollbar {
        width: 6px;
    }

    .cc-modal .modal__body::-webkit-scrollbar-thumb {
        background: var(--red-FA9EA3);
        border-radius: 5rem;
    }

    .cc-modal .modal__body::-webkit-scrollbar-track {
        background: transparent;
    }

/* ---- Başlık ---- */

.cc-dhead {
    padding-bottom: clamp(16px, 1.6vw, 22px);
    border-bottom: 1px solid var(--cc-line);
}

.cc-dhead__top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .6rem 1rem;
    flex-wrap: wrap;
}

.cc-dhead__name {
    flex: 1 1 auto;
    min-width: 0;
    margin: 0;
    font-family: var(--font-display);
    font-weight: 600;
    font-size: clamp(1.3rem, 2.2vw, 1.6rem);
    line-height: 1.2;
    letter-spacing: -0.01em;
    color: var(--neutral-1A1818);
}

.cc-dhead__sector {
    margin: .55rem 0 0;
    font-size: var(--df-text-fs-16);
    color: var(--neutral-666666);
}

.cc-dhead__valid {
    display: inline-flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: .35rem .6rem;
    margin-top: .95rem;
    padding: .5rem .85rem;
    background: var(--red-FEECED);
    border-radius: 8px;
    font-size: var(--df-text-fs-14);
    color: var(--neutral-1A1818);
    font-weight: 500;
    font-variant-numeric: tabular-nums;
}

.cc-dhead__valid-k {
    font-size: var(--df-text-fs-12);
    text-transform: uppercase;
    letter-spacing: .08em;
    font-weight: 600;
    color: var(--red-BF0D16);
}

/* ---- Blok uyarısı ---- */

.cc-callout {
    display: flex;
    flex-direction: column;
    gap: .25rem;
    margin-top: clamp(18px, 1.8vw, 24px);
    padding: .9rem 1.05rem;
    background: var(--red-FEECED);
    border: 1px solid var(--red-FCC5C8);
    border-radius: 10px;
}

.cc-callout__label {
    font-size: var(--df-text-fs-12);
    font-weight: 600;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--red-980B12);
}

.cc-callout__reason {
    font-size: var(--df-text-fs-16);
    color: var(--neutral-1A1818);
}

.cc-callout__date {
    font-size: .82rem;
    color: var(--neutral-666666);
}

/* ---- Bölümler + alan ızgarası ---- */

/* Her bölüm ayrı bir kart: başlık bandı (gri + kırmızı vurgu) + alan ızgarası gövdesi */
.cc-dsection {
    margin-top: clamp(14px, 1.5vw, 20px);
    background: var(--neutral-FFFFFF);
    border: 1px solid var(--cc-line);
    border-radius: 12px;
    overflow: hidden;
}

.cc-dsection__title {
    display: flex;
    align-items: center;
    gap: .55rem;
    margin: 0;
    padding: .7rem clamp(16px, 1.6vw, 22px);
    background: var(--neutral-F5F5F5);
    border-bottom: 1px solid var(--cc-line);
    font-size: var(--df-text-fs-12);
    font-weight: 600;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--neutral-4E4E4E);
}

    .cc-dsection__title::before {
        content: "";
        flex: none;
        width: 4px;
        height: 13px;
        border-radius: 2px;
        background: var(--red-D11019);
    }

.cc-fields {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(215px, 1fr));
    gap: clamp(14px, 1.4vw, 18px) clamp(22px, 2.4vw, 36px);
    padding: clamp(16px, 1.7vw, 22px);
}

.cc-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.cc-field__k {
    font-size: 0.78rem;
    letter-spacing: .02em;
    color: var(--neutral-858585);
}

.cc-field__v {
    font-size: var(--df-text-fs-16);
    font-weight: 600;
    color: var(--neutral-1A1818);
    word-break: break-word;
}

    .cc-field__v a {
        color: var(--red-BF0D16);
        text-decoration: none;
        border-bottom: 1px solid var(--red-FCC5C8);
    }

        .cc-field__v a:hover {
            border-bottom-color: var(--red-BF0D16);
        }

@media (max-width: 420px) {
    .cc-fields {
        grid-template-columns: 1fr;
    }
}
