:root {
    --primary: #2c3e50;
    --accent: #e67e22;
    --success: #27ae60;
    --bg: #f4f7f6;
    --white: #ffffff;
}

* { box-sizing: border-box; margin: 0; padding: 0; font-family: 'Segoe UI', sans-serif; }
body { background-color: var(--bg); color: #333; }

header { background: var(--primary); color: white; padding: 1rem; text-align: center; box-shadow: 0 2px 5px rgba(0,0,0,0.1); }
.logo { font-size: 1.5rem; font-weight: bold; }

main { max-width: 800px; margin: 2rem auto; padding: 0 1rem; }

/* Busca e Stats */
.search-container { display: flex; gap: 10px; margin-bottom: 1rem; }
input[type="text"] { flex: 1; padding: 12px; border: 1px solid #ddd; border-radius: 5px; font-size: 1rem; }
button { padding: 10px 20px; border: none; border-radius: 5px; cursor: pointer; font-size: 1rem; transition: 0.2s; }
#btnSearch { background-color: #34495e; color: white; }
#btnSearch:hover { background-color: var(--primary); }

.stats-bar { display: flex; justify-content: space-around; background: white; padding: 15px; border-radius: 5px; margin-bottom: 20px; box-shadow: 0 2px 5px rgba(0,0,0,0.05); }
.stats-bar b { color: var(--primary); }

/* --- CARD DO ATLETA (CLICÁVEL) --- */
.runner-card { 
    background: white; padding: 15px; margin-bottom: 15px; border-radius: 8px; 
    box-shadow: 0 2px 4px rgba(0,0,0,0.05); border-left: 6px solid #ccc; 
    display: flex; justify-content: space-between; align-items: center;
    cursor: pointer; /* Indica clique */
    transition: transform 0.1s, box-shadow 0.1s;
}

.runner-card:hover { transform: translateY(-2px); box-shadow: 0 4px 8px rgba(0,0,0,0.1); }
.runner-card:active { transform: scale(0.99); }

.runner-card.status-pendente { border-left-color: var(--accent); }
.runner-card.status-entregue { border-left-color: var(--success); background: #fcfcfc; opacity: 0.8; }

.runner-info h3 { color: var(--primary); margin-bottom: 5px; font-size: 1.1rem; }
.runner-info p { font-size: 0.9rem; color: #555; margin: 2px 0; }
.click-hint { font-size: 0.8rem; color: #999; margin-top: 5px; font-style: italic; }

.badge { padding: 6px 12px; border-radius: 20px; font-size: 0.85rem; font-weight: bold; color: white; background: var(--success); }
.badge-pendente { background: var(--accent); }

/* --- MODAL --- */
.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); display: flex; justify-content: center; align-items: center; z-index: 1000; }
.hidden { display: none !important; }
.modal-content { background: white; width: 95%; max-width: 500px; border-radius: 8px; overflow: hidden; box-shadow: 0 5px 15px rgba(0,0,0,0.3); display: flex; flex-direction: column; max-height: 90vh; }
.modal-header { background: var(--primary); color: white; padding: 15px; display: flex; justify-content: space-between; align-items: center; }
.close-btn { background: none; border:none; color: white; font-size: 1.4rem; cursor: pointer; }

.modal-body { padding: 20px; overflow-y: auto; }

/* Detalhes do Atleta no Modal */
.runner-details h3 { color: var(--primary); margin-bottom: 10px; border-bottom: 2px solid #eee; padding-bottom: 5px; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 15px; }
.detail-grid p { font-size: 0.95rem; color: #555; }
.detail-grid strong { color: #333; }

.divider { border: 0; border-top: 1px solid #ddd; margin: 15px 0; }

/* Formulário de Entrega */
#deliveryFormArea h4 { color: var(--accent); margin-bottom: 10px; }
.radio-group { display: flex; gap: 15px; margin-top: 10px; background: #f8f9fa; padding: 10px; border-radius: 5px; }
.radio-option { display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: 0.9rem; font-weight: 600; }

.box-terceiro { margin-top: 10px; background: #fff3cd; padding: 15px; border-radius: 5px; border: 1px solid #ffeeba; }
.box-terceiro h5 { color: #856404; margin-bottom: 10px; }

.form-group { margin-bottom: 10px; }
.form-group label { display: block; margin-bottom: 4px; font-size: 0.85rem; font-weight: bold; }
.form-group input { width: 100%; padding: 8px; border: 1px solid #ccc; border-radius: 4px; }

.info-box { background: #d4edda; color: #155724; padding: 15px; border-radius: 5px; text-align: center; font-weight: bold; }

.modal-footer { padding: 15px; background: #eee; text-align: right; }
.btn-success { background-color: var(--success); color: white; width: 100%; padding: 12px; font-weight: bold; font-size: 1rem; border-radius: 5px; border: none; cursor: pointer; }
.btn-success:disabled { background-color: #95a5a6; cursor: not-allowed; }

/* Adicione isso ao final do seu CSS ou junto com os outros botões */

.btn-clear {
    background-color: #95a5a6; /* Cinza */
    color: white;
    margin-left: 5px; /* Espacinho do botão buscar */
}

.btn-clear:hover {
    background-color: #7f8c8d; /* Cinza mais escuro ao passar o mouse */
}

/* Adicione no final do seu arquivo CSS */

.btn-danger {
    background-color: #e74c3c; /* Vermelho */
    color: white;
    width: 100%;
    padding: 10px;
    border: none;
    border-radius: 5px;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.3s;
    margin-top: 10px;
}

.btn-danger:hover {
    background-color: #c0392b; /* Vermelho mais escuro */
}

/* --- ADICIONE ISTO AO FINAL DO SEU STYLE.CSS --- */

/* Ajustes para Telemóveis (Responsividade) */
@media (max-width: 768px) {
    
    main {
        margin: 1rem auto;
        padding: 0 10px; /* Menos margem lateral */
    }

    /* Cabeçalho mais compacto */
    header {
        padding: 0.8rem;
    }
    header .logo {
        font-size: 1.2rem; /* Logo um pouco menor */
    }
    #userDisplay {
        display: none; /* Esconde o email no topo para poupar espaço */
    }

    /* Barra de Busca Empilhada */
    .search-container {
        flex-direction: column; /* Input em cima, botões em baixo */
        gap: 8px;
    }
    
    .search-container input {
        width: 100%;
        padding: 15px; /* Área de toque maior */
    }

    .search-container button {
        width: 100%; /* Botões ocupam a largura toda */
        padding: 12px;
    }

    /* Estatísticas em Coluna ou Grade */
    .stats-bar {
        display: grid;
        grid-template-columns: 1fr 1fr; /* Lado a lado */
        gap: 10px;
        text-align: center;
        font-size: 0.9rem;
    }

    /* Card do Atleta - Layout Vertical */
    .runner-card {
        flex-direction: column; /* Info em cima, Status em baixo */
        align-items: flex-start;
        gap: 15px;
        padding: 20px; /* Mais fácil de clicar */
    }

    .runner-info h3 {
        font-size: 1.2rem;
    }

    .status-area {
        width: 100%; /* Badge ocupa largura total */
        text-align: center;
        margin-top: 5px;
    }
    
    .badge {
        display: block;
        width: 100%;
        padding: 10px; /* Badge maior */
    }

    /* Modal Ocupando mais espaço */
    .modal-content {
        width: 95%; /* Quase a largura toda */
        max-height: 90vh; /* Altura máxima de 90% da tela */
        overflow-y: auto; /* Permite rolar se o conteúdo for grande */
    }

    .detail-grid {
        grid-template-columns: 1fr; /* Detalhes um por linha */
    }

    /* Aumentar botões de rádio para dedos */
    .radio-option {
        padding: 10px;
        border: 1px solid #eee;
        border-radius: 5px;
        width: 100%; /* Opções ocupam largura total */
        margin-bottom: 5px;
    }
    
    .radio-group {
        flex-direction: column; /* Opções verticais */
    }

    /* Botões de Ação Grandes */
    .btn-success, .btn-danger {
        padding: 15px;
        font-size: 1.1rem;
    }
}