body {
    background-color: #f8f9fa;
}

/* Formularios */
.form-group {
    margin-bottom: 15px;
    display: flex;
    flex-direction: column;
    max-width: 400px;
}

.form-group label {
    font-weight: bold;
    margin-bottom: 5px;
}

.form-group input,
.form-group select,
.form-group textarea {
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 15px;
    width: 100%;
    box-sizing: border-box;
}

/* Botones */
.btn {
    background-color: #007bff;
    color: white !important;
    padding: 10px 18px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    text-decoration: none;
    font-size: 15px;
    display: inline-block;
    transition: background-color 0.3s ease;
    margin: 2px;
}

.btn:hover {
    background-color: #0056b3;
}

.btn-cancel {
    background-color: #6c757d;
    color: white !important;
}
.btn-cancel:hover {
    background-color: #5a6268;
}

.btn-success {
    background-color: #28a745;
    color: white !important;
}
.btn-success:hover {
    background-color: #218838;
}

.btn-warning {
    background-color: #ffc107;
    color: black !important;
}
.btn-warning:hover {
    background-color: #e0a800;
}

.btn-primary {
    background-color: #007bff;
}
.btn-primary:hover {
    background-color: #0056b3;
}

.btn-danger {
    background-color: #dc3545;
}
.btn-danger:hover {
    background-color: #a71d2a;
}

.btn-secondary {
    background-color: #6c757d;
}
.btn-secondary:hover {
    background-color: #545b62;
}

/* Barra de filtros */
.filter-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 15px 0;
    flex-wrap: wrap;
}
.filter-bar input[type="text"],
.filter-bar select,
.filter-bar button {
    padding: 8px;
    border: 1px solid #aaa;
    border-radius: 6px;
    font-size: 14px;
    flex: 1 1 150px;
    min-width: 120px;
}

/* Mensajes flash */
.flash-error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    padding: 10px;
    margin-bottom: 15px;
    border-radius: 6px;
    font-weight: bold;
}

.flash-info {
    background-color: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
    padding: 10px;
    margin-bottom: 15px;
    border-radius: 6px;
    font-weight: bold;
}

/* Tablas */
.table-container {
    margin-top: 20px;
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
    font-size: 14px;
    background-color: #fff;
}

.table th,
.table td {
    border: 1px solid #ddd;
    padding: 10px;
    text-align: left;
}

.table th {
    background-color: #f4f4f4;
    font-weight: bold;
}

.table tr:nth-child(even) {
    background-color: #fafafa;
}

.table tr:hover {
    background-color: #f1f1f1;
}

/* Contenedor general */
.container {
    max-width: 1200px;
    margin: auto;
    padding: 15px;
}

/* Cards del dashboard */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.card {
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #ddd;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.card h2 {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 1.4rem;
    margin-bottom: 0.5rem;
    color: #34495e;
    font-weight: 600;
}

.card h2 span.count {
    background: #f0f4ff;
    color: #2c3e50;
    border-radius: 12px;
    padding: 2px 10px;
    font-size: 0.9rem;
    font-weight: bold;
    margin-left: 8px;
}

.card .btn {
    margin-top: 8px;
    background-color: #3498db;
    color: #fff;
    border: none;
    padding: 6px 14px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s ease;
}
.card .btn:hover {
    background-color: #2980b9;
}

/* Formularios generales */
form label {
    display: block;
    margin-top: 10px;
    font-weight: bold;
}
form input,
form select,
form textarea {
    display: block;
    width: 100%;
    max-width: 400px;
    padding: 6px;
    margin-top: 4px;
    margin-bottom: 12px;
    box-sizing: border-box;
}

/* Header con usuario y rol */
.main-header {
    background: #2c3e50;
    color: #fff;
    padding: 10px 20px;
}
.main-header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.user-info {
    font-size: 14px;
}
.user-info span {
    margin-right: 10px;
    font-weight: bold;
}
.btn-logout {
    color: #fff;
    background: #e74c3c;
    padding: 5px 10px;
    text-decoration: none;
    border-radius: 4px;
}
.btn-logout:hover {
    background: #c0392b;
}

/* Media queries para pantallas pequeñas */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }

    h1 {
        font-size: 22px;
    }

    .btn {
        display: block;
        width: 100%;
        margin-bottom: 10px;
        text-align: center;
    }

    .filter-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-bar input,
    .filter-bar select,
    .filter-bar button {
        width: 100%;
    }
}

/* === Tarjetas de Dashboard en filas === */
.cards {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-top: 20px;
}

.card {
    flex: 1 1 calc(33.333% - 20px); /* 3 por fila en escritorio */
    min-width: 220px;
    background: #fff;
    padding: 15px;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.card h2 {
    font-size: 1.2rem;
    margin-bottom: 10px;
}

@media (max-width: 768px) {
    .card {
        flex: 1 1 100%; /* En móvil una por fila */
    }
}

/* Botón de logout adaptable */
.btn-logout {
    color: #fff;
    background: #e74c3c;
    padding: 6px 12px;
    text-decoration: none;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    font-size: 14px;
}

.btn-logout .text {
    display: inline; /* visible en escritorio */
}

.btn-logout .icon {
    display: none; /* oculto en escritorio */
    font-size: 16px;
}

/* En móviles mostrar icono y ocultar texto */
@media (max-width: 768px) {
    .btn-logout .text {
        display: none;
    }
    .btn-logout .icon {
        display: inline;
    }
}

/* === Botón de logout responsivo === */
.btn-logout {
    display: flex;
    align-items: center;
    gap: 5px;
    background: #e74c3c;
    padding: 6px 10px;
    border-radius: 4px;
    text-decoration: none;
    color: #fff;
    font-size: 14px;
}

.btn-logout:hover {
    background: #c0392b;
}

/* Icono y texto se controlan por media query */
.btn-logout .icon {
    display: none; /* oculto por defecto */
    font-size: 16px;
}

.btn-logout .text {
    display: inline;
}

/* En pantallas chicas solo ícono */
@media (max-width: 768px) {
    .btn-logout .text {
        display: none;
    }
    .btn-logout .icon {
        display: inline;
    }
}

.table thead th {
    color: #222 !important; /* texto oscuro */
    background-color: #f0f0f0 !important; /* gris claro */
    font-weight: 600;
}
.table tbody td {
    color: #333;
}

