/* --- Importaciones y Variables de Color --- */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;600;700&display=swap');

:root {
    --primary-color: #007BFF; /* Un azul vibrante */
    --secondary-color: #6C757D; /* Un gris suave */
    --success-color: #28A745; /* Verde para éxitos */
    --danger-color: #DC3545; /* Rojo para peligros/errores */
    --light-color: #F8F9FA; /* Fondo claro */
    --dark-color: #343A40; /* Texto oscuro */
    --font-family: 'Poppins', sans-serif;
}

/* --- Estilos Globales y Reset --- */
body {
    font-family: var(--font-family);
    background-color: var(--light-color);
    color: var(--dark-color);
    margin: 0;
    line-height: 1.6;
}

.container {
    max-width: 960px;
    margin: 0 auto;
    padding: 20px;
}

h1, h2, h3 {
    color: var(--dark-color);
    font-weight: 600;
}

a {
    color: var(--primary-color);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* --- Layout (Cabecera, Navegación, Pie) --- */
header {
    background-color: #fff;
    border-bottom: 1px solid #ddd;
    padding: 10px 0;
}

header nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 960px;
    margin: 0 auto;
    padding: 0 20px;
}

header nav a {
    font-size: 1.5em;
    font-weight: 700;
    color: var(--primary-color);
}

header nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    gap: 20px;
}

header nav ul li a {
    font-weight: 400;
    color: var(--dark-color);
}

main {
    padding: 20px 0;
}

footer {
    text-align: center;
    margin-top: 40px;
    padding: 20px;
    font-size: 0.9em;
    color: var(--secondary-color);
    border-top: 1px solid #ddd;
}

/* --- Componentes (Botones, Formularios, Tarjetas) --- */
.button, button {
    display: inline-block;
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    font-family: var(--font-family);
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    transition: background-color 0.2s;
}

.button-primary, button[type="submit"] {
    background-color: var(--primary-color);
    color: white;
}
.button-primary:hover, button[type="submit"]:hover {
    background-color: #0056b3;
    text-decoration: none;
}

.button-secondary {
    background-color: var(--secondary-color);
    color: white;
}
.button-secondary:hover {
    background-color: #5a6268;
    text-decoration: none;
}

.button-danger {
    background-color: var(--danger-color);
    color: white;
}
.button-danger:hover {
    background-color: #c82333;
    text-decoration: none;
}

.dashboard-actions {
    display: flex;
    gap: 15px;
    margin-top: 20px;
}

/* Estilos para Formularios */
form div {
    margin-bottom: 15px;
}

label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
}

input[type="text"],
input[type="email"],
input[type="tel"],
input[type="password"],
input[type="file"] {
    width: 100%;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 5px;
    box-sizing: border-box; /* Importante para que el padding no afecte el ancho total */
}

input[type="checkbox"] {
    margin-right: 10px;
}

/* Estilos para la Lista de Mascotas */
.pet-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.pet-card {
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
}

.pet-card h3 {
    margin-top: 0;
}

.pet-photo img {
    max-width: 100%;
    height: auto;
    border-radius: 5px;
    margin-bottom: 15px;
}

.no-photo-placeholder {
    background-color: #e9ecef;
    color: var(--secondary-color);
    text-align: center;
    padding: 40px 0;
    border-radius: 5px;
    margin-bottom: 15px;
}

.pet-info p {
    margin: 5px 0;
}

.pet-actions {
    margin-top: auto; /* Empuja los botones hacia abajo */
    display: flex;
    gap: 10px;
    padding-top: 15px;
}

/* Mensajes de Éxito y Error */
p[style*="color: red"], .error {
    color: var(--danger-color);
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    padding: 10px;
    border-radius: 5px;
}

p[style*="color: green"], .success {
    color: var(--success-color);
    background-color: #d4edda;
    border: 1px solid #c3e6cb;
    padding: 10px;
    border-radius: 5px;
}

/* Estilos para la tabla de usuarios */
.styled-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
    font-size: 0.9em;
}

.styled-table thead tr {
    background-color: var(--dark-color);
    color: #ffffff;
    text-align: left;
}

.styled-table th, .styled-table td {
    padding: 12px 15px;
}

.styled-table tbody tr {
    border-bottom: 1px solid #dddddd;
}

.styled-table tbody tr:nth-of-type(even) {
    background-color: #f3f3f3;
}

.styled-table tbody tr:last-of-type {
    border-bottom: 2px solid var(--primary-color);
}

.role-badge {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.8em;
    font-weight: bold;
    color: white;
}

.role-admin {
    background-color: var(--danger-color);
}

.role-resident {
    background-color: var(--success-color);
}

/* Estilos para los mensajes flash */
.flash-message {
    padding: 15px;
    margin-bottom: 20px;
    border-radius: 5px;
    text-align: center;
    font-weight: 600;
    animation: fadeInOut 4s ease-in-out; /* Animación para que aparezca y desaparezca */
}

.flash-message.success {
    background-color: var(--success-color);
    color: white;
}

.flash-message.error {
    background-color: var(--danger-color);
    color: white;
}

@keyframes fadeInOut {
    0% { opacity: 0; transform: translateY(-20px); }
    15% { opacity: 1; transform: translateY(0); }
    85% { opacity: 1; transform: translateY(0); }
    100% { opacity: 0; transform: translateY(-20px); }
}