/* assets/css/style.css */

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* NUEVO: que html y body ocupen todo el alto */
html, body {
    height: 100%;
}

/* MODIFICADO: convertimos body en contenedor flex vertical */
body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background-color: #f5f6fa;
    color: #222;

    min-height: 100vh;          /* ocupa al menos toda la altura visible */
    display: flex;              /* hace que header, main, footer se apilen en columna */
    flex-direction: column;
}

/* Layout general */
.av-container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 15px;
}

/* Header */
.av-header {
    background: #101820;
    color: #fff;
    padding: 12px 0;
    border-bottom: 3px solid #cba135; /* dorado suave */
}

.av-logo {
    float: left;
}

.av-logo-main {
    font-weight: 600;
    font-size: 1.3rem;
}

.av-logo-sub {
    display: block;
    font-size: 0.8rem;
    color: #d0d0d0;
}

.av-nav {
    float: right;
}

.av-nav a {
    color: #fff;
    text-decoration: none;
    margin-left: 15px;
    font-size: 0.95rem;
}

.av-nav a:hover {
    text-decoration: underline;
}

.av-nav-user {
    color: #cba135;
    margin-left: 15px;
    font-weight: 500;
}

.av-nav-logout {
    color: #ffb3b3;
}

/* Clear floats */
.av-header::after {
    content: "";
    display: block;
    clear: both;
}

/* Main */
/* MODIFICADO: .av-main ahora “se estira” para ocupar el espacio y empujar el footer abajo */
.av-main {
    padding: 30px 0;
    flex: 1 0 auto;  /* clave para el sticky footer */
}

/* Footer */
/* MODIFICADO: evitamos que se achique; puede quedar con margin-top si te gusta ese espacio */
.av-footer {
    flex-shrink: 0;           /* el footer no se comprime */
    border-top: 1px solid #ddd;
    padding: 15px 0;
    font-size: 0.85rem;
    color: #555;
    margin-top: 30px;
    background: #fff;
    text-align: center;
}

/* Tarjeta central */
.av-card {
    background: #fff;
    border-radius: 6px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.06);
    margin-bottom: 20px;
}

.av-card-title {
    font-size: 1.2rem;
    margin-bottom: 10px;
    border-bottom: 1px solid #eee;
    padding-bottom: 6px;
}

.av-card-text {
    font-size: 0.95rem;
    line-height: 1.5;
    color: #444;
}

/* Botón principal */
.av-btn {
    display: inline-block;
    padding: 2px 18px;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    font-size: 0.95rem;
    text-decoration: none;
    text-align: center;
}

/* Estado "loading" genérico para cualquier botón */
.av-btn.av-btn-loading {
    opacity: 0.75;
    cursor: wait;
    pointer-events: none;
}

/* Spinner minimalista */
.av-spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    margin-right: 6px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-top-color: #ffffff;
    animation: av-spin 0.6s linear infinite;
    vertical-align: middle;
}

.av-btn-loading-text {
    vertical-align: middle;
}

@keyframes av-spin {
    to {
        transform: rotate(360deg);
    }
}

.av-btn-primary {
    background: #1a73e8;
    color: #fff;
}

.av-btn-primary:hover {
    background: #1559b3;
}

/* Botón tipo "Ingresar con Google" (custom simple) */
.av-btn-google {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #fff;
    border: 1px solid #dadce0;
    color: #3c4043;
}

.av-btn-google img {
    width: 18px;
    height: 18px;
}

/* Responsive */
@media (max-width: 768px) {
    .av-logo, .av-nav {
        float: none;
        text-align: center;
    }

    .av-nav {
        margin-top: 10px;
    }
}

/* ===========================
   Tablas de administración
   =========================== */

.av-card-subtitle {
    margin-top: 4px;
    color: #666;
    font-size: 0.9rem;
}

.av-card-meta {
    margin-bottom: 6px;
    color: #666;
    font-size: 0.85rem;
}

.av-card-header-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 16px;
}

.av-card-header-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.av-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: flex-end;
    margin-bottom: 10px;
}

.av-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 0.9rem;
}

.av-field-grow {
    flex: 1 1 220px;
}

.av-table-wrapper {
    margin-top: 8px;
    overflow-x: auto;
}

.av-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    font-size: 0.9rem;
}

.av-table thead {
    background: #f0f2f7;
}

.av-table th,
.av-table td {
    padding: 3px 5px;
    border-bottom: 1px solid #eee;
    text-align: left;
    vertical-align: top;
}

.av-table th {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #666;
    white-space: nowrap;
}

.av-table tbody tr:nth-child(even) {
    background: #fafbff;
}

.av-table tbody tr:hover {
    background: #eef3ff;
}

.av-col-id-id {
    font-weight: 600;
    color: #333;
    font-size: 0.85rem;
}

.av-col-id-code {
    font-size: 0.8rem;
    color: #777;
}

.av-col-usuario-nom {
    font-weight: 500;
}

.av-col-usuario-email {
    font-size: 0.8rem;
    color: #777;
}

.av-col-titulo {
    max-width: 260px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.av-col-acciones .av-link {
    font-size: 0.85rem;
}

/* Píldoras de estado */
.av-pill {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 500;
    border: 1px solid transparent;
}

/* Pill de alerta tipo "mensaje nuevo" */
.av-pill-alerta {
    background: #fff3cd;
    color: #856404;
}

.av-pill-nueva {
    background: #e3f2fd;
    color: #1565c0;
}

.av-pill-en_revision {
    background: #fff8e1;
    color: #f57f17;
}

.av-pill-pendiente {
    background: #fff8e1;
    color: #8a6d3b;
}

.av-pill-rechazada {
    background: #ffebee;
    color: #b71c1c;
}

.av-pill-respondida_sin_pagar {
    background: #fce4ec;
    color: #c2185b;
}

.av-pill-pagada {
    background: #e8f5e9;
    color: #2e7d32;
}

.av-pill-cerrada {
    background: #eceff1;
    color: #455a64;
}

/* Menú interno del panel de administración */
.av-admin-menu {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 12px 0 20px 0;
}

.av-admin-menu-item {
    display: inline-block;
    padding: 6px 14px;
    border-radius: 999px;
    background: #f5f5f5;
    color: #333;
    font-size: 0.9rem;
    text-decoration: none;
    border: 1px solid transparent;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.av-admin-menu-item:hover {
    background: #e3f2fd;
    border-color: #90caf9;
    color: #0d47a1;
}

@media (max-width: 768px) {
    .av-card-header-row {
        flex-direction: column;
        align-items: stretch;
    }

    .av-card-header-actions {
        justify-content: flex-start;
    }
}

.av-legal-text h1,
.av-legal-text h2,
.av-legal-text h3 {
    margin-top: 1rem;
    margin-bottom: 0.5rem;
}

.av-legal-text p {
    margin-bottom: 0.6rem;
}

.av-legal-text ul {
    margin: 0 0 0.8rem 1.2rem;
}

.av-legal-text li {
    margin-bottom: 0.3rem;
}

/* Acciones con iconos en tablas */
.av-col-acciones {
    white-space: nowrap;
}

.av-inline-form {
    display: inline;
}

.av-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    margin-left: 2px;
    margin-right: 2px;
    border-radius: 999px;
    border: 1px solid #ddd;
    background: #f5f5f5;
    cursor: pointer;
    font-size: 0.85rem;
    line-height: 1;
    text-decoration: none;
    color: #333;
    vertical-align: middle;
}

.av-icon-btn:first-child {
    margin-left: 0;
}

.av-icon-btn:hover {
    background: #e3f2fd;
    border-color: #90caf9;
    color: #0d47a1;
}

.av-icon-btn-danger {
    background: #ffe5e5;
    border-color: #f5c2c2;
    color: #b71c1c;
}

.av-icon-btn-danger:hover {
    background: #ffcdd2;
    border-color: #ef9a9a;
    color: #b71c1c;
}

/* ===========================
   Dashboard / tarjetas de stats
   =========================== */

.av-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-top: 20px;
}

.av-stat-card {
    background: #fff;
    border-radius: 8px;
    padding: 16px 18px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.04);
    border-top: 3px solid transparent;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.av-stat-label {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #777;
}

.av-stat-value {
    font-size: 2rem;
    font-weight: 600;
    color: #222;
}

.av-stat-sub {
    font-size: 0.85rem;
    color: #666;
}

/* Colores por tipo de stat */
.av-stat-total {
    border-top-color: #90caf9;
}

.av-stat-nuevas {
    border-top-color: #ffb74d;
}

.av-stat-revision {
    border-top-color: #9575cd;
}

.av-stat-sin-pagar {
    border-top-color: #ef5350;
}

.av-stat-pagadas {
    border-top-color: #66bb6a;
}

/* Hilo de conversación (chat simple) */
/* Hilo de conversación (chat tipo burbujas) */
.av-thread-wrapper {
    margin: 6px 0 14px;
    padding: 8px 10px;
    background: #fafafa;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
    max-height: 300px;       /* alto máximo visible */
    overflow-y: auto;        /* scroll si hay muchos mensajes */
}

/* Lista del hilo */
.av-thread {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Burbuja base */
.av-thread-item {
    position: relative;
    max-width: 75%;
    padding: 8px 10px;
    border-radius: 12px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
    font-size: 0.9rem;
}

/* Mensajes del usuario (izquierda) */
.av-thread-usuario {
    align-self: flex-start;
    background: #e3f2fd;
}

/* Mensajes del abogado (derecha) */
.av-thread-abogado {
    align-self: flex-end;
    background: #e8f5e9;
}

/* Línea con nombre y fecha */
.av-thread-meta {
    font-size: 0.75rem;
    color: #555;
    margin-bottom: 4px;
    opacity: 0.9;
}

/* Texto del mensaje */
.av-thread-body {
    font-size: 0.9rem;
    white-space: pre-wrap;
}

/* Separador de días en el hilo */
.av-thread-day {
    align-self: center;
}

.av-thread-day span {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 999px;
    background: #ffffff;
    border: 1px solid #e0e0e0;
    font-size: 0.75rem;
    color: #999;
}

/* Mensaje cuando no hay hilo */
.av-thread-empty {
    font-size: 0.9rem;
    color: #777;
    text-align: center;
}

.av-thread-block + .av-thread-block {
    margin-top: 6px;      /* separa un poco más los bloques */
}

.av-thread-title {
    font-weight: 600;
    margin-bottom: 6px;
}

.av-btn-danger {
    background-color: #d32f2f;
    border-color: #c62828;
    color: #fff;
}

.av-btn-danger:hover {
    background-color: #b71c1c;
    border-color: #b71c1c;
}
