/* --- Google Font Import --- */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600&display=swap');

/* --- Definición de Variables (Tema) --- */
:root {
    --font-primary: 'Poppins', sans-serif;
    --color-primary: #3498db; /* Azul principal más vibrante */
    --color-primary-dark: #2980b9;
    --color-secondary: #2c3e50; /* Azul oscuro para el menú */
    --color-secondary-light: #34495e;
    --color-danger: #e74c3c;
    --color-danger-dark: #c0392b;
    --color-background: #f4f7f9;
    --color-surface: #ffffff; /* Color para las tarjetas */
    --color-text-primary: #333;
    --color-text-secondary: #ecf0f1; /* Texto para fondos oscuros */
    --color-border: #dde2e6;
    --shadow-soft: 0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-medium: 0 6px 20px rgba(0, 0, 0, 0.1);
    --border-radius: 8px;
}

/* --- Estilos Generales --- */
* {
    box-sizing: border-box;
}

body {
    font-family: var(--font-primary);
    background-color: var(--color-background);
    margin: 0;
    color: var(--color-text-primary);
    line-height: 1.6;
}

h1, h2, h3, h4 {
    font-weight: 600;
}

.hidden {
    display: none !important;
}

.container {
    width: 100%;
    max-width: 400px;
    margin: 5% auto;
}

.card {
    background-color: var(--color-surface);
    border-radius: var(--border-radius);
    padding: 30px;
    box-shadow: var(--shadow-soft);
    margin-bottom: 25px;
    border: 1px solid var(--color-border);
}

/* --- Contenedor Principal de la App --- */
#app-container {
    width: 100%;
    max-width: none;
    margin: 0;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 30px;
    background-color: var(--color-surface);
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    border-bottom: 1px solid var(--color-border);
}

header h1 {
    margin: 0;
    font-size: 1.6em;
    color: var(--color-secondary);
}

.user-info span {
    margin-right: 15px;
    font-weight: 500;
    text-transform: capitalize;
}

/* --- Layout de la App (Menú + Contenido) --- */
.app-layout {
    display: flex;
    height: calc(100vh - 72px);
}

#sidebar-menu {
    width: 240px;
    background-color: var(--color-secondary);
    color: var(--color-text-secondary);
    padding-top: 20px;
    flex-shrink: 0;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 15px 25px;
    color: var(--color-text-secondary);
    text-decoration: none;
    border-left: 4px solid transparent;
    transition: background-color 0.2s ease, border-left-color 0.2s ease;
    font-weight: 500;
}

.menu-item:hover {
    background-color: var(--color-secondary-light);
}

.menu-item.active {
    background-color: var(--color-secondary-light);
    border-left: 4px solid var(--color-primary);
    font-weight: 600;
}

#main-content {
    flex-grow: 1;
    padding: 30px;
    overflow-y: auto;
}

/* --- Formularios y Botones --- */
form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

input[type="text"], input[type="password"], input[type="file"], select {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius);
    box-sizing: border-box;
    font-family: var(--font-primary);
    font-size: 1em;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input[type="text"]:focus, input[type="password"]:focus, select:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.3);
}

button {
    background-color: var(--color-primary);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 1em;
    font-weight: 500;
    font-family: var(--font-primary);
    transition: background-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

button:hover {
    background-color: var(--color-primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-medium);
}

#logout-btn {
    background-color: var(--color-danger);
}
#logout-btn:hover {
    background-color: var(--color-danger-dark);
}

/* --- Vistas Específicas --- */
.admin-sections {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

th, td {
    text-align: left;
    padding: 14px;
    border-bottom: 1px solid var(--color-border);
}

th {
    background-color: #f8f9fa;
    font-weight: 600;
}

tr:last-child td {
    border-bottom: none;
}

.filters {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
    align-items: center;
}

/* --- Estilo para la lista de resultados --- */
.result-item-summary {
    border: 1px solid var(--color-border);
    padding: 20px;
    border-radius: var(--border-radius);
    margin-top: 15px;
    cursor: pointer;
    transition: background-color 0.2s, box-shadow 0.2s, transform 0.2s;
}

.result-item-summary:hover {
    background-color: var(--color-surface);
    transform: translateY(-3px);
    box-shadow: var(--shadow-medium);
}

.result-item-summary h4 {
    margin: 0 0 8px 0;
    color: var(--color-secondary);
    font-size: 1.1em;
}

.result-item-summary p {
    margin: 0;
    font-size: 0.9em;
    color: #666;
}

/* --- Estilo para la vista de detalle --- */
.back-button {
    background-color: #6c757d;
    margin-bottom: 20px;
    font-size: 0.9em;
    font-weight: 500;
}

.back-button:hover {
    background-color: #5a6268;
}

#detail-view .card p {
    margin: 8px 0;
    font-size: 1.05em;
}

#detail-view .card strong {
    color: var(--color-secondary);
}

#detail-view hr {
    border: none;
    border-top: 1px solid var(--color-border);
    margin: 20px 0;
}

/* --- Mensaje de error del login --- */
.error-message {
    color: var(--color-danger);
    font-size: 0.9em;
    text-align: center;
    margin-top: 10px;
    font-weight: 500;
}

#login-container h2 {
    text-align: center;
    color: var(--color-secondary);
    margin-bottom: 25px;
}
