/* ============================================================
   TERRA JOBS - Frontend CSS
   ============================================================ */

/* ── Variables ── */
:root {
    --tj-primary:    #0066CC;
    --tj-orange:     #F39C12;
    --tj-text:       #1a1a2e;
    --tj-muted:      #666;
    --tj-border:     #e8edf2;
    --tj-radius:     12px;
    --tj-shadow:     0 2px 16px rgba(0,0,0,0.07);
    --tj-shadow-lg:  0 8px 40px rgba(0,0,0,0.12);
    --tj-transition: 0.25s cubic-bezier(0.4,0,0.2,1);
}

/* ================================================================
   LISTE DES OFFRES [terra_jobs]
================================================================ */

.tj-list-wrapper {
    max-width: 860px;
    margin: 0 auto;
    padding: 0 16px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* En-tête optionnel */
.tj-list-header {
    text-align: center;
    margin-bottom: 40px;
}

.tj-list-header h2 {
    font-size: 32px;
    font-weight: 800;
    color: var(--tj-text);
    margin: 0 0 10px;
}

.tj-list-header p {
    font-size: 16px;
    color: var(--tj-muted);
    margin: 0;
}

/* Liste */
.tj-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.tj-empty {
    text-align: center;
    color: var(--tj-muted);
    font-size: 15px;
    padding: 40px;
}

/* Item */
.tj-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    background: #fff;
    border: 1px solid var(--tj-border);
    border-radius: var(--tj-radius);
    padding: 24px 28px;
    box-shadow: var(--tj-shadow);
    transition: box-shadow var(--tj-transition), transform var(--tj-transition), border-color var(--tj-transition);
}

.tj-item:hover {
    box-shadow: var(--tj-shadow-lg);
    transform: translateY(-2px);
    border-color: #d0dce8;
}

.tj-item.tj-urgent {
    border-left: 4px solid #E74C3C;
}

.tj-item-main {
    flex: 1;
    min-width: 0;
}

/* Badge département */
.tj-dept-badge {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    padding: 3px 12px;
    border-radius: 20px;
    border: 1px solid;
    margin-bottom: 10px;
    letter-spacing: 0.3px;
}

/* Titre */
.tj-item-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--tj-text);
    margin: 0 0 6px;
    line-height: 1.3;
}

.tj-item-title a {
    color: inherit;
    text-decoration: none;
    transition: color var(--tj-transition);
}

.tj-item-title a:hover {
    color: var(--tj-primary);
}

/* Excerpt */
.tj-item-excerpt {
    font-size: 14px;
    color: var(--tj-muted);
    margin: 0 0 12px;
    line-height: 1.5;
}

/* Meta (lieu, contrat, salaire) */
.tj-item-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}

.tj-meta-item {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 13px;
    color: #888;
    white-space: nowrap;
}

.tj-meta-item svg {
    opacity: 0.6;
    flex-shrink: 0;
}

/* Bouton postuler */
.tj-item-action {
    flex-shrink: 0;
}

.tj-apply-btn {
    display: inline-block;
    padding: 12px 24px;
    border-radius: 10px;
    color: #fff !important;
    text-decoration: none !important;
    font-size: 14px;
    font-weight: 700;
    white-space: nowrap;
    transition: filter var(--tj-transition), transform var(--tj-transition);
    box-shadow: 0 4px 14px rgba(0,0,0,0.15);
}

.tj-apply-btn:hover {
    filter: brightness(1.1);
    transform: translateY(-2px);
}

/* ================================================================
   PAGE SINGLE OFFRE
================================================================ */

.tj-single-wrapper {
    max-width: 1100px;
    margin: 0 auto;
    padding: 40px 20px 60px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.tj-single-container {
    display: grid;
    grid-template-columns: 1fr 420px;
    gap: 40px;
    align-items: start;
}

/* Breadcrumb */
.tj-breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #999;
    margin-bottom: 24px;
}

.tj-breadcrumb a {
    color: var(--tj-primary);
    text-decoration: none;
}

.tj-breadcrumb a:hover { text-decoration: underline; }

/* Header offre */
.tj-single-header {
    margin-bottom: 32px;
}

.tj-single-title {
    font-size: 30px;
    font-weight: 800;
    color: var(--tj-text);
    margin: 12px 0 16px;
    line-height: 1.2;
}

.tj-single-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
}

/* Description */
.tj-single-description {
    background: #fff;
    border: 1px solid var(--tj-border);
    border-radius: var(--tj-radius);
    padding: 28px 32px;
    box-shadow: var(--tj-shadow);
    font-size: 15px;
    line-height: 1.7;
    color: #444;
}

.tj-single-description h2,
.tj-single-description h3 {
    color: var(--tj-text);
    margin-top: 24px;
}

.tj-single-description ul,
.tj-single-description ol {
    padding-left: 20px;
}

.tj-single-description li {
    margin-bottom: 6px;
}

/* CTA mobile */
.tj-mobile-cta {
    display: none;
    margin-top: 24px;
    text-align: center;
}

.tj-apply-btn-big {
    display: inline-block;
    padding: 16px 36px;
    background: var(--tj-orange);
    color: #fff !important;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 700;
    text-decoration: none !important;
    box-shadow: 0 4px 20px rgba(243,156,18,0.35);
    transition: filter 0.2s, transform 0.2s;
}

.tj-apply-btn-big:hover {
    filter: brightness(1.08);
    transform: translateY(-2px);
}

/* ── Formulaire (sidebar) ── */
.tj-single-sidebar {
    position: sticky;
    top: 30px;
}

.tj-apply-card {
    background: #fff;
    border: 1px solid var(--tj-border);
    border-radius: 16px;
    box-shadow: var(--tj-shadow-lg);
    overflow: hidden;
}

.tj-apply-card-header {
    background: linear-gradient(135deg, #0052a3 0%, #0066CC 100%);
    padding: 24px 28px;
    color: #fff;
}

.tj-apply-card-header h2 {
    font-size: 20px;
    font-weight: 700;
    margin: 0 0 6px;
    color: #fff;
}

.tj-apply-card-header p {
    font-size: 13px;
    margin: 0;
    opacity: 0.85;
}

/* Form fields */
#tj-application-form {
    padding: 24px 28px;
}

.tj-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.tj-form-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 14px;
}

.tj-form-field label {
    font-size: 13px;
    font-weight: 600;
    color: var(--tj-text);
}

.tj-form-field .req {
    color: #E74C3C;
}

.tj-form-field small {
    font-weight: 400;
    color: #999;
    font-size: 11px;
}

.tj-form-field input,
.tj-form-field textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--tj-border);
    border-radius: 8px;
    font-size: 14px;
    color: var(--tj-text);
    background: #fafafa;
    transition: border-color 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
    font-family: inherit;
}

.tj-form-field input:focus,
.tj-form-field textarea:focus {
    outline: none;
    border-color: var(--tj-primary);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(0,102,204,0.1);
}

/* Upload CV */
.tj-file-drop {
    border: 2px dashed var(--tj-border);
    border-radius: 10px;
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    background: #fafbfc;
}

.tj-file-drop:hover,
.tj-file-drop.drag-over {
    border-color: var(--tj-primary);
    background: rgba(0,102,204,0.04);
}

.tj-file-drop p {
    margin: 8px 0 0;
    font-size: 13px;
    color: #888;
}

.tj-file-link {
    color: var(--tj-primary);
    cursor: pointer;
    text-decoration: underline;
}

.tj-file-name {
    margin-top: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--tj-primary);
}

/* Messages */
.tj-form-error {
    background: #fef2f2;
    border: 1px solid #fca5a5;
    color: #dc2626;
    border-radius: 8px;
    padding: 12px 16px;
    font-size: 13px;
    margin-bottom: 14px;
}

.tj-form-success {
    padding: 32px 24px;
    text-align: center;
}

.tj-form-success h3 {
    font-size: 20px;
    color: #27AE60;
    margin: 12px 0 8px;
}

.tj-form-success p {
    font-size: 14px;
    color: var(--tj-muted);
    margin: 0;
}

/* Bouton submit */
.tj-submit-btn {
    width: 100%;
    padding: 14px;
    background: var(--tj-primary);
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.tj-submit-btn:hover { filter: brightness(1.08); transform: translateY(-1px); }
.tj-submit-btn:disabled { opacity: 0.7; cursor: not-allowed; transform: none; }

@keyframes tj-spin {
    to { transform: rotate(360deg); }
}
.tj-spin { animation: tj-spin 0.8s linear infinite; }

/* ── Autres offres ── */
.tj-other-offers {
    margin-top: 48px;
    padding-top: 40px;
    border-top: 1px solid var(--tj-border);
}

.tj-other-offers h3 {
    font-size: 20px;
    font-weight: 700;
    color: var(--tj-text);
    margin: 0 0 20px;
}

.tj-other-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.tj-other-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    background: #fff;
    border: 1px solid var(--tj-border);
    border-radius: var(--tj-radius);
    padding: 16px 20px;
    text-decoration: none;
    color: var(--tj-text);
    transition: all var(--tj-transition);
}

.tj-other-item:hover {
    border-color: var(--tj-primary);
    box-shadow: var(--tj-shadow);
    transform: translateX(4px);
    color: var(--tj-text);
    text-decoration: none;
}

.tj-other-item > div {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.tj-other-item strong { font-size: 15px; }
.tj-other-item span   { font-size: 13px; color: #888; }
.tj-other-item svg    { flex-shrink: 0; opacity: 0.4; }

/* ================================================================
   RESPONSIVE
================================================================ */
@media (max-width: 900px) {
    .tj-single-container {
        grid-template-columns: 1fr;
    }
    .tj-single-sidebar {
        position: static;
        order: -1; /* formulaire en haut sur tablette */
    }
    .tj-mobile-cta { display: block; }
}

@media (max-width: 640px) {
    .tj-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
        padding: 20px;
    }
    .tj-item-action { width: 100%; }
    .tj-apply-btn   { width: 100%; text-align: center; display: block; }
    .tj-single-title { font-size: 24px; }
    .tj-form-row     { grid-template-columns: 1fr; }
    .tj-apply-card-header { padding: 20px; }
    #tj-application-form  { padding: 20px; }
    .tj-list-header h2 { font-size: 26px; }
}

/* ================================================================
   AJOUTS v2 : Logo, Taxes, Clôture, Carrousel Jobs
================================================================ */

/* Logo dans la liste */
.tj-item-logo {
    width: 56px;
    height: 56px;
    flex-shrink: 0;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid var(--tj-border);
    background: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: center;
}
.tj-item-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* Badges taxonomies */
.tj-item-taxes {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 8px;
}
.tj-tax-badge {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 20px;
    border: 1px solid;
    white-space: nowrap;
    letter-spacing: 0.2px;
}
.tj-sector-badge  { background:#f0f4f8;  color:#555;    border-color:#dde3ea; }
.tj-service-badge { background:#f5f0ff;  color:#6b3fa0; border-color:#d4b8f5; }
.tj-urgent-badge  { background:#fff0f0;  color:#E74C3C; border-color:#fca5a5; }

/* Date clôture */
.tj-meta-closing { color:#27AE60; }
.tj-meta-expired { color:#E74C3C; font-weight:600; }
.tj-expired .tj-item-title a { color:#999; }
.tj-closed-label {
    font-size: 13px;
    color: #999;
    font-style: italic;
    white-space: nowrap;
}

/* Chips dans le carrousel */
.thc-desc-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 6px;
}
.thc-meta-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: #666;
    background: #f5f6f8;
    padding: 3px 10px;
    border-radius: 20px;
}
.thc-meta-chip.thc-expired { color:#E74C3C; background:#fff0f0; }
.thc-btn-closed {
    display: inline-block;
    padding: 10px 18px;
    background: #eee;
    color: #999;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    flex-shrink: 0;
}
.thc-title {
    font-size: 16px;
    font-weight: 700;
    color: #1a1a2e;
    text-decoration: none;
}
.thc-title:hover { color: #0066CC; text-decoration: none; }

/* Logo dans single */
.tj-single-logo {
    width: 80px;
    height: 80px;
    border-radius: 14px;
    border: 1px solid var(--tj-border);
    overflow: hidden;
    background: #f8f9fa;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}
.tj-single-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}
.tj-single-header-top {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 16px;
}
.tj-single-header-top > div { flex: 1; }

/* Taxonomies single */
.tj-single-taxes {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 12px;
}

/* Fermeture */
.tj-closing-notice {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 16px;
}
.tj-closing-notice.open   { background:#f0fdf4; color:#15803d; border:1px solid #bbf7d0; }
.tj-closing-notice.urgent { background:#fff7ed; color:#c2410c; border:1px solid #fed7aa; }
.tj-closing-notice.expired{ background:#fef2f2; color:#dc2626; border:1px solid #fca5a5; }
