/* Estilos Base Mobile-First */
body { 
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; 
    margin: 0; 
    padding: 10px;
    background-color: #eef2f7; 
    color: #333;
}
.container { 
    width: 100%; 
    padding: 15px; 
    background: white; 
    border-radius: 12px; 
    box-shadow: 0 4px 12px rgba(0,0,0,0.1); 
    box-sizing: border-box;
}
h1 { 
    color: #007bff; 
    text-align: center; 
    font-size: 1.8em; 
    margin-bottom: 20px;
}
h2 { 
    color: #555; 
    font-size: 1.4em; 
    border-bottom: 2px solid #eee; 
    padding-bottom: 5px;
    margin-top: 25px;
}

/* Formulário */
form { 
    background: #f8f9fa; 
    padding: 15px; 
    border-radius: 8px; 
    margin-bottom: 20px; 
    display: flex; 
    flex-direction: column;
}
form label { 
    font-weight: bold; 
    margin-bottom: 5px; 
    color: #333;
}
form input[type="text"] { 
    width: 100%; 
    padding: 10px; 
    margin-bottom: 10px; 
    border: 1px solid #ccc; 
    border-radius: 6px; 
    box-sizing: border-box;
}
form button { 
    padding: 10px 15px; 
    background: #007bff; 
    color: white; 
    border: none; 
    border-radius: 6px; 
    cursor: pointer; 
    font-weight: bold;
}
form button:hover { background: #0056b3; }

/* Mensagens */
.mensagem { 
    padding: 12px; 
    margin-bottom: 15px; 
    border-radius: 6px; 
    font-weight: bold;
}
.sucesso { background-color: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.erro { background-color: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }

/* Lista de QR Codes (Mobile) */
.qr-card-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
    width: 100%; 
    box-sizing: border-box;
}
.qr-card {
    border: 1px solid #ddd;
    border-radius: 8px;
    background: #fff;
    padding: 15px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}
.qr-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid #eee;
}
.qr-thumb { 
    width: 80px; 
    height: 80px; 
    object-fit: contain; 
    border: 1px solid #ccc;
    border-radius: 4px;
    order: 1; /* Coloca a imagem no final do header flex */
}
.qr-details {
    flex-grow: 1;
    order: 0; /* Coloca os detalhes no início */
    padding-right: 10px;
}
.qr-item-label {
    font-weight: bold;
    color: #555;
    display: block;
    font-size: 0.9em;
    margin-top: 8px;
}
.qr-item-value {
    word-break: break-all;
    font-size: 0.9em;
}
.qr-item-value a {
    color: #007bff;
}

/* Status */
.status-ativo { color: green; font-weight: bold; }
.status-desativado { color: orange; font-weight: bold; }

/* Ações MOBILE: Botões empilhados verticalmente para evitar scroll */
.acoes-container {
    display: flex;
    flex-direction: column; /* Empilha verticalmente */
    gap: 8px;
    margin-top: 15px;
}
.acoes-container a, .acoes-container button {
    text-decoration: none; 
    padding: 10px; 
    border-radius: 6px; 
    font-size: 1em;
    display: flex;
    align-items: center;
    gap: 10px;
    justify-content: center; /* Centraliza texto e ícone */
    width: 100%; /* Ocupa toda a largura */
    box-sizing: border-box;
}

/* Cores dos Botões */
.btn-ativar { background-color: green; color: white; border: none; }
.btn-desativar { background-color: orange; color: white; border: none; }
.btn-excluir { background-color: red; color: white; border: none; }
.btn-compartilhar { background-color: #00cc66; color: white !important; border: none; }
.btn-download { background-color: #007bff; color: white !important; }

/* Tabela Desktop (Visível apenas em telas grandes) */
.table-desktop, .table-desktop table, .table-desktop thead {
    display: none !important;
}

/* Media Query para Desktop (Telas Maiores) */
@media (min-width: 768px) {
    .container { 
        max-width: 1200px; 
        padding: 30px; 
        margin: 20px auto;
    }
    .qr-card-list {
        display: none !important; /* Oculta o layout mobile no desktop */
    }
    .table-desktop {
        display: block !important; /* Mostra a tabela tradicional no desktop */
        overflow-x: hidden; 
    }
    .table-desktop table {
        display: table !important;
        width: 100%;
        border-collapse: collapse;
    }
    .table-desktop thead {
        display: table-header-group !important;
    }
    .table-desktop table th, .table-desktop table td {
        padding: 10px;
        text-align: left;
        border: 1px solid #ddd;
    }
    .table-desktop .qr-thumb {
        width: 60px;
        height: 60px;
    }
    .table-desktop .acoes-container {
        display: flex;
        flex-direction: row; /* Volta a alinhar horizontalmente no desktop */
        gap: 5px;
        flex-wrap: wrap;
        margin-top: 0;
    }
    .table-desktop .acoes-container a, .table-desktop .acoes-container button {
        flex-grow: 0;
        font-size: 0.8em;
        min-width: auto;
        padding: 5px 8px;
    }
}