/* ==============================
   STYLES-INDEX.CSS — Page principale
   ============================== */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600&family=DM+Mono:wght@400;500&display=swap');

:root {
    --bg:        #f0f2f5;
    --surface:   #ffffff;
    --border:    #e2e6ea;
    --text:      #1a202c;
    --muted:     #718096;
    --accent:    #4361ee;
    --accent-h:  #3451d1;

    --green-bg:  #d1fae5; --green-text: #065f46;
    --red-bg:    #fee2e2; --red-text:   #991b1b;
    --yellow-bg: #fef3c7; --yellow-text:#92400e;

    --radius:    10px;
    --shadow:    0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'DM Sans', sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 15px;
    line-height: 1.5;
    padding-bottom: 60px;
}

/* ---- Header ---- */
h1 {
    text-align: center;
    margin: 30px 0 20px;
    font-size: 1.9rem;
    font-weight: 600;
    color: var(--text);
    letter-spacing: -0.5px;
}

.top-right-form {
    position: absolute;
    top: 18px;
    right: 20px;
}

/* ---- Buttons ---- */
.btn-admin, .btn-logout {
    padding: 7px 16px;
    border-radius: var(--radius);
    border: 1.5px solid var(--border);
    background: var(--surface);
    color: var(--text);
    font-family: 'DM Sans', sans-serif;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
}
.btn-admin:hover, .btn-logout:hover {
    background: var(--bg);
    border-color: #bcc3cc;
}

.btn-add {
    display: inline-block;
    padding: 8px 18px;
    background: var(--accent);
    color: white;
    border-radius: var(--radius);
    text-decoration: none;
    font-weight: 500;
    font-size: 14px;
    transition: background 0.2s, transform 0.1s;
}
.btn-add:hover { background: var(--accent-h); transform: translateY(-1px); }

.btn-edit {
    background: var(--surface);
    border: 1.5px solid var(--border);
    color: var(--text);
    padding: 7px 16px;
    border-radius: var(--radius);
    font-family: 'DM Sans', sans-serif;
    font-size: 14px;
    cursor: pointer;
    transition: 0.2s;
}
.btn-cancel {
    background: #fee2e2;
    border: 1.5px solid #fca5a5;
    color: #991b1b;
    padding: 7px 16px;
    border-radius: var(--radius);
    font-family: 'DM Sans', sans-serif;
    font-size: 14px;
    cursor: pointer;
    margin-left: 8px;
    transition: 0.2s;
}
.btn-save {
    background: #d1fae5;
    border: 1.5px solid #6ee7b7;
    color: #065f46;
    padding: 7px 16px;
    border-radius: var(--radius);
    font-family: 'DM Sans', sans-serif;
    font-size: 14px;
    cursor: pointer;
    margin-left: 8px;
    transition: 0.2s;
}
.btn-edit:hover  { background: var(--bg); }
.btn-cancel:hover { background: #fecaca; }
.btn-save:hover   { background: #a7f3d0; }

/* ---- Export dropdown ---- */
.export-wrap {
    position: relative;
    display: inline-block;
    margin-left: 8px;
}

.btn-export {
    background: #f0fdf4;
    border: 1.5px solid #6ee7b7;
    color: #065f46;
    padding: 7px 16px;
    border-radius: var(--radius);
    font-family: 'DM Sans', sans-serif;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: 0.2s;
}
.btn-export:hover { background: #d1fae5; }

.export-menu {
    display: none;
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 8px 20px rgba(0,0,0,0.1);
    min-width: 170px;
    z-index: 500;
    overflow: hidden;
    animation: popIn 0.18s ease;
}
.export-menu.open { display: block; }

.export-menu button {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 10px 16px;
    background: none;
    border: none;
    border-radius: 0;
    margin: 0;
    font-family: 'DM Sans', sans-serif;
    font-size: 14px;
    color: var(--text);
    cursor: pointer;
    text-align: left;
    transition: background 0.15s;
}
.export-menu button:hover { background: var(--bg); }

/* ---- Stats ---- */
.stats {
    display: flex;
    justify-content: center;
    gap: 14px;
    margin: 0 auto 28px;
    flex-wrap: wrap;
    max-width: 900px;
    padding: 0 20px;
}

.stat-card {
    flex: 1 1 170px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 20px;
    text-align: center;
    box-shadow: var(--shadow);
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.stat-label { font-size: 12px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.8px; color: var(--muted); }
.stat-card strong { font-size: 2rem; font-weight: 600; font-family: 'DM Mono', monospace; }

.stat-total    strong { color: var(--text); }
.stat-positive strong { color: #059669; }
.stat-negative strong { color: #dc2626; }
.stat-attente  strong { color: #d97706; }

/* ---- Toolbar ---- */
.toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 98%;
    margin: 0 auto 14px;
    padding: 0 10px;
}
.edit-controls { display: flex; align-items: center; }

/* ---- Table ---- */
.table-wrapper {
    width: 98%;
    margin: 0 auto;
    overflow-x: auto;
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
}

table {
    border-collapse: collapse;
    width: 100%;
    background: var(--surface);
    table-layout: auto;
    min-width: 900px;
}

thead tr {
    background: #f7f8fa;
    border-bottom: 2px solid var(--border);
}

th {
    padding: 12px 14px;
    text-align: left;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.7px;
    color: var(--muted);
    white-space: nowrap;
}

td {
    padding: 11px 14px;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
    vertical-align: middle;
    word-break: break-word;
}

tbody tr:last-child td { border-bottom: none; }
tbody tr { transition: background 0.15s; }
tbody tr:hover { background: #f7f8fa; }

/* Row status colors */
.row-positive td:first-child { border-left: 3px solid #10b981; }
.row-negative  td:first-child { border-left: 3px solid #ef4444; }
.row-en-attente td:first-child { border-left: 3px solid #f59e0b; }

/* Subtle row tints */
.row-positive  { background: #f0fdf4; }
.row-negative  { background: #fff5f5; }
.row-en-attente { background: #fffbeb; }

/* ---- Badges ---- */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
}
.badge-positive  { background: var(--green-bg);  color: var(--green-text); }
.badge-negative  { background: var(--red-bg);    color: var(--red-text); }
.badge-en-attente { background: var(--yellow-bg); color: var(--yellow-text); }

/* ---- Lien candidature ---- */
.lien-btn {
    display: inline-block;
    padding: 3px 10px;
    background: #eff6ff;
    color: #1d4ed8;
    border: 1px solid #bfdbfe;
    border-radius: 6px;
    font-size: 12px;
    text-decoration: none;
    transition: background 0.2s;
}
.lien-btn:hover { background: #dbeafe; }

/* ---- Editable cells ---- */
.editable-cell {
    background: #fffbeb !important;
    border: 1px dashed #f59e0b !important;
    border-radius: 4px;
    outline: none;
    min-width: 80px;
}
.editable-cell:focus {
    background: #fef3c7 !important;
    border-color: #d97706 !important;
    box-shadow: 0 0 0 2px rgba(245,158,11,0.2);
}

/* ---- Popup ---- */
.popup-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    justify-content: center;
    align-items: center;
    z-index: 9999;
}
.popup-content {
    background: var(--surface);
    border-radius: 14px;
    padding: 28px 32px;
    width: 420px;
    max-width: 92%;
    box-shadow: 0 20px 50px rgba(0,0,0,0.2);
    animation: popIn 0.25s ease;
}
.popup-content h2  { font-size: 1.1rem; font-weight: 600; margin-bottom: 12px; }
.popup-content p   { font-size: 14px; color: var(--muted); white-space: pre-line; line-height: 1.6; }
.popup-buttons     { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }
#popup-cancel  { padding: 8px 18px; border-radius: 8px; border: 1.5px solid var(--border); background: transparent; font-family: 'DM Sans', sans-serif; font-size: 14px; cursor: pointer; }
#popup-confirm { padding: 8px 18px; border-radius: 8px; border: none; background: var(--accent); color: white; font-family: 'DM Sans', sans-serif; font-size: 14px; cursor: pointer; }
#popup-cancel:hover  { background: var(--bg); }
#popup-confirm:hover { background: var(--accent-h); }

@keyframes popIn {
    from { opacity: 0; transform: scale(0.92) translateY(10px); }
    to   { opacity: 1; transform: scale(1)    translateY(0); }
}

/* ---- GitHub badge ---- */
.github-info {
    position: fixed;
    top: 18px;
    left: 18px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.6s ease;
    z-index: 9999;
}
.github-info.show { opacity: 1; pointer-events: all; }
.github-btn {
    background: #24292e;
    color: white;
    text-decoration: none;
    padding: 7px 14px;
    border-radius: 8px;
    font-weight: 500;
    font-size: 13px;
    box-shadow: var(--shadow);
    transition: background 0.2s;
}
.github-btn:hover { background: #444c56; color: white; }
.github-bulle {
    background: var(--surface);
    color: var(--text);
    padding: 10px 12px;
    border-radius: 8px;
    max-width: 230px;
    font-size: 13px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border);
    position: relative;
}
.github-bulle::before {
    content: "";
    position: absolute;
    top: -7px;
    left: 22px;
    border-width: 0 7px 7px 7px;
    border-style: solid;
    border-color: transparent transparent var(--border) transparent;
}
.github-bulle::after {
    content: "";
    position: absolute;
    top: -6px;
    left: 22px;
    border-width: 0 7px 7px 7px;
    border-style: solid;
    border-color: transparent transparent var(--surface) transparent;
}

/* ---- Login form (réutilisé si besoin) ---- */
.login-form { background: var(--surface); padding: 36px; border-radius: 14px; box-shadow: var(--shadow-md); width: 320px; text-align: center; }
.login-title { margin-bottom: 22px; color: var(--text); font-weight: 600; }
.login-input { display: block; width: 100%; margin: 10px 0; padding: 11px 14px; border: 1.5px solid var(--border); border-radius: 8px; font-family: 'DM Sans', sans-serif; font-size: 15px; outline: none; transition: border 0.2s, box-shadow 0.2s; }
.login-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(67,97,238,0.15); }
.login-button { margin-top: 18px; width: 100%; padding: 12px; background: var(--accent); border: none; border-radius: 8px; color: white; font-size: 15px; font-weight: 500; cursor: pointer; transition: 0.2s; }
.login-button:hover { background: var(--accent-h); }
.login-error { color: #dc2626; margin-bottom: 14px; font-size: 13px; background: #fee2e2; padding: 8px; border-radius: 6px; }
