/* ==========================================
   ESTILOS PARA CONFIGURAÇÃO DE ALERTAS
   ========================================== */

/* Container de cards dos módulos */
.alertas-grid-modulos {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

/* Card de módulo */
.alerta-modulo-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
    border: 2px solid #e0e0e0;
}

.alerta-modulo-card:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
    transform: translateY(-2px);
}

/* Header do card com ícone e nome do módulo */
.alerta-modulo-header {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #f0f0f0;
}

.alerta-modulo-icon {
    width: 48px;
    height: 48px;
    margin-right: 15px;
    flex-shrink: 0;
}

.alerta-modulo-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.alerta-modulo-nome {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    line-height: 1.3;
}

/* Seção de tipo de alerta */
.alerta-tipo-section {
    margin-bottom: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
}

.alerta-tipo-section:last-child {
    margin-bottom: 0;
}

.alerta-tipo-title {
    font-size: 13px;
    font-weight: 600;
    color: #555;
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Linha de controle (switch + label) */
.alerta-control-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.alerta-control-row:last-child {
    margin-bottom: 0;
}

.alerta-control-label {
    font-size: 13px;
    color: #666;
    flex: 1;
}

/* Switch Toggle - Estilo moderno */
.switch-alerta {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 26px;
    flex-shrink: 0;
}

.switch-alerta input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider-alerta {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .3s;
    border-radius: 26px;
}

.slider-alerta:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .3s;
    border-radius: 50%;
}

.switch-alerta input:checked + .slider-alerta {
    background-color: #1976d2;
}

.switch-alerta input:checked + .slider-alerta:before {
    transform: translateX(24px);
}

/* Select de dia do mês */
.alerta-dia-select {
    width: 70px;
    height: 26px;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 2px 5px;
    font-size: 12px;
    background-color: white;
    cursor: pointer;
    transition: border-color 0.3s;
    background-position-x: calc(100% - 4px)!important;
    background-position-y: 4px!important;
    background-size: 16px!important;
}

.alerta-dia-select:hover,
.alerta-dia-select:focus {
    border-color: #1976d2;
    outline: none;
}

/* Seção de e-mails */
.alertas-emails-section {
    background: white;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.alertas-emails-title {
    font-size: 15px;
    font-weight: 600;
    color: #333;
    margin-bottom: 15px;
}

.alertas-emails-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 10px;
}

.alerta-email-tag {
    display: inline-flex;
    align-items: center;
    background: #E3F2FD;
    color: #1976D2;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 13px;
    gap: 8px;
}

.alerta-email-tag a {
    color: #d32f2f;
    transition: color 0.2s;
}

.alerta-email-tag a:hover {
    color: #b71c1c;
}

.alerta-email-empty {
    color: #999;
    font-style: italic;
    padding: 10px;
    background: #f5f5f5;
    border-radius: 8px;
    display: inline-block;
}

/* ==========================================
   ALERTAS v2 — NOVO LAYOUT (estilo relatorios_unificados)
   ========================================== */

/* Banner informativo */
.alertav2-info-banner {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    background: #e3f2fd;
    border-left: 4px solid #1976d2;
    border-radius: 10px;
    padding: 14px 16px;
    margin-top: 10px;
    font-size: 13px;
    color: #333;
    line-height: 1.6;
}
.alertav2-info-icon {
    color: #1976d2;
    font-size: 26px !important;
    flex-shrink: 0;
    margin-top: 2px;
}

/* ─── Checkboxes nativos nos cards alertas v2 ─── */
#alertav2_card_empresas .alertav2-empresa-cb,
#alertav2_card_empresas #alertav2_todos_empresas,
#alertav2_card_modulos  #alertav2_todos_modulos {
    -webkit-appearance: checkbox !important;
    -moz-appearance: checkbox !important;
    appearance: checkbox !important;
    opacity: 1 !important;
    visibility: visible !important;
    display: inline-block !important;
    position: static !important;
    width: 20px !important;
    height: 20px !important;
    min-width: 20px !important;
    margin: 0 !important;
    padding: 0 !important;
    flex-shrink: 0 !important;
    cursor: pointer !important;
}

/* ─── Grid de módulos — idêntico ao #lista_equipamentos_ru ─── */
.alertav2-modulos-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 15px;
}

/* ─── Ícones dos módulos — tamanho fixo idêntico ao relatorios_unificados ─── */
#alertav2_form_modulos .equipment-image img {
    width: 48px;
    height: 48px;
    object-fit: contain;
}
#alertav2_form_modulos .equipment-card-module {
    min-height: 120px;
    padding: 15px;
}
#alertav2_form_modulos .equipment-name {
    font-size: 12px;
    font-weight: 600;
    color: #333;
    text-align: center;
    line-height: 1.2;
}

/* Estado selecionado dos módulos — mesmo estilo do checkbox-card-ru:checked */
.alertav2-modulo-selecionado {
    box-shadow: 0 0 0 4px #b13536 !important;
    transform: scale(1.05);
    border: 3px solid #b13536 !important;
}

/* Tipos de alerta — chips */
.alertav2-tipos-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}
.alertav2-tipo-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 18px;
    border-radius: 24px;
    border: 2px solid #e0e0e0;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    background: #fff;
    user-select: none;
    font-weight: 500;
}
.alertav2-tipo-label input { display: none; }
.alertav2-tipo-selecionado {
    border-color: #1976d2;
    background: #e3f2fd;
    color: #1565c0;
    font-weight: 700;
    box-shadow: 0 0 0 2px rgba(25,118,210,0.18);
}

/* Canal de entrega */
.alertav2-canal-row {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}
.alertav2-canal-label {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 12px 22px;
    border-radius: 10px;
    border: 2px solid #e0e0e0;
    font-size: 15px;
    cursor: pointer;
    transition: all 0.2s;
    background: #fff;
    user-select: none;
    font-weight: 500;
}
.alertav2-canal-label input { display: none; }
.alertav2-canal-label.alertav2-canal-ativo {
    border-color: #1976d2;
    background: #e3f2fd;
    color: #1565c0;
    font-weight: 700;
    box-shadow: 0 0 0 2px rgba(25,118,210,0.18);
}

/* Lista de empresas — mesmo padrão do unificado */
#alertav2_form_empresas_lista {
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid #ddd;
    padding: 5px;
    border-radius: 4px;
    background: #fff;
}
.alertav2-empresa-item {
    padding: 10px 12px;
    border-bottom: 1px solid #f0f0f0;
    transition: background 0.15s;
}
.alertav2-empresa-item:last-child { border-bottom: none; }
.alertav2-empresa-item:hover { background: #f5f5f5; }
.alertav2-empresa-item.selected {
    background-color: #e3f2fd !important;
    border-left: 4px solid #1976d2 !important;
}

/* ─── Cards da lista de alertas configurados ─── */
#alertav2_lista {
    display: grid;
    gap: 0px;
    margin-top: 5px;
}
.alertav2-card {
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.09);
    border: 2px solid #e8e8e8;
    overflow: hidden;
    transition: box-shadow 0.2s;
}
.alertav2-card:hover {
    box-shadow: 0 4px 18px rgba(0,0,0,0.14);
}
.alertav2-card-inativo {
    opacity: 0.6;
    border-style: dashed;
}
.alertav2-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px 8px;
    border-bottom: 1px solid #f0f0f0;
    background: #fafafa;
}
.alertav2-card-icones {
    display: flex;
    flex-wrap: wrap;
    gap: 3px;
}
.alertav2-badge {
    font-size: 11px;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 20px;
    white-space: nowrap;
}
.alertav2-badge-ativo   { background: #e3f2fd; color: #1565c0; }
.alertav2-badge-inativo { background: #f5f5f5; color: #999; }
.alertav2-card-body     { padding: 12px 14px; }
.alertav2-card-nome {
    font-size: 15px;
    font-weight: 700;
    color: #333;
    margin-bottom: 8px;
}
.alertav2-card-info {
    font-size: 13px;
    color: #555;
    margin-bottom: 6px;
    display: flex;
    align-items: flex-start;
    gap: 5px;
    flex-wrap: wrap;
}
.alertav2-card-actions {
    display: flex;
    gap: 8px;
    padding: 10px 14px;
    border-top: 1px solid #f0f0f0;
    background: #fafafa;
    flex-wrap: wrap;
}
.alertav2-empty {
    text-align: left;
    color: #aaa;
    padding: 0px 20px;
    font-size: 14px;
    grid-column: 1 / -1;
}
.alertav2-empty i {
    font-size: 42px !important;
    display: block;
    margin-bottom: 10px;
    color: #ccc;
}

/* ─── Responsivo: grid de módulos ─── */
@media (max-width: 1200px) {
    .alertav2-modulos-grid { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 992px) {
    .alertas-grid-modulos { grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
}
@media (max-width: 768px) {
    .alertav2-modulos-grid { grid-template-columns: repeat(3, 1fr); }
    .alertas-grid-modulos { grid-template-columns: 1fr; }
    .alerta-modulo-header { flex-direction: row; align-items: center; }
    .alerta-modulo-icon { width: 40px; height: 40px; }
    #alertav2_lista { grid-template-columns: 1fr; }
    .alertav2-canal-row { gap: 10px; }
    .alertav2-canal-label { padding: 10px 14px; font-size: 14px; }
}
@media (max-width: 480px) {
    .alertav2-modulos-grid { grid-template-columns: repeat(2, 1fr); }
    .alerta-modulo-card { padding: 15px; }
    .alerta-tipo-section { padding: 12px; }
    .switch-alerta { width: 44px; height: 22px; }
    .slider-alerta:before { height: 16px; width: 16px; }
    .switch-alerta input:checked + .slider-alerta:before { transform: translateX(22px); }
    #alertav2_form_modulos .equipment-image img { width: 36px; height: 36px; }
}
