/**
 * Estilos Públicos - Diagnóstico Plugin
 * Design Premium com Animações
 */

/* ===========================
   VARIÁVEIS E RESET
   =========================== */

:root {
    /* Cores - podem ser sobrescritas pelo branding */
    --diag-cor-primaria: #2563eb;
    --diag-cor-secundaria: #1e40af;
    --diag-cor-texto: #1f2937;
    --diag-cor-fundo: #f3f4f6;
    --diag-cor-fundo-pagina: #f8fafc;
    --diag-cor-sucesso: #10b981;
    --diag-cor-erro: #ef4444;
    --diag-cor-alerta: #f59e0b;

    /* RGB para gradientes */
    --diag-rgb-primaria: 37, 99, 235;
    --diag-rgb-secundaria: 30, 64, 175;

    /* Estilos - podem ser sobrescritas pelo branding */
    --diag-botao-radius: 12px;
    --diag-card-radius: 16px;
    --diag-sombra: 0 10px 40px rgba(0,0,0,0.1);
    --diag-sombra-hover: 0 20px 60px rgba(0,0,0,0.15);
    --diag-sombra-primaria: 0 4px 15px rgba(37, 99, 235, 0.4);

    /* Animações */
    --diag-transicao: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --diag-bounce: cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.diagnostico-form-wrapper,
.diagnostico-resultado-wrapper,
.diagnostico-meus-lista,
.diagnostico-myaccount,
.diagnostico-access-wrapper {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: var(--diag-cor-texto);
    line-height: 1.6;
}

/* ===========================
   ANIMAÇÕES KEYFRAMES
   =========================== */

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

@keyframes bounce {
    0%, 20%, 53%, 100% { transform: translateY(0); }
    40% { transform: translateY(-8px); }
    60% { transform: translateY(-4px); }
}

@keyframes ripple {
    0% {
        transform: scale(0);
        opacity: 0.5;
    }
    100% {
        transform: scale(4);
        opacity: 0;
    }
}

@keyframes gradientMove {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

@keyframes checkmark {
    0% {
        stroke-dashoffset: 100;
    }
    100% {
        stroke-dashoffset: 0;
    }
}

/* ===========================
   BOTÕES PREMIUM
   =========================== */

.btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 28px;
    border: none;
    border-radius: var(--diag-botao-radius);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--diag-transicao);
    text-decoration: none;
    overflow: hidden;
    transform: translateZ(0);
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255,255,255,0.2);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.6s ease, height 0.6s ease;
}

.btn:active::before {
    width: 300px;
    height: 300px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--diag-cor-primaria) 0%, var(--diag-cor-secundaria) 100%);
    color: #fff;
    box-shadow: var(--diag-sombra-primaria);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(37, 99, 235, 0.5);
    color: #fff;
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: #fff;
    color: var(--diag-cor-texto);
    border: 2px solid #e5e7eb;
}

.btn-secondary:hover {
    border-color: var(--diag-cor-primaria);
    color: var(--diag-cor-primaria);
    transform: translateY(-2px);
}

.btn-success {
    background: linear-gradient(135deg, var(--diag-cor-sucesso) 0%, #059669 100%);
    color: #fff;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.4);
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(16, 185, 129, 0.5);
}

.btn-link {
    background: none;
    color: var(--diag-cor-primaria);
    padding: 14px;
}

.btn-link:hover {
    background: rgba(37, 99, 235, 0.1);
    transform: translateY(-1px);
}

.btn .dashicons {
    font-size: 18px;
    width: 18px;
    height: 18px;
    transition: transform 0.3s ease;
}

.btn:hover .dashicons {
    transform: scale(1.1);
}

/* Botão com Loading */
.btn.loading {
    pointer-events: none;
    opacity: 0.8;
}

.btn.loading .btn-text {
    opacity: 0;
}

.btn.loading::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.btn-block {
    width: 100%;
}

/* ===========================
   INPUTS ANIMADOS
   =========================== */

.form-group {
    position: relative;
    margin-bottom: 24px;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    font-size: 14px;
    color: var(--diag-cor-texto);
    transition: var(--diag-transicao);
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"],
.form-group textarea {
    width: 100%;
    padding: 14px 18px;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    font-size: 15px;
    transition: var(--diag-transicao);
    background: #fff;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--diag-cor-primaria);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

.form-group input:focus + label,
.form-group input:not(:placeholder-shown) + label {
    color: var(--diag-cor-primaria);
}

/* Input com ícone */
.input-with-icon {
    position: relative;
}

.input-with-icon input,
.input-with-icon input[type="text"],
.input-with-icon input[type="email"],
.input-with-icon input[type="password"] {
    padding-left: 52px !important;
    box-sizing: border-box;
}

.input-with-icon .input-icon,
.input-with-icon > .input-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: #9ca3af;
    transition: var(--diag-transicao);
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    z-index: 2;
}

.input-with-icon input:focus ~ .input-icon,
.input-with-icon input:focus + .input-icon {
    color: var(--diag-cor-primaria);
}

/* ===========================
   CARDS ANIMADOS
   =========================== */

.diagnostico-card {
    background: #fff;
    border-radius: var(--diag-card-radius);
    box-shadow: var(--diag-sombra);
    overflow: hidden;
    transition: var(--diag-transicao);
    animation: fadeInUp 0.6s ease backwards;
    border: 1px solid rgba(0,0,0,0.05);
}

.diagnostico-card:nth-child(1) { animation-delay: 0.1s; }
.diagnostico-card:nth-child(2) { animation-delay: 0.2s; }
.diagnostico-card:nth-child(3) { animation-delay: 0.3s; }
.diagnostico-card:nth-child(4) { animation-delay: 0.4s; }
.diagnostico-card:nth-child(5) { animation-delay: 0.5s; }
.diagnostico-card:nth-child(6) { animation-delay: 0.6s; }

.diagnostico-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: var(--diag-sombra-hover);
}

.diagnostico-card.cinza {
    border-top: 4px solid #9ca3af;
}

.diagnostico-card.amarelo {
    border-top: 4px solid var(--diag-cor-alerta);
}

.diagnostico-card.verde {
    border-top: 4px solid var(--diag-cor-sucesso);
}

.diagnostico-card .card-header {
    padding: 20px 24px 0;
}

.diagnostico-card .card-body {
    padding: 20px 24px;
}

.diagnostico-card .card-body h3 {
    margin: 0 0 12px 0;
    font-size: 20px;
    color: var(--diag-cor-texto);
    transition: var(--diag-transicao);
}

.diagnostico-card:hover .card-body h3 {
    color: var(--diag-cor-primaria);
}

.diagnostico-card .card-excerpt {
    color: #6b7280;
    font-size: 14px;
    margin-bottom: 16px;
    line-height: 1.6;
}

.diagnostico-card .card-footer {
    padding: 16px 24px 24px;
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

/* ===========================
   STATUS BADGES ANIMADOS
   =========================== */

.status-badge,
.card-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 50px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    animation: scaleIn 0.4s var(--diag-bounce);
}

.status-badge.nao_iniciado,
.card-status.nao_iniciado {
    background: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%);
    color: #6b7280;
}

.status-badge.em_andamento,
.card-status.em_andamento {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    color: #92400e;
    animation: pulse 2s ease-in-out infinite;
}

.status-badge.concluido,
.card-status.concluido {
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
    color: #065f46;
}

/* ===========================
   BARRA DE PROGRESSO ANIMADA
   =========================== */

.card-progress,
.diagnostico-progress-bar {
    margin: 16px 0;
}

.progress-bar {
    height: 10px;
    background: #e5e7eb;
    border-radius: 10px;
    overflow: hidden;
    position: relative;
}

.progress-bar::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    animation: shimmer 2s infinite;
    background-size: 200% 100%;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--diag-cor-primaria), var(--diag-cor-secundaria), var(--diag-cor-primaria));
    background-size: 200% 100%;
    border-radius: 10px;
    transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    animation: gradientMove 3s ease infinite;
    position: relative;
}

.progress-fill::after {
    content: '';
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 6px;
    height: 6px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 0 10px rgba(255,255,255,0.8);
}

.progress-label,
.progress-text {
    display: block;
    font-size: 13px;
    color: #6b7280;
    margin-top: 8px;
    font-weight: 500;
}

/* ===========================
   MENSAGENS ANIMADAS
   =========================== */

.diagnostico-erro,
.diagnostico-vazio,
.diagnostico-login-required,
.access-message {
    background: var(--diag-cor-fundo);
    padding: 40px;
    text-align: center;
    border-radius: 16px;
    animation: fadeInUp 0.5s ease;
}

.access-message {
    padding: 16px 24px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    animation: slideInDown 0.5s ease;
}

.access-message.error {
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    color: #dc2626;
    border-left: 4px solid #dc2626;
}

.access-message.success {
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
    color: #065f46;
    border-left: 4px solid #10b981;
}

.access-message .dashicons {
    font-size: 24px;
    width: 24px;
    height: 24px;
    animation: bounce 1s ease;
}

/* ===========================
   ACESSO NEGADO
   =========================== */

.diagnostico-acesso-negado {
    text-align: center;
    padding: 60px 40px;
    background: linear-gradient(135deg, #fff 0%, var(--diag-cor-fundo) 100%);
    border-radius: 20px;
    animation: fadeInUp 0.6s ease;
}

.diagnostico-acesso-negado .acesso-negado-icon {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, var(--diag-cor-primaria) 0%, var(--diag-cor-secundaria) 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 24px;
    animation: float 3s ease-in-out infinite;
}

.diagnostico-acesso-negado .acesso-negado-icon .dashicons {
    font-size: 36px;
    width: 36px;
    height: 36px;
    color: #fff;
}

.diagnostico-acesso-negado h3 {
    margin: 0 0 12px 0;
    font-size: 28px;
    background: linear-gradient(135deg, var(--diag-cor-texto) 0%, #4b5563 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.diagnostico-acesso-negado p {
    color: #6b7280;
    margin-bottom: 24px;
    font-size: 16px;
}

/* ===========================
   GRID DE CARDS
   =========================== */

.diagnostico-cards,
.diagnostico-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 24px;
}

/* ===========================
   FILTROS
   =========================== */

.diagnostico-filtros {
    margin-bottom: 32px;
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    animation: fadeInDown 0.5s ease;
}

.filtro-btn {
    padding: 10px 20px;
    background: #fff;
    border: 2px solid #e5e7eb;
    border-radius: 50px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    color: var(--diag-cor-texto);
    transition: var(--diag-transicao);
}

.filtro-btn:hover {
    border-color: var(--diag-cor-primaria);
    color: var(--diag-cor-primaria);
    transform: translateY(-2px);
}

.filtro-btn.active {
    background: linear-gradient(135deg, var(--diag-cor-primaria) 0%, var(--diag-cor-secundaria) 100%);
    border-color: transparent;
    color: #fff;
    box-shadow: 0 4px 15px rgba(37, 99, 235, 0.4);
}

/* ===========================
   TOAST NOTIFICATIONS
   =========================== */

.diagnostico-toast {
    position: fixed;
    bottom: 30px;
    right: 30px;
    padding: 16px 24px;
    background: #1f2937;
    color: #fff;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
    z-index: 10000;
    animation: slideInRight 0.5s var(--diag-bounce);
    display: flex;
    align-items: center;
    gap: 12px;
}

.diagnostico-toast.success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.diagnostico-toast.error {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
}

.diagnostico-toast.hiding {
    animation: slideInRight 0.3s ease reverse forwards;
}

/* ===========================
   SKELETON LOADING
   =========================== */

.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 8px;
}

.skeleton-text {
    height: 16px;
    margin-bottom: 8px;
}

.skeleton-title {
    height: 24px;
    width: 60%;
    margin-bottom: 16px;
}

.skeleton-button {
    height: 48px;
    width: 120px;
}

/* ===========================
   RESULTADO EM REVISÃO
   =========================== */

.resultado-pendente-aviso {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    color: #92400e;
    border-radius: 50px;
    font-size: 14px;
    font-weight: 600;
    animation: pulse 2s ease-in-out infinite;
}

.resultado-pendente-aviso .dashicons {
    font-size: 18px;
    width: 18px;
    height: 18px;
}

.pendente-descricao {
    margin: 12px 0 0 0;
    font-size: 13px;
    color: #6b7280;
    line-height: 1.5;
}

.diagnostico-card .card-footer .resultado-pendente-aviso {
    width: 100%;
    justify-content: center;
}

.diagnostico-card .card-footer .pendente-descricao {
    text-align: center;
    width: 100%;
}

.historico-pendente {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: #92400e;
    font-size: 13px;
}

.historico-pendente .dashicons {
    font-size: 14px;
    width: 14px;
    height: 14px;
}

/* ===========================
   iOS/MOBILE TOUCH FIXES
   =========================== */

.btn,
.tab-btn,
.opcao-header,
.btn-iniciar,
.btn-submit,
.btn-proximo,
.btn-anterior,
.btn-concluir,
.btn-wizard-proximo,
.btn-wizard-anterior,
.btn-wizard-concluir,
.filtro-btn,
.etapa-nav-item {
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    -webkit-appearance: none;
    cursor: pointer;
}

/* Previne zoom em inputs no iOS (font-size < 16px causa zoom) */
@supports (-webkit-touch-callout: none) {
    .diagnostico-form-wrapper input,
    .diagnostico-form-wrapper textarea,
    .diagnostico-form-wrapper select,
    .diagnostico-access-wrapper input,
    .diagnostico-access-wrapper textarea,
    .diagnostico-access-wrapper select {
        font-size: 16px;
    }
}

/* ===========================
   RESPONSIVO
   =========================== */

@media screen and (max-width: 768px) {
    .diagnostico-cards,
    .diagnostico-cards-grid {
        grid-template-columns: 1fr;
    }

    .btn {
        padding: 12px 20px;
        font-size: 14px;
    }

    .diagnostico-card .card-body h3 {
        font-size: 18px;
    }

    .diagnostico-acesso-negado {
        padding: 40px 24px;
    }

    .diagnostico-toast {
        left: 20px;
        right: 20px;
        bottom: 20px;
    }
}

/* ===========================
   DARK MODE SUPPORT
   =========================== */

@media (prefers-color-scheme: dark) {
    /* Pode ser expandido para suporte dark mode */
}
