/* Company profile page (templates/jobs/company_detail.html) */
.cp-page {
    --cp-bg: var(--jobs-card-bg, #fff);
    --cp-border: var(--jobs-card-border, #e2e8f0);
    --cp-text: var(--jobs-text-main, #1e293b);
    --cp-muted: var(--jobs-text-muted, #64748b);
    --cp-surface: var(--jobs-surface-bg, #f8fafc);
    --cp-primary: var(--jobs-primary, #176b5b);
}

/* Hero */
.cp-hero {
    background: var(--cp-bg);
    border: 1px solid var(--cp-border);
    border-radius: 20px;
    overflow: hidden;
}

.cp-cover {
    height: 190px;
    background: linear-gradient(135deg, #372346 0%, #4b315e 50%, #176b5b 100%);
}

.cp-cover img { width: 100%; height: 100%; object-fit: cover; }

.cp-hero-body {
    display: flex;
    align-items: flex-end;
    flex-wrap: wrap;
    gap: 16px;
    padding: 0 28px 22px;
}

.cp-logo {
    width: 104px;
    height: 104px;
    margin-top: -52px;
    flex-shrink: 0;
    border-radius: 24px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--cp-bg);
    border: 4px solid var(--cp-bg);
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.14);
    color: var(--cp-primary);
    font-size: 2.4rem;
    font-weight: 800;
}

.cp-logo img { width: 100%; height: 100%; object-fit: cover; }

.cp-identity { flex: 1; min-width: 220px; padding-top: 12px; }

.cp-name {
    margin: 0;
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--cp-text);
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.cp-verified { color: #0284c7; font-size: 1.1rem; }

.cp-subline {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 18px;
    margin-top: 6px;
    font-size: 0.88rem;
    color: var(--cp-muted);
}

.cp-subline i { color: var(--cp-primary); margin-inline-end: 6px; }

.cp-invite-btn {
    border: 0;
    border-radius: 999px;
    padding: 10px 22px;
    background: var(--cp-primary);
    color: #fff;
    font-weight: 700;
    font-size: 0.9rem;
    transition: opacity 0.2s;
}

.cp-invite-btn:hover { opacity: 0.88; }

/* Stats strip */
.cp-stats {
    display: flex;
    flex-wrap: wrap;
    border-top: 1px solid var(--cp-border);
    background: var(--cp-surface);
}

.cp-stat {
    flex: 1 1 120px;
    padding: 14px 12px;
    text-align: center;
    border-inline-end: 1px solid var(--cp-border);
}

.cp-stat:last-child { border-inline-end: 0; }
.cp-stat strong { display: block; font-size: 1.25rem; font-weight: 800; color: var(--cp-text); }
.cp-stat span { font-size: 0.78rem; color: var(--cp-muted); }

/* Sections */
.cp-section {
    background: var(--cp-bg);
    border: 1px solid var(--cp-border);
    border-radius: 18px;
    padding: 22px;
    margin-bottom: 20px;
}

.cp-section-title {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 16px;
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--cp-text);
}

.cp-section-title > i {
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    background: rgba(23, 107, 91, 0.1);
    color: var(--cp-primary);
    font-size: 0.85rem;
}

.cp-count {
    margin-inline-start: auto;
    padding: 2px 12px;
    border-radius: 999px;
    background: var(--cp-primary);
    color: #fff;
    font-size: 0.78rem;
}

.cp-about { margin: 0; line-height: 1.9; color: var(--cp-muted); white-space: pre-line; }
.cp-empty { margin: 0; font-size: 0.9rem; color: var(--cp-muted); }

.cp-tech + .cp-tech { margin-top: 12px; }
.cp-tech-label { display: block; margin-bottom: 6px; font-size: 0.8rem; font-weight: 700; color: var(--cp-muted); }

.cp-chip {
    display: inline-block;
    padding: 6px 14px;
    border-radius: 10px;
    background: var(--cp-surface);
    border: 1px solid var(--cp-border);
    color: var(--cp-text);
    font-size: 0.85rem;
}

/* Reviews */
.cp-reviews { display: flex; flex-direction: column; gap: 10px; }
.cp-review { padding: 14px; border-radius: 12px; background: var(--cp-surface); }
.cp-review-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; font-size: 0.9rem; color: var(--cp-text); }
.cp-stars { color: #f59e0b; }
.cp-review p { margin: 0; font-size: 0.85rem; color: var(--cp-muted); }
.cp-review-project { font-size: 0.85rem; font-weight: 700; margin-bottom: 4px; color: var(--cp-text); overflow-wrap: anywhere; }
.cp-review-project i { color: var(--cp-primary); margin-inline-end: 6px; }
.cp-review-project a { color: var(--cp-primary); text-decoration: none; }
.cp-review-project a:hover { text-decoration: underline; }

/* Sidebar */
.cp-side { position: sticky; top: 90px; }

.cp-row {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    padding-bottom: 12px;
    margin-bottom: 12px;
    border-bottom: 1px solid var(--cp-border);
    font-size: 0.85rem;
}

.cp-row span { color: var(--cp-muted); }
.cp-row strong { color: var(--cp-text); text-align: end; }

.cp-contacts { display: flex; flex-direction: column; gap: 8px; }

.cp-contact {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 12px;
    background: var(--cp-surface);
    color: var(--cp-text);
    font-size: 0.86rem;
    font-weight: 600;
    text-decoration: none;
    min-width: 0;
}

.cp-contact i { color: var(--cp-primary); width: 18px; text-align: center; flex-shrink: 0; }
.cp-contact span { flex: 1; text-align: start; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
a.cp-contact:hover { background: rgba(23, 107, 91, 0.1); color: var(--cp-primary); }
.cp-contact--wa i { color: #25d366; }

.cp-locked { text-align: center; padding: 18px 12px; border-radius: 14px; background: var(--cp-surface); }
.cp-locked > i { font-size: 1.6rem; color: var(--cp-muted); margin-bottom: 8px; }
.cp-locked h3 { font-size: 0.92rem; font-weight: 800; color: var(--cp-text); }
.cp-locked p { font-size: 0.82rem; color: var(--cp-muted); }

@media (max-width: 767.98px) {
    .cp-cover { height: 130px; }
    .cp-hero-body { padding: 0 16px 18px; flex-direction: column; align-items: flex-start; }
    .cp-logo { width: 84px; height: 84px; margin-top: -42px; font-size: 2rem; border-radius: 20px; }
    .cp-name { font-size: 1.3rem; }
    .cp-invite-btn { width: 100%; }
    .cp-section { padding: 16px; border-radius: 16px; }
    .cp-side { position: static; }
}

/* ══ Overflow safety ═══════════════════════════════════════════════════ */
.cp-section, .cp-identity, .cp-contact { min-width: 0; }
.cp-name, .cp-review p, .cp-about, .cp-chip { overflow-wrap: anywhere; }

/* ══ Responsive ════════════════════════════════════════════════════════ */
@media (max-width: 991.98px) {
    .cp-side { position: static; }
    .cp-hero-body { padding-inline: 22px; }
}

@media (max-width: 575.98px) {
    .cp-page { padding-inline: 12px; }
    .cp-cover { height: 110px; }
    .cp-hero-body { padding: 0 14px 16px; gap: 10px; }
    .cp-identity { min-width: 0; width: 100%; padding-top: 0; }
    .cp-subline { flex-direction: column; gap: 4px; }
    /* stats become a tidy 2-column grid */
    .cp-stat { flex: 1 1 50%; border-bottom: 1px solid var(--cp-border); }
    .cp-stat:nth-child(2n) { border-inline-end: 0; }
    .cp-stat:last-child { border-bottom: 0; }
    .cp-stat strong { font-size: 1.1rem; }
    .cp-section-title { font-size: 0.98rem; }
    .cp-section-title > i { width: 28px; height: 28px; }
}

/* ══ Dark theme ════════════════════════════════════════════════════════ */
[data-theme='dark'] .cp-logo,
[data-bs-theme='dark'] .cp-logo { box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5); }

[data-theme='dark'] .cp-cover,
[data-bs-theme='dark'] .cp-cover { filter: brightness(0.85); }

[data-theme='dark'] .cp-section-title > i,
[data-bs-theme='dark'] .cp-section-title > i { background: rgba(29, 181, 154, 0.15); }

[data-theme='dark'] a.cp-contact:hover,
[data-bs-theme='dark'] a.cp-contact:hover { background: rgba(29, 181, 154, 0.15); }

[data-theme='dark'] .cp-stars,
[data-bs-theme='dark'] .cp-stars { color: #fbbf24; }

/* Bootstrap utility classes used by the portfolio partial and the modal
   don't follow the site's data-theme switch, so map them here. */
[data-theme='dark'] .cp-page .bg-light,
[data-bs-theme='dark'] .cp-page .bg-light { background-color: var(--cp-surface) !important; }
[data-theme='dark'] .cp-page .text-dark,
[data-bs-theme='dark'] .cp-page .text-dark { color: var(--cp-text) !important; }
[data-theme='dark'] .cp-page .text-muted,
[data-bs-theme='dark'] .cp-page .text-muted { color: var(--cp-muted) !important; }
[data-theme='dark'] .cp-page .border,
[data-bs-theme='dark'] .cp-page .border { border-color: var(--cp-border) !important; }

[data-theme='dark'] #inviteServiceModal .modal-content {
    background: var(--jobs-card-bg, #1c1825);
    color: var(--jobs-text-main, #f1f5f9);
}
[data-theme='dark'] #inviteServiceModal .form-select,
[data-theme='dark'] #inviteServiceModal .form-control {
    background-color: var(--jobs-surface-bg, #14111c);
    border-color: var(--jobs-card-border, rgba(255, 255, 255, 0.08));
    color: var(--jobs-text-main, #f1f5f9);
}
[data-theme='dark'] #inviteServiceModal .btn-close { filter: invert(1); }

/* Phone, email and URLs are LTR strings inside an RTL row: keep the row's
   direction (icon at the start edge) and isolate only the value. */
.cp-contact bdi { unicode-bidi: isolate; }
[dir='rtl'] .cp-contact bdi { direction: ltr; }
