/**
 * Estilos Comuns para Sistema de Presets
 * CSS compartilhado entre todas as páginas que usam presets
 *
 * @author Claude Code
 * @version 1.0.0
 */

/* ========================================
   ESTRUTURA BASE DOS PRESETS
   ======================================== */

/* Container principal dos presets */
.preset-container {
    width: 100%;
}

/* Normalização das caixas de presets para mesma altura */
.preset-container .row {
    display: flex;
    align-items: stretch;
}

.preset-container .row > div {
    display: flex;
}

/* Caixa individual de cada preset */
.preset-option {
    transition: all 0.2s ease;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 12px;
    background-color: #fff;
    height: 100%;
    min-height: 120px;
    display: flex;
    flex-direction: column;
}

.preset-option:hover {
    border-color: #007bff;
    box-shadow: 0 2px 8px rgba(0, 123, 255, 0.15);
}

/* Estado selecionado */
.preset-option input[type="radio"]:checked + label {
    background-color: rgba(0, 123, 255, 0.1);
}

/* ========================================
   POSICIONAMENTO DOS ELEMENTOS
   ======================================== */

/* Ajuste específico para posicionamento do radio button */
.preset-option.form-check {
    position: relative;
}

.preset-option .form-check-input {
    position: absolute;
    top: 12px;
    left: 12px;
    margin: 0;
    z-index: 2;
}

.preset-option .form-check-label {
    padding-left: 30px;
    margin-left: 0;
    transition: all 0.2s ease;
    cursor: pointer;
    border-radius: 6px;
    padding: 8px;
    height: 100%;
    display: flex;
    align-items: center;
    flex-grow: 1;
}

.preset-option:hover label {
    background-color: rgba(0, 123, 255, 0.05);
}

/* ========================================
   ÍCONE DE INFORMAÇÃO (TOOLTIP)
   ======================================== */

.preset-info-icon {
    transition: all 0.2s ease;
    opacity: 0.7;
    cursor: pointer;
    z-index: 3;
}

.preset-info-icon:hover {
    opacity: 1;
    transform: scale(1.1);
}

.preset-info-icon i {
    filter: drop-shadow(0 1px 2px rgba(0,0,0,0.1));
    font-size: 16px;
}

/* ========================================
   TOOLTIPS CUSTOMIZADOS
   ======================================== */

/* Estilos customizados para tooltips do Bootstrap */
.tooltip-inner {
    max-width: 350px !important;
    padding: 12px 15px;
    font-size: 13px;
    line-height: 1.4;
    text-align: left;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    background-color: #212529;
}

.tooltip .tooltip-arrow {
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.1));
}

/* Tooltip específico para presets */
.preset-tooltip {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.preset-tooltip strong {
    color: #ffffff;
    font-weight: 600;
}

.preset-tooltip em {
    color: #e9ecef;
    font-style: italic;
}

.preset-tooltip .badge {
    font-size: 0.75em;
    margin: 0 2px;
}

/* ========================================
   CONTEÚDO DOS PRESETS
   ======================================== */

/* Conteúdo dos presets - usar estilos padrão do Bootstrap */

/* Cor personalizada para presets de fonte */
.text-purple {
    color: #6f42c1 !important;
}

/* ========================================
   ESTADOS DE CARREGAMENTO E ERRO
   ======================================== */

/* Estado de carregamento */
.preset-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    color: #6c757d;
}

.preset-loading .spinner-border {
    margin-right: 0.5rem;
}

/* Estado de erro */
.preset-error {
    background-color: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 6px;
    padding: 12px;
    margin-top: 10px;
    color: #856404;
}

.preset-error i {
    margin-right: 8px;
}

/* Estado vazio */
.preset-empty {
    text-align: center;
    padding: 2rem;
    color: #6c757d;
}

.preset-empty i {
    font-size: 48px;
    margin-bottom: 1rem;
    opacity: 0.5;
}

/* ========================================
   RESPONSIVIDADE
   ======================================== */

/* Tablets */
@media (max-width: 768px) {
    .preset-option {
        min-height: 100px;
        padding: 10px;
    }

    .preset-option .form-check-input {
        top: 10px;
        left: 10px;
    }

    .preset-option .form-check-label {
        padding-left: 28px;
    }

    .preset-info-icon {
        top: 6px !important;
        right: 6px !important;
    }

    .tooltip-inner {
        max-width: 280px !important;
        font-size: 12px;
    }
}

/* Mobile */
@media (max-width: 576px) {
    .preset-container .row > div {
        margin-bottom: 1rem;
    }

    .preset-option {
        min-height: 90px;
        padding: 8px;
    }

    .preset-option .fw-medium {
        font-size: 13px;
    }

    .preset-option .text-muted {
        font-size: 11px;
    }

    .preset-option .badge {
        font-size: 9px;
        padding: 1px 4px;
    }

    .preset-option i[class*="bi-"] {
        font-size: 16px;
        margin-right: 6px;
    }

    .tooltip-inner {
        max-width: 250px !important;
        padding: 10px 12px;
        font-size: 11px;
    }
}

/* ========================================
   ANIMAÇÕES E TRANSIÇÕES
   ======================================== */

/* Animação de entrada para presets carregados dinamicamente */
@keyframes presetFadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.preset-container .row > div {
    animation: presetFadeIn 0.3s ease-out;
}

/* Delayed animation para cada preset */
.preset-container .row > div:nth-child(1) { animation-delay: 0s; }
.preset-container .row > div:nth-child(2) { animation-delay: 0.1s; }
.preset-container .row > div:nth-child(3) { animation-delay: 0.2s; }
.preset-container .row > div:nth-child(4) { animation-delay: 0.3s; }
.preset-container .row > div:nth-child(5) { animation-delay: 0.4s; }
.preset-container .row > div:nth-child(6) { animation-delay: 0.5s; }

/* Animação de sucesso ao recarregar */
@keyframes presetReloadSuccess {
    0% {
        background-color: rgba(40, 167, 69, 0.1);
        transform: scale(1);
    }
    50% {
        background-color: rgba(40, 167, 69, 0.2);
        transform: scale(1.02);
    }
    100% {
        background-color: transparent;
        transform: scale(1);
    }
}

.preset-reload-success {
    animation: presetReloadSuccess 1s ease-out;
}

/* ========================================
   MODO ESCURO (OPCIONAL)
   ======================================== */

@media (prefers-color-scheme: dark) {
    .preset-option:hover {
        border-color: #3182ce;
        box-shadow: 0 2px 8px rgba(49, 130, 206, 0.15);
    }

    .preset-option .text-muted {
        color: #a0aec0 !important;
    }

    .preset-error {
        background-color: #2d2d2d;
        border-color: #4a4a4a;
        color: #fbd38d;
    }

    .tooltip-inner {
        background-color: #1a202c;
        color: #e2e8f0;
    }
}

/* ========================================
   ACESSIBILIDADE
   ======================================== */

/* Focus indicators melhorados */
.preset-option .form-check-input:focus {
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
    outline: none;
}

/* Garantir contraste adequado */
.preset-option .badge.bg-secondary {
    background-color: #6c757d !important;
    color: #ffffff !important;
}

/* Screen reader only text */
.sr-only {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

/* Melhorar interação por teclado */
.preset-option:focus-within .preset-info-icon {
    opacity: 1;
}

/* ========================================
   PRINT STYLES
   ======================================== */

@media print {
    .preset-container {
        page-break-inside: avoid;
    }

    .preset-option {
        break-inside: avoid;
        box-shadow: none !important;
        border: 1px solid #000 !important;
    }

    .preset-info-icon {
        display: none !important;
    }

    .tooltip {
        display: none !important;
    }
}
