/* ============================================================
   Africa Translator — Modules CSS
   Traducteur Instantané + Espace Collaboratif
   ============================================================ */

:root {
    --aft-dark:   #0a1628;
    --aft-blue:   #1a2e4a;
    --aft-gold:   #D4AF37;
    --aft-gold2:  #F4D03F;
    --aft-white:  #ffffff;
    --aft-gray:   rgba(255,255,255,0.6);
    --aft-radius: 12px;
    --aft-shadow: 0 8px 32px rgba(0,0,0,0.18);
    --aft-font:   'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* ============================================================
   TRADUCTEUR INSTANTANÉ
   ============================================================ */

.aft-translator-wrap {
    max-width: 900px;
    margin: 0 auto;
    font-family: var(--aft-font);
}

.aft-translator-box {
    background: linear-gradient(135deg, var(--aft-dark), var(--aft-blue));
    border-radius: 16px;
    padding: 28px;
    box-shadow: var(--aft-shadow);
    color: var(--aft-white);
}

.aft-translator-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid rgba(212,175,55,0.2);
}

.aft-translator-header h2 {
    margin: 0;
    color: var(--aft-gold);
    font-size: 18px;
    font-weight: 700;
}

.aft-lang-selector {
    display: flex;
    gap: 8px;
    align-items: center;
}

.aft-lang-btn {
    background: rgba(255,255,255,0.1);
    color: var(--aft-white);
    border: 1px solid rgba(255,255,255,0.2);
    padding: 6px 16px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    font-family: var(--aft-font);
    transition: all 0.2s;
}

.aft-lang-btn.active,
.aft-lang-btn:hover {
    background: linear-gradient(135deg, var(--aft-gold), var(--aft-gold2));
    color: var(--aft-dark);
    border-color: transparent;
}

.aft-translator-grid {
    display: grid;
    grid-template-columns: 1fr 40px 1fr;
    gap: 12px;
    align-items: start;
}

.aft-panel-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-size: 12px;
}

.aft-lang-badge {
    background: rgba(212,175,55,0.2);
    color: var(--aft-gold);
    padding: 3px 10px;
    border-radius: 20px;
    font-weight: 700;
    font-size: 12px;
}

.aft-detect-info {
    color: rgba(255,255,255,0.4);
    font-size: 11px;
}

.aft-textarea {
    width: 100%;
    background: rgba(255,255,255,0.07);
    border: 1px solid rgba(212,175,55,0.25);
    border-radius: 8px;
    padding: 12px;
    color: var(--aft-white);
    font-size: 14px;
    font-family: var(--aft-font);
    resize: vertical;
    box-sizing: border-box;
    transition: border-color 0.2s;
    line-height: 1.5;
}

.aft-textarea:focus {
    outline: none;
    border-color: var(--aft-gold);
}

.aft-textarea[readonly] {
    background: rgba(255,255,255,0.04);
    border-color: rgba(255,255,255,0.1);
    color: rgba(255,255,255,0.85);
}

.aft-textarea::placeholder {
    color: rgba(255,255,255,0.3);
}

.aft-arrow-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding-top: 52px;
    color: var(--aft-gold);
    font-size: 22px;
    cursor: pointer;
    transition: transform 0.2s;
}

.aft-arrow-col:hover {
    transform: scale(1.2);
}

.aft-actions {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.aft-btn {
    flex: 1;
    background: linear-gradient(135deg, var(--aft-gold), var(--aft-gold2));
    color: var(--aft-dark);
    border: none;
    padding: 10px 16px;
    border-radius: 8px;
    font-weight: 700;
    cursor: pointer;
    font-size: 13px;
    font-family: var(--aft-font);
    transition: opacity 0.2s;
}

.aft-btn:hover { opacity: 0.88; }

.aft-btn-secondary {
    flex: none;
    background: rgba(255,255,255,0.08);
    color: rgba(255,255,255,0.7);
    border: 1px solid rgba(255,255,255,0.15);
    padding: 10px 14px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-family: var(--aft-font);
    transition: background 0.2s;
}

.aft-btn-secondary:hover {
    background: rgba(255,255,255,0.15);
}

.aft-status-bar {
    margin-top: 12px;
    min-height: 20px;
    font-size: 12px;
    color: rgba(255,255,255,0.45);
    display: flex;
    align-items: center;
    gap: 8px;
}

.aft-status-bar.success { color: #4caf50; }
.aft-status-bar.loading { color: var(--aft-gold); }
.aft-status-bar.error   { color: #f44336; }

/* Glossaire hits */
.aft-glossary-hits {
    margin-top: 16px;
    padding: 12px;
    background: rgba(255,255,255,0.05);
    border-radius: 8px;
    display: none;
}

.aft-glossary-hits h4 {
    margin: 0 0 8px;
    font-size: 12px;
    color: var(--aft-gold);
    font-weight: 600;
}

.aft-hit-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.aft-hit-tag {
    background: rgba(212,175,55,0.15);
    color: var(--aft-gold);
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 11px;
}

/* Score */
.aft-score-bar {
    height: 4px;
    background: rgba(255,255,255,0.1);
    border-radius: 2px;
    margin-top: 8px;
    overflow: hidden;
}

.aft-score-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--aft-gold), var(--aft-gold2));
    border-radius: 2px;
    transition: width 0.5s ease;
}

/* Save validated */
.aft-save-validated {
    display: none;
    margin-top: 10px;
    padding: 8px 12px;
    background: rgba(76,175,80,0.15);
    border: 1px solid rgba(76,175,80,0.3);
    border-radius: 6px;
    font-size: 12px;
    color: #4caf50;
    cursor: pointer;
    text-align: center;
}

.aft-save-validated:hover { background: rgba(76,175,80,0.25); }

/* ============================================================
   ESPACE COLLABORATIF
   ============================================================ */

.aft-collab-wrap {
    max-width: 1200px;
    margin: 0 auto;
    font-family: var(--aft-font);
}

.aft-collab-header {
    background: linear-gradient(135deg, var(--aft-dark), var(--aft-blue));
    border-radius: 16px;
    padding: 20px 24px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: var(--aft-white);
    box-shadow: var(--aft-shadow);
}

.aft-collab-header h2 {
    margin: 0;
    color: var(--aft-gold);
    font-size: 18px;
}

.aft-collab-header p {
    margin: 4px 0 0;
    color: var(--aft-gray);
    font-size: 13px;
}

.aft-collab-grid {
    display: grid;
    grid-template-columns: 250px 1fr 270px;
    gap: 18px;
}

/* Panneau documents */
.aft-doc-panel {
    background: #fff;
    border: 1px solid #e4e4e7;
    border-radius: var(--aft-radius);
    padding: 16px;
}

.aft-doc-panel h3 {
    margin: 0 0 12px;
    font-size: 13px;
    color: #374151;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.aft-doc-item {
    padding: 10px;
    border-radius: 8px;
    border: 1px solid #f0f0f0;
    cursor: pointer;
    margin-bottom: 6px;
    transition: all 0.15s;
}

.aft-doc-item:hover,
.aft-doc-item.active {
    background: rgba(212,175,55,0.08);
    border-color: var(--aft-gold);
}

.aft-doc-item-title {
    font-size: 13px;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.aft-doc-item-date {
    font-size: 11px;
    color: #9ca3af;
}

/* Éditeur */
.aft-editor-panel {
    background: #fff;
    border: 1px solid #e4e4e7;
    border-radius: var(--aft-radius);
    padding: 20px;
    min-height: 450px;
}

.aft-editor-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
    padding-bottom: 14px;
    border-bottom: 1px solid #f3f4f6;
}

.aft-doc-title {
    flex: 1;
    font-size: 16px;
    font-weight: 700;
    color: #111827;
    margin: 0;
}

.aft-sync-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #4caf50;
    display: inline-block;
    margin-right: 4px;
}

.aft-sync-status {
    font-size: 11px;
    color: #9ca3af;
    display: flex;
    align-items: center;
}

/* Blocs */
.aft-block {
    margin-bottom: 12px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
    transition: border-color 0.2s;
}

.aft-block:focus-within {
    border-color: var(--aft-gold);
    box-shadow: 0 0 0 3px rgba(212,175,55,0.1);
}

.aft-block-meta {
    background: #f9fafb;
    padding: 5px 10px;
    font-size: 11px;
    color: #6b7280;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #e5e7eb;
}

.aft-block-author { color: #374151; font-weight: 600; }

.aft-block-status {
    color: var(--aft-gold);
    font-weight: 600;
}

.aft-block-textarea {
    width: 100%;
    border: none;
    padding: 12px;
    font-size: 14px;
    font-family: var(--aft-font);
    resize: vertical;
    min-height: 72px;
    box-sizing: border-box;
    line-height: 1.6;
    color: #111827;
    background: #fff;
}

.aft-block-textarea:focus { outline: none; }

.aft-add-block-btn {
    width: 100%;
    background: transparent;
    border: 2px dashed #D4AF37;
    color: #D4AF37;
    padding: 11px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    font-family: var(--aft-font);
    font-weight: 600;
    margin-top: 10px;
    transition: all 0.2s;
}

.aft-add-block-btn:hover {
    background: rgba(212,175,55,0.06);
}

/* Chat */
.aft-chat-panel {
    background: #fff;
    border: 1px solid #e4e4e7;
    border-radius: var(--aft-radius);
    padding: 16px;
    display: flex;
    flex-direction: column;
    height: 500px;
}

.aft-chat-panel h3 {
    margin: 0 0 12px;
    font-size: 13px;
    color: #374151;
}

.aft-chat-messages {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 12px;
    padding-right: 2px;
}

.aft-chat-msg {
    padding: 8px 11px;
    border-radius: 8px;
    font-size: 13px;
    line-height: 1.4;
    max-width: 90%;
}

.aft-chat-msg.mine {
    background: rgba(212,175,55,0.12);
    border: 1px solid rgba(212,175,55,0.25);
    align-self: flex-end;
}

.aft-chat-msg.other {
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    align-self: flex-start;
}

.aft-chat-msg-user {
    font-size: 10px;
    font-weight: 700;
    color: #6b7280;
    margin-bottom: 2px;
}

.aft-chat-input-row {
    display: flex;
    gap: 6px;
}

.aft-chat-input {
    flex: 1;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    padding: 8px 10px;
    font-size: 13px;
    font-family: var(--aft-font);
    transition: border-color 0.2s;
}

.aft-chat-input:focus {
    outline: none;
    border-color: var(--aft-gold);
}

.aft-chat-send {
    background: var(--aft-dark);
    color: #fff;
    border: none;
    padding: 8px 14px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    transition: background 0.2s;
}

.aft-chat-send:hover { background: var(--aft-blue); }

/* Empty states */
.aft-empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #9ca3af;
}

.aft-empty-state .aft-empty-icon {
    font-size: 48px;
    margin-bottom: 12px;
}

/* Login required */
.aft-login-required {
    text-align: center;
    padding: 40px 20px;
    background: #f9fafb;
    border-radius: var(--aft-radius);
    color: #6b7280;
    font-family: var(--aft-font);
}

.aft-login-required a {
    color: var(--aft-dark);
    font-weight: 600;
}

/* Responsive */
@media (max-width: 900px) {
    .aft-translator-grid {
        grid-template-columns: 1fr;
    }
    .aft-arrow-col {
        padding-top: 0;
        transform: rotate(90deg);
    }
    .aft-collab-grid {
        grid-template-columns: 1fr;
    }
    .aft-chat-panel {
        height: 300px;
    }
}
