/* ============================================================
   AITA Boîte à Problématiques — Style Frontend
   Palette officielle AITA
   ============================================================ */

:root {
    --aita-navy:        #134B68;
    --aita-cyan:        #0ea5e9;
    --aita-cyan-neon:   #00b4cc;
    --aita-green-dark:  #059669;
    --aita-green-light: #10b981;
    --aita-red:         #ef4444;
    --aita-orange:      #f59e0b;
    --aita-white:       #ffffff;
    --aita-slate:       #0f172a;
    --aita-gray:        #64748b;
    --aita-border:      #e2e8f0;
    --aita-bg-soft:     #f0f9ff;
}

/* ─────────────────────────────────────────────
   FORMULAIRE
   ───────────────────────────────────────────── */
.aita-prob-form-wrapper {
    background: var(--aita-white);
    border: 1px solid var(--aita-border);
    border-radius: 14px;
    padding: 28px;
    box-shadow: 0 2px 12px rgba(15, 23, 42, 0.04);
    max-width: 720px;
}

.aita-prob-form .aita-prob-field {
    margin-bottom: 18px;
}

.aita-prob-form .aita-prob-row {
    display: flex;
    gap: 16px;
}

.aita-prob-form .aita-prob-half {
    flex: 1;
}

.aita-prob-form label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--aita-slate);
    margin-bottom: 6px;
    letter-spacing: 0.2px;
}

.aita-required {
    color: var(--aita-red);
    font-weight: 700;
}

.aita-prob-form input[type="text"],
.aita-prob-form select,
.aita-prob-form textarea {
    width: 100%;
    padding: 11px 14px;
    border: 1px solid var(--aita-border);
    border-radius: 8px;
    background: var(--aita-white);
    color: var(--aita-slate);
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    box-sizing: border-box;
}

.aita-prob-form input[type="text"]:focus,
.aita-prob-form select:focus,
.aita-prob-form textarea:focus {
    outline: none;
    border-color: var(--aita-cyan);
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.12);
}

.aita-prob-form textarea {
    resize: vertical;
    min-height: 130px;
}

.aita-prob-hint {
    display: block;
    color: var(--aita-gray);
    font-size: 11px;
    margin-top: 6px;
}

/* Bouton submit */
.aita-prob-submit-wrap {
    margin-top: 24px;
}

.aita-prob-submit-btn {
    background: var(--aita-navy);
    color: var(--aita-white);
    border: none;
    border-radius: 8px;
    padding: 13px 28px;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: background 0.25s ease, transform 0.15s ease;
    position: relative;
    min-width: 240px;
}

.aita-prob-submit-btn:hover {
    background: var(--aita-cyan);
    transform: translateY(-1px);
}

.aita-prob-submit-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.aita-btn-loader {
    display: none;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: var(--aita-white);
    border-radius: 50%;
    animation: aita-spin 0.6s linear infinite;
    margin-left: 8px;
    vertical-align: middle;
}

.aita-prob-submit-btn.loading .aita-btn-loader {
    display: inline-block;
}

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

/* Messages */
.aita-prob-message {
    margin-top: 16px;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 13px;
    display: none;
}

.aita-prob-message.success {
    display: block;
    background: rgba(16, 185, 129, 0.08);
    border-left: 4px solid var(--aita-green-light);
    color: var(--aita-green-dark);
}

.aita-prob-message.error {
    display: block;
    background: rgba(239, 68, 68, 0.08);
    border-left: 4px solid var(--aita-red);
    color: #b91c1c;
}

/* Notice non-connecté */
.aita-prob-notice {
    background: var(--aita-bg-soft);
    border: 1px solid var(--aita-border);
    border-left: 4px solid var(--aita-cyan);
    border-radius: 10px;
    padding: 18px 22px;
    color: var(--aita-slate);
    font-size: 14px;
}

/* ─────────────────────────────────────────────
   GRILLE D'AFFICHAGE
   ───────────────────────────────────────────── */
.aita-prob-grid-wrapper {
    width: 100%;
}

.aita-prob-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 18px;
}

.aita-prob-grid[data-columns="2"] { grid-template-columns: repeat(2, 1fr); }
.aita-prob-grid[data-columns="4"] { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 1024px) {
    .aita-prob-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
    .aita-prob-grid { grid-template-columns: 1fr; }
}

/* Carte problématique */
.aita-prob-card {
    background: var(--aita-white);
    border: 1px solid var(--aita-border);
    border-radius: 14px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    transition: border-color 0.25s ease, transform 0.2s ease, box-shadow 0.25s ease;
    position: relative;
    overflow: hidden;
}

.aita-prob-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--aita-cyan);
}

.aita-prob-card.aita-priority-urgente::before { background: var(--aita-red); }
.aita-prob-card.aita-priority-normale::before { background: var(--aita-cyan); }
.aita-prob-card.aita-priority-faible::before  { background: var(--aita-green-light); }

.aita-prob-card:hover {
    border-color: var(--aita-cyan);
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(14, 165, 233, 0.10);
}

/* Header carte */
.aita-prob-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.aita-prob-badge {
    display: inline-block;
    background: var(--aita-bg-soft);
    color: var(--aita-navy);
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    padding: 4px 10px;
    border-radius: 12px;
    border: 1px solid rgba(14, 165, 233, 0.2);
}

.aita-prob-priority {
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    padding: 3px 9px;
    border-radius: 4px;
}

.aita-prio-faible {
    background: rgba(16, 185, 129, 0.12);
    color: var(--aita-green-dark);
}
.aita-prio-normale {
    background: rgba(14, 165, 233, 0.12);
    color: var(--aita-cyan);
}
.aita-prio-urgente {
    background: rgba(239, 68, 68, 0.12);
    color: var(--aita-red);
}

/* Titre carte */
.aita-prob-card-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--aita-slate);
    margin: 0 0 10px 0;
    line-height: 1.4;
}

.aita-prob-card-title:hover {
    color: var(--aita-navy);
}

/* Extrait */
.aita-prob-card-excerpt {
    color: var(--aita-gray);
    font-size: 13px;
    line-height: 1.6;
    margin: 0 0 16px 0;
    flex-grow: 1;
}

/* Footer carte */
.aita-prob-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 14px;
    border-top: 1px solid var(--aita-border);
}

.aita-prob-author {
    display: flex;
    align-items: center;
    gap: 8px;
}

.aita-prob-avatar {
    border-radius: 50%;
    border: 2px solid var(--aita-border);
}

.aita-prob-author-name {
    font-size: 12px;
    font-weight: 600;
    color: var(--aita-slate);
}

.aita-prob-date {
    font-size: 11px;
    color: var(--aita-gray);
    font-style: italic;
}

/* Barre de statut */
.aita-prob-status-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 12px;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: var(--aita-bg-soft);
}

.aita-prob-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--aita-cyan);
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.2);
}

.aita-status-nouveau   { color: var(--aita-cyan); }
.aita-status-nouveau .aita-prob-status-dot   { background: var(--aita-cyan); }

.aita-status-en_cours { color: var(--aita-orange); }
.aita-status-en_cours .aita-prob-status-dot { background: var(--aita-orange); box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.2); }

.aita-status-resolu   { color: var(--aita-green-dark); }
.aita-status-resolu .aita-prob-status-dot   { background: var(--aita-green-light); box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2); }

.aita-status-rejete   { color: var(--aita-gray); }
.aita-status-rejete .aita-prob-status-dot   { background: var(--aita-gray); box-shadow: 0 0 0 3px rgba(100, 116, 139, 0.2); }

/* Empty state */
.aita-prob-empty {
    text-align: center;
    padding: 60px 30px;
    background: var(--aita-bg-soft);
    border: 2px dashed var(--aita-border);
    border-radius: 14px;
}

.aita-prob-empty-icon {
    font-size: 48px;
    margin-bottom: 12px;
}

.aita-prob-empty h3 {
    color: var(--aita-slate);
    margin: 0 0 8px 0;
    font-size: 18px;
}

.aita-prob-empty p {
    color: var(--aita-gray);
    margin: 0;
    font-size: 14px;
}

/* ─────────────────────────────────────────────
   CHAMP D'UPLOAD (formulaire)
   ───────────────────────────────────────────── */
.aita-prob-optional {
    font-weight: 400;
    color: var(--aita-gray);
    font-size: 12px;
}

.aita-prob-upload {
    position: relative;
}

.aita-prob-upload input[type="file"] {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    overflow: hidden;
}

.aita-prob-upload-label {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 18px;
    border: 2px dashed var(--aita-border);
    border-radius: 10px;
    background: var(--aita-bg-soft);
    color: var(--aita-navy);
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: border-color .2s, background .2s;
}

.aita-prob-upload-label:hover {
    border-color: var(--aita-cyan);
    background: #e0f2fe;
}

.aita-prob-upload-icon {
    font-size: 20px;
}

.aita-prob-file-list {
    list-style: none;
    margin: 12px 0 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.aita-prob-file-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: var(--aita-white);
    border: 1px solid var(--aita-border);
    border-radius: 8px;
    font-size: 13px;
}

.aita-prob-file-icon { font-size: 16px; }
.aita-prob-file-name { flex: 1; color: var(--aita-slate); word-break: break-all; }
.aita-prob-file-size { color: var(--aita-gray); font-size: 12px; white-space: nowrap; }

/* ─────────────────────────────────────────────
   GRILLE — carte cliquable
   ───────────────────────────────────────────── */
a.aita-prob-card {
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    cursor: pointer;
}

a.aita-prob-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.10);
}

/* ═════════════════════════════════════════════
   PAGE DÉDIÉE — PROBLÉMATIQUE (single)
   ═════════════════════════════════════════════ */
.aita-prob-single {
    background: #f8fafc;
    min-height: 70vh;
    padding: 40px 20px 64px;
}

.aita-prob-single-inner {
    max-width: 860px;
    margin: 0 auto;
}

/* Barre supérieure */
.aita-prob-single-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
}

.aita-prob-back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--aita-navy);
    font-weight: 600;
    font-size: 14px;
    text-decoration: none;
    transition: color .2s;
}

.aita-prob-back:hover { color: var(--aita-cyan); }

.aita-prob-single-ref {
    font-size: 12px;
    font-weight: 700;
    color: var(--aita-gray);
    background: #fff;
    border: 1px solid var(--aita-border);
    padding: 4px 12px;
    border-radius: 20px;
}

/* En-tête */
.aita-prob-single-header {
    background: #fff;
    border: 1px solid var(--aita-border);
    border-top: 5px solid var(--aita-cyan);
    border-radius: 16px 16px 0 0;
    padding: 28px 32px;
}

.aita-prob-single-header.aita-priority-urgente { border-top-color: var(--aita-red); }
.aita-prob-single-header.aita-priority-faible  { border-top-color: var(--aita-green-light); }
.aita-prob-single-header.aita-priority-normale { border-top-color: var(--aita-cyan); }

.aita-prob-single-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

.aita-prob-single-title {
    font-size: 26px;
    line-height: 1.3;
    color: var(--aita-slate);
    margin: 0 0 18px;
    font-weight: 800;
}

.aita-prob-single-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 18px;
    padding-top: 16px;
    border-top: 1px solid var(--aita-border);
}

.aita-prob-single-author {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--aita-gray);
}

.aita-prob-single-author .aita-prob-avatar {
    border-radius: 50%;
}

.aita-prob-single-author strong { color: var(--aita-slate); }

.aita-prob-single-date {
    font-size: 13px;
    color: var(--aita-gray);
}

/* Pastille de statut */
.aita-prob-status-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 700;
    padding: 4px 12px;
    border-radius: 20px;
    background: var(--aita-bg-soft);
    color: var(--aita-navy);
}

.aita-prob-status-pill .aita-prob-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--aita-cyan);
}

.aita-prob-status-pill.aita-status-en_cours { background:#fff7ed; color:#b45309; }
.aita-prob-status-pill.aita-status-en_cours .aita-prob-status-dot { background:var(--aita-orange); }
.aita-prob-status-pill.aita-status-resolu   { background:#ecfdf5; color:#047857; }
.aita-prob-status-pill.aita-status-resolu .aita-prob-status-dot { background:var(--aita-green-dark); }
.aita-prob-status-pill.aita-status-rejete   { background:#f1f5f9; color:#475569; }
.aita-prob-status-pill.aita-status-rejete .aita-prob-status-dot { background:#94a3b8; }

/* Corps */
.aita-prob-single-body {
    background: #fff;
    border: 1px solid var(--aita-border);
    border-top: none;
    padding: 28px 32px;
}

.aita-prob-section-title {
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: .6px;
    color: var(--aita-navy);
    font-weight: 700;
    margin: 0 0 14px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--aita-bg-soft);
}

.aita-prob-section-title:not(:first-child) {
    margin-top: 32px;
}

.aita-prob-single-content {
    font-size: 15px;
    line-height: 1.75;
    color: #334155;
}

.aita-prob-single-content p { margin: 0 0 14px; }

/* Pièces jointes */
.aita-prob-attachments {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 14px;
}

.aita-prob-attach {
    text-decoration: none;
    border: 1px solid var(--aita-border);
    border-radius: 10px;
    overflow: hidden;
    transition: border-color .2s, box-shadow .2s, transform .2s;
}

.aita-prob-attach:hover {
    border-color: var(--aita-cyan);
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.08);
    transform: translateY(-2px);
}

.aita-prob-attach-img .aita-prob-attach-thumb {
    display: block;
    width: 100%;
    height: 150px;
    object-fit: cover;
}

.aita-prob-attach-pdf {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 22px 14px;
    background: var(--aita-bg-soft);
    text-align: center;
}

.aita-prob-attach-pdf-icon { font-size: 38px; }

.aita-prob-attach-pdf-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--aita-slate);
    word-break: break-all;
}

.aita-prob-attach-pdf-action {
    font-size: 12px;
    font-weight: 700;
    color: var(--aita-cyan);
}

/* Pied */
.aita-prob-single-footer {
    background: #fff;
    border: 1px solid var(--aita-border);
    border-top: none;
    border-radius: 0 0 16px 16px;
    padding: 20px 32px;
}

.aita-prob-single-status-box {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    color: var(--aita-navy);
}

.aita-prob-single-status-box .aita-prob-status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--aita-cyan);
}

.aita-prob-single-status-box.aita-status-en_cours .aita-prob-status-dot { background: var(--aita-orange); }
.aita-prob-single-status-box.aita-status-resolu .aita-prob-status-dot   { background: var(--aita-green-dark); }
.aita-prob-single-status-box.aita-status-rejete .aita-prob-status-dot   { background: #94a3b8; }

/* Responsive */
@media (max-width: 600px) {
    .aita-prob-single { padding: 24px 12px 40px; }
    .aita-prob-single-header,
    .aita-prob-single-body,
    .aita-prob-single-footer { padding-left: 20px; padding-right: 20px; }
    .aita-prob-single-title { font-size: 21px; }
}

/* ─────────────────────────────────────────────
   COMMENTAIRES — Design Carte AITA
   ───────────────────────────────────────────── */
.aita-prob-comments-wrap {
    margin-top: 24px;
}

/* Carte globale des commentaires */
.aita-prob-comments-wrap #comments,
.aita-prob-comments-wrap #respond {
    background: #ffffff;
    border: 1px solid var(--aita-border);
    border-radius: 10px;
    padding: 28px 32px;
    box-shadow: 0 2px 12px rgba(15, 23, 42, 0.06);
}

.aita-prob-comments-wrap #respond {
    margin-top: 20px;
}

/* Titre de la section commentaires */
.aita-prob-comments-wrap .comments-title,
.aita-prob-comments-wrap #reply-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--aita-navy);
    margin: 0 0 18px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--aita-bg-soft);
}

.aita-prob-comments-wrap #reply-title small {
    display: block;
    margin-top: 6px;
}

.aita-prob-comments-wrap #reply-title small a {
    color: var(--aita-cyan);
    text-decoration: none;
    font-weight: 600;
}

/* Liste des commentaires */
.aita-prob-comments-wrap .comment-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.aita-prob-comments-wrap .comment-list li.comment {
    padding: 18px 0;
    border-bottom: 1px solid var(--aita-border);
}

.aita-prob-comments-wrap .comment-list li.comment:last-child {
    border-bottom: none;
}

.aita-prob-comments-wrap .comment-list .children {
    margin-left: 28px;
    padding-left: 18px;
    border-left: 2px solid var(--aita-bg-soft);
    list-style: none;
}

.aita-prob-comments-wrap .comment-author {
    font-size: 13px;
    font-weight: 600;
    color: var(--aita-slate);
}

.aita-prob-comments-wrap .comment-author .avatar {
    border-radius: 50%;
    margin-right: 8px;
    vertical-align: middle;
}

.aita-prob-comments-wrap .comment-author .fn {
    font-style: normal;
}

.aita-prob-comments-wrap .comment-metadata {
    font-size: 12px;
    color: var(--aita-gray);
    margin-top: 4px;
}

.aita-prob-comments-wrap .comment-metadata a {
    color: var(--aita-gray);
    text-decoration: none;
}

.aita-prob-comments-wrap .comment-content {
    margin-top: 10px;
    font-size: 14px;
    line-height: 1.65;
    color: #334155;
}

.aita-prob-comments-wrap .comment-content p {
    margin: 0 0 10px;
}

.aita-prob-comments-wrap .reply a {
    display: inline-block;
    margin-top: 6px;
    font-size: 12px;
    font-weight: 700;
    color: var(--aita-cyan);
    text-decoration: none;
}

.aita-prob-comments-wrap .reply a:hover {
    text-decoration: underline;
}

/* Formulaire de commentaire */
.aita-prob-comments-wrap .comment-form label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--aita-slate);
    margin-bottom: 5px;
}

.aita-prob-comments-wrap .comment-form input[type="text"],
.aita-prob-comments-wrap .comment-form input[type="email"],
.aita-prob-comments-wrap .comment-form input[type="url"],
.aita-prob-comments-wrap .comment-form textarea {
    width: 100%;
    max-width: 100%;
    padding: 10px 14px;
    font-size: 14px;
    font-family: 'Inter', 'Segoe UI', sans-serif;
    background: #f8fafc;
    border: 1px solid var(--aita-border);
    border-radius: 8px;
    color: var(--aita-slate);
    transition: border-color .2s, box-shadow .2s;
    box-sizing: border-box;
}

.aita-prob-comments-wrap .comment-form input[type="text"]:focus,
.aita-prob-comments-wrap .comment-form input[type="email"]:focus,
.aita-prob-comments-wrap .comment-form input[type="url"]:focus,
.aita-prob-comments-wrap .comment-form textarea:focus {
    outline: none;
    border-color: #1abc9c;
    box-shadow: 0 0 0 3px rgba(26, 188, 156, 0.15);
    background: #ffffff;
}

.aita-prob-comments-wrap .comment-form textarea {
    min-height: 120px;
    resize: vertical;
}

.aita-prob-comments-wrap .comment-form .comment-form-cookies-consent {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--aita-gray);
    margin: 10px 0;
}

.aita-prob-comments-wrap .comment-form p {
    margin-bottom: 14px;
}

/* Bouton "Laisser un commentaire" */
.aita-prob-comments-wrap .comment-form .form-submit input[type="submit"],
.aita-prob-comments-wrap .comment-form .submit {
    display: inline-block;
    background: #0f4d6d;
    color: #ffffff;
    border: none;
    border-radius: 6px;
    padding: 10px 24px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background .2s, box-shadow .2s;
}

.aita-prob-comments-wrap .comment-form .form-submit input[type="submit"]:hover,
.aita-prob-comments-wrap .comment-form .submit:hover {
    background: #0c3d56;
    box-shadow: 0 4px 12px rgba(15, 77, 109, 0.25);
}

/* Message "pas de commentaires" */
.aita-prob-comments-wrap .no-comments {
    color: var(--aita-gray);
    font-style: italic;
    padding: 12px 0;
}

/* Responsive */
@media (max-width: 600px) {
    .aita-prob-comments-wrap #comments,
    .aita-prob-comments-wrap #respond {
        padding: 20px;
    }
    .aita-prob-comments-wrap .comment-list .children {
        margin-left: 14px;
        padding-left: 12px;
    }
}
