/*
 * admin-avisos.css
 * Estilos del panel de gestión de Avisos Públicos.
 */

.panel-card {
    max-width: 100% !important;
}

/* ── Barra de acciones superiores ───────────────────────────────── */
.avisos-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 24px;
}

.avisos-help-text {
    margin: 0;
    line-height: 1.9;
}

.avisos-empty {
    text-align: center;
    padding: 48px 20px;
    color: #94a3b8;
    font-size: 15px;
}

.avisos-empty i {
    font-size: 40px;
    display: block;
    margin-bottom: 12px;
    opacity: 0.4;
}

/* ── Tabla de avisos ────────────────────────────────────────────── */
.avisos-table-wrap {
    overflow-x: auto;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
}

.avisos-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.avisos-table th {
    background: #f8fafc;
    padding: 12px 10px;
    text-align: left;
    font-weight: 700;
    color: #475569;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid #e2e8f0;
    white-space: nowrap;
}

.avisos-table td {
    padding: 12px 10px;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: top;
    color: #334155;
}

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

.avisos-table tr:hover td {
    background: #fafbfc;
}

.aviso-row-titulo {
    font-weight: 600;
    color: #1e293b;
    max-width: 100%;
    word-break: break-word;
}

.aviso-row-contenido {
    color: #64748b;
    font-size: 13px;
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.aviso-row-fecha {
    font-size: 12px;
    color: #94a3b8;
    white-space: nowrap;
}

/* ── Badges de tipo y estado ─────────────────────────────────────── */
.badge-tipo {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}
.badge-tipo.info    { background: #eff6ff; color: #1d4ed8; }
.badge-tipo.warning { background: #fffbeb; color: #92400e; }
.badge-tipo.success { background: #ecfdf5; color: #065f46; }
.badge-tipo.danger  { background: #fff1f2; color: #991b1b; }

.badge-estado {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
}
.badge-estado.activo   { background: #dcfce7; color: #15803d; }
.badge-estado.inactivo { background: #f1f5f9; color: #64748b; }
.badge-estado.expirado { background: #fef9c3; color: #a16207; }

/* ── Acciones por fila ───────────────────────────────────────────── */
.aviso-actions {
    display: flex;
    gap: 8px;
    flex-wrap: nowrap;
}

.btn-aviso-edit,
.btn-aviso-delete {
    padding: 6px 12px;
    border-radius: 7px;
    font-size: 12px;
    font-weight: 700;
    border: none;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.btn-aviso-edit {
    background: #eff6ff;
    color: #1d4ed8;
}
.btn-aviso-edit:hover {
    background: #dbeafe;
}

.btn-aviso-delete {
    background: #fff1f2;
    color: #b91c1c;
}
.btn-aviso-delete:hover {
    background: #fecaca;
}

/* ── Modal de crear/editar ───────────────────────────────────────── */
.aviso-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(3px);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.aviso-modal-overlay.open {
    display: flex;
}

.aviso-modal {
    background: white;
    border-radius: 16px;
    width: 100%;
    max-width: 540px;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    animation: aviso-modal-in 0.2s ease;
}

@keyframes aviso-modal-in {
    from { opacity: 0; transform: translateY(-12px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.aviso-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 24px;
    background: linear-gradient(135deg, #1B396A 0%, #24518F 100%);
    color: white;
}

.aviso-modal-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
}

.aviso-modal-close {
    background: rgba(255,255,255,0.15);
    border: none;
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
    padding: 0;
}
.aviso-modal-close:hover { background: rgba(255,255,255,0.28); }

.aviso-modal-body {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.aviso-form-label {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #64748b;
    display: block;
    margin-bottom: 6px;
}

.aviso-form-input,
.aviso-form-select,
.aviso-form-textarea {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
    font-family: 'Open Sans', sans-serif;
    color: #334155;
    outline: none;
    box-sizing: border-box;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.aviso-form-input:focus,
.aviso-form-select:focus,
.aviso-form-textarea:focus {
    border-color: #1B396A;
    box-shadow: 0 0 0 3px rgba(27, 57, 106, 0.1);
}

.aviso-form-textarea {
    resize: vertical;
    min-height: 90px;
}

.aviso-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.aviso-form-hint {
    color: #94a3b8;
    font-size: 11px;
    margin-top: 4px;
    display: block;
}

/* ── Contadores de caracteres ───────────────────────────────────── */
.aviso-label-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 6px;
}

.aviso-label-row .aviso-form-label {
    margin-bottom: 0;
}

.aviso-char-counter {
    font-size: 11px;
    color: #94a3b8;
    font-weight: 500;
    transition: color 0.15s;
}

.aviso-char-counter.near-limit { color: #f59e0b; }
.aviso-char-counter.at-limit   { color: #ef4444; font-weight: 700; }

/* ── Toggle de visibilidad ──────────────────────────────────────── */
.aviso-toggle-group {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
}

.aviso-toggle-labels {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.aviso-toggle-labels .aviso-form-label {
    margin-bottom: 0;
}

.aviso-toggle-status {
    font-size: 13px;
    color: #15803d;
    font-weight: 500;
    transition: color 0.2s;
}

.aviso-toggle-status.inactivo {
    color: #94a3b8;
}

.aviso-toggle-switch {
    position: relative;
    display: inline-flex;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
    cursor: pointer;
}

.aviso-toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.aviso-toggle-slider {
    position: absolute;
    inset: 0;
    background: #cbd5e1;
    border-radius: 24px;
    transition: background 0.2s;
}

.aviso-toggle-slider::before {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    left: 3px;
    top: 3px;
    background: white;
    border-radius: 50%;
    transition: transform 0.2s;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.aviso-toggle-switch input:checked + .aviso-toggle-slider {
    background: #1B396A;
}

.aviso-toggle-switch input:checked + .aviso-toggle-slider::before {
    transform: translateX(20px);
}

.aviso-modal-footer {
    padding: 16px 24px;
    border-top: 1px solid #f1f5f9;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.btn-aviso-cancel {
    padding: 9px 18px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    background: white;
    color: #64748b;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    font-family: 'Open Sans', sans-serif;
    transition: all 0.15s;
}
.btn-aviso-cancel:hover { background: #f8fafc; }

.btn-aviso-save {
    padding: 9px 22px;
    border-radius: 8px;
    border: none;
    background: #1B396A;
    color: white;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    font-family: 'Open Sans', sans-serif;
    transition: background 0.15s;
    display: flex;
    align-items: center;
    gap: 7px;
}
.btn-aviso-save:hover:not(:disabled) { background: #24518F; }
.btn-aviso-save:disabled { opacity: 0.55; cursor: default; }

/* ── Confirmación de borrado ─────────────────────────────────────── */
.aviso-confirm-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(3px);
    z-index: 2100;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.aviso-confirm-overlay.open { display: flex; }

.aviso-confirm-box {
    background: white;
    border-radius: 14px;
    padding: 28px 24px;
    max-width: 380px;
    width: 100%;
    text-align: center;
    box-shadow: 0 20px 50px rgba(0,0,0,0.18);
    animation: aviso-modal-in 0.2s ease;
}

.aviso-confirm-icon {
    font-size: 36px;
    color: #dc2626;
    margin-bottom: 12px;
}

.aviso-confirm-box h4 {
    font-size: 17px;
    font-weight: 700;
    margin: 0 0 8px;
    color: #1e293b;
}

.aviso-confirm-box p {
    font-size: 14px;
    color: #64748b;
    margin: 0 0 22px;
}

.aviso-confirm-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.btn-confirm-cancel {
    padding: 9px 20px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    background: white;
    color: #64748b;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    font-family: 'Open Sans', sans-serif;
}
.btn-confirm-delete {
    padding: 9px 20px;
    border-radius: 8px;
    border: none;
    background: #dc2626;
    color: white;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    font-family: 'Open Sans', sans-serif;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: background 0.15s;
}
.btn-confirm-delete:hover:not(:disabled) { background: #b91c1c; }
.btn-confirm-delete:disabled { opacity: 0.55; cursor: default; }

/* ── Responsive ──────────────────────────────────────────────────── */
@media (min-width: 641px) {
    .avisos-table {
        table-layout: fixed;
    }
    .avisos-table th:nth-child(1), .avisos-table td:nth-child(1) { width: 38%; } /* Aviso */
    .avisos-table th:nth-child(2), .avisos-table td:nth-child(2) { width: 10%; } /* Tipo */
    .avisos-table th:nth-child(3), .avisos-table td:nth-child(3) { width: 10%; } /* Estado */
    .avisos-table th:nth-child(4), .avisos-table td:nth-child(4) { width: 13%; } /* Creado */
    .avisos-table th:nth-child(5), .avisos-table td:nth-child(5) { width: 13%; } /* Expira */
    .avisos-table th:nth-child(6), .avisos-table td:nth-child(6) { width: 16%; } /* Acciones */
}

@media (max-width: 640px) {
    .aviso-form-row { grid-template-columns: 1fr; }
    .avisos-toolbar { flex-direction: column; align-items: stretch; }
    .avisos-table th:nth-child(3),
    .avisos-table td:nth-child(3),
    .avisos-table th:nth-child(5),
    .avisos-table td:nth-child(5) { display: none; }
}
