/* Candidates Modal — scoped under .candidates-modal on the root element */
.candidates-modal {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.candidates-modal.visible {
    opacity: 1;
    visibility: visible;
}

.candidates-modal .modal-content {
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    width: 90%;
    max-width: 720px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    position: relative;
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.candidates-modal.visible .modal-content {
    transform: scale(1);
}

.candidates-modal .modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2rem;
    border-bottom: 1px solid #e9ecef;
}

.candidates-modal .modal-header h2 {
    margin: 0;
    color: #333;
    font-size: 1.5rem;
    font-weight: 600;
}

.candidates-modal .modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #6c757d;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.candidates-modal .modal-close:hover {
    background: #e9ecef;
    color: #495057;
}

.candidates-modal .modal-body {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    padding: 2rem;
    flex: 1;
    overflow-y: auto;
}

.candidates-modal .modal-body > * {
    width: 100%;
    box-sizing: border-box;
}

.candidates-modal .modal-footer {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 1.5rem 2rem;
    border-top: 1px solid #e9ecef;
}

.candidates-modal .modal-footer .btn { width: 100%; }

.candidates-modal .loading-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 1rem;
    text-align: center;
}

.candidates-modal .loading-container .spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

.candidates-modal .loading-container p {
    color: #6c757d;
    margin: 0;
}

.candidates-modal .empty-state {
    text-align: center;
    padding: 3rem 1rem;
}

.candidates-modal .empty-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.candidates-modal .empty-state h3 {
    color: #333;
    margin: 0 0 0.5rem 0;
    font-size: 1.25rem;
}

.candidates-modal .empty-state p {
    color: #6c757d;
    margin: 0;
}

.candidates-modal .candidates-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.candidates-modal .candidate-item {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 1rem;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
}

.candidates-modal .candidate-item:hover {
    border-color: #667eea;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.1);
}

.candidates-modal .candidate-info {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

/* ── Desktop ───────────────────────────────────────────────── */
@media (min-width: 769px) {
    .candidates-modal {
        padding-left: 250px;
    }

    .candidates-modal .candidate-info {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }

    .candidates-modal .candidate-details {
        flex: 1;
        min-width: 0;
    }

    .candidates-modal .candidate-status {
        flex-shrink: 0;
    }

    .candidates-modal .detail-row {
        display: grid;
        grid-template-columns: 120px 1fr;
        column-gap: 1rem;
        align-items: center;
    }

    .candidates-modal .modal-footer {
        flex-direction: row;
        justify-content: flex-end;
    }

    .candidates-modal .modal-footer .btn {
        width: auto;
        flex: 1;
    }
}

.candidates-modal .candidate-details { flex: 1; }

.candidates-modal .detail-row {
    display: flex;
    margin-bottom: 0.5rem;
    align-items: center;
}

.candidates-modal .detail-row:last-child { margin-bottom: 0; }

.candidates-modal .detail-row .label {
    font-weight: 600;
    color: #495057;
    min-width: 120px;
    margin-right: 0.5rem;
}

.candidates-modal .detail-row .value {
    color: #212529;
    font-weight: 500;
}

.candidates-modal .candidate-status {
    display: flex;
    align-items: center;
    align-self: stretch;
    justify-content: space-between;
    gap: 0.5rem;
}

.candidates-modal .status-badge {
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 500;
    text-align: center;
    min-width: 80px;
}

.candidates-modal .status-1 { background: #fff3cd; color: #856404; border: 1px solid #ffeaa7; }
.candidates-modal .status-2 { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.candidates-modal .status-3 { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }
.candidates-modal .status-4 { background: #e2e3e5; color: #383d41; border: 1px solid #d6d8db; }
.candidates-modal .status-5 { background: #d1ecf1; color: #0c5460; border: 1px solid #bee5eb; }

.candidates-modal .btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border: none;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 100px;
    justify-content: center;
}

.candidates-modal .btn:disabled { opacity: 0.6; cursor: not-allowed; }
.candidates-modal .btn-success { background: #28a745; color: white; }
.candidates-modal .btn-success:hover:not(:disabled) { background: #218838; }
.candidates-modal .btn-danger { background: #dc3545; color: white; }
.candidates-modal .btn-danger:hover:not(:disabled) { background: #c82333; }
.candidates-modal .btn-secondary { background: #6c757d; color: white; }
.candidates-modal .btn-secondary:hover:not(:disabled) { background: #5a6268; }

.candidates-modal .btn-force-approve {
    background: transparent;
    color: #6c757d;
    border: 1px solid #ced4da;
    padding: 0.4rem 0.75rem;
    font-size: 0.8rem;
    min-width: auto;
    width: auto !important;
    flex: none;
}

.candidates-modal .btn-force-approve:hover:not(:disabled) {
    background: #f8f9fa;
    color: #495057;
    border-color: #adb5bd;
}

.candidates-modal .confirm-dialog { max-width: 420px; }

.candidates-modal .confirm-description {
    color: #6c757d;
    font-size: 0.9rem;
    margin-top: 0.25rem;
}

@media (max-width: 768px) {
    .candidates-modal {
        padding: 20px 0 100px 0;
        align-items: flex-start;
    }

    .candidates-modal .modal-content { max-height: calc(100vh - 120px); }

    .candidates-modal .modal-header,
    .candidates-modal .modal-body,
    .candidates-modal .modal-footer { padding: 1rem; }

    .candidates-modal .modal-body {
        max-height: calc(100vh - 260px);
        overflow-y: auto;
    }

}
