/**
 * EEP Anota AI Template CSS
 * Design elegante com controles refinados
 * Versão: 8.1.7
 *
 * IMPORTANTE: Todos os seletores devem ser escopados para .eep-anota-container
 * para evitar vazamento de CSS e conflitos com o WordPress
 */

/* Reset e Isolamento - Garante que estilos não vazem para fora do container */
.eep-anota-container {
    /* Reset box model */
    box-sizing: border-box;
}

.eep-anota-container *,
.eep-anota-container *::before,
.eep-anota-container *::after {
    box-sizing: inherit;
}

/* Isolar estilos de texto */
.eep-anota-container h1,
.eep-anota-container h2,
.eep-anota-container h3,
.eep-anota-container h4,
.eep-anota-container h5,
.eep-anota-container h6,
.eep-anota-container p {
    margin-top: 0;
    font-family: inherit;
}

/* Isolar botões */
.eep-anota-container button {
    font-family: inherit;
    line-height: normal;
}

/* Isolar inputs */
.eep-anota-container input {
    font-family: inherit;
}

@import url('../core/eep-design-tokens.css');

/* Container Principal - Isolado para não afetar outros elementos */
.eep-anota-container {
    display: block;
    visibility: visible;
    opacity: 1;
    padding: 1.5rem;
    max-width: 100%;
    box-sizing: border-box;
}

/* Cabeçalho Melhorado - Escopo limitado ao container Anota AI */
.eep-anota-container .eep-anota-header {
    margin-bottom: 1.5rem;
    box-sizing: border-box;
}

.eep-anota-container .eep-group-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 1.5rem;
    background: var(--eep-group-surface, linear-gradient(135deg, #f9fafb 0%, #ffffff 100%));
    border: 1px solid var(--eep-group-border, #e5e7eb);
    border-radius: 12px;
    margin-bottom: 1rem;
    box-sizing: border-box;
}

.eep-anota-container .eep-header-content {
    flex: 1;
    box-sizing: border-box;
}

.eep-anota-container .eep-group-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--eep-group-text, #111827);
    margin: 0 0 0.5rem 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    line-height: 1.2;
    font-family: inherit;
}

.eep-group-title .required {
    color: #ef4444;
    font-weight: 400;
    font-size: 1.25rem;
}

.eep-anota-container .eep-group-description {
    color: #4b5563;
    font-size: 0.9375rem;
    line-height: 1.6;
    margin: 0 0 0.75rem 0;
    font-family: inherit;
}

/* Meta Badges */
.eep-anota-container .eep-group-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.eep-anota-container .eep-meta-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8125rem;
    font-weight: 500;
    background: var(--eep-group-surface, #fff);
    border: 1px solid var(--eep-group-border, #e5e7eb);
}

.eep-anota-container .eep-meta-icon {
    font-size: 0.875rem;
}

.eep-anota-container .eep-meta-single {
    background: #fef3c7;
    border-color: #fbbf24;
    color: #92400e;
}

.eep-anota-container .eep-meta-multiple,
.eep-anota-container .eep-meta-limit {
    background: #dbeafe;
    border-color: #60a5fa;
    color: #1e40af;
}

.eep-anota-container .eep-meta-min {
    background: #fee2e2;
    border-color: #fca5a5;
    color: #991b1b;
}

/* Botão Collapse */
.eep-anota-container .eep-collapse-toggle {
    background: transparent;
    border: 1px solid var(--eep-group-border, #e5e7eb);
    border-radius: 6px;
    padding: 0.25rem 0.5rem;
    cursor: pointer;
    transition: all 0.2s;
}

.eep-anota-container .eep-collapse-toggle:hover {
    background: #f9fafb;
}

/* Busca Colapsável */
.eep-anota-container .eep-search-container {
    margin-bottom: 1rem;
}

.eep-anota-container .eep-search-trigger {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px; /* Alinhado com V2 */
    background: var(--eep-group-surface, #fff);
    border: 1px solid var(--eep-group-border, #e5e7eb);
    border-radius: 12px; /* Alinhado com V2 */
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.9375rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.04); /* Alinhado com V2 */
    font-family: inherit;
}

.eep-anota-container .eep-search-trigger:hover {
    border-color: var(--eep-group-accent, #1095F3); /* alinhado */
    background: var(--eep-muted, #f8fafc);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px color-mix(in srgb, var(--eep-group-accent, #1095F3) 10%, transparent);
}

.eep-anota-container .eep-search-trigger-icon {
    font-size: 1.125rem;
}

.eep-anota-container .eep-search-trigger-text {
    flex: 1;
    text-align: left;
    color: #6b7280;
    margin-left: 12px; /* Alinhado com V2 */
    font-weight: 500; /* Alinhado com V2 */
}

.eep-anota-container .eep-search-count {
    background: #f1f5f9; /* Alinhado com V2 */
    padding: 4px 8px; /* Alinhado com V2 */
    border-radius: 8px; /* Alinhado com V2 */
    font-size: 0.75rem;
    color: #475569; /* Alinhado com V2 */
    font-weight: 600;
}

/* Busca Expandida */
.eep-anota-container .eep-search-expanded {
    display: none; /* Estado inicial: escondido */
    margin-top: 0.5rem;
    padding: 1rem;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    animation: eepAnotaSlideDown 0.3s ease;
}

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

.eep-anota-container .eep-search-input-wrapper {
    position: relative;
}

.eep-anota-container .eep-anota-search {
    width: 100%;
    padding: 0.875rem 3rem 0.875rem 2.5rem;
    border: 2px solid var(--eep-success);
    border-radius: 10px;
    font-size: 1rem;
    color: #111827;
    background: white;
    transition: all 0.2s;
}

.eep-anota-container .eep-anota-search:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

.eep-anota-container .eep-search-input-wrapper .eep-search-icon {
    position: absolute;
    left: 0.875rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.125rem;
    color: var(--eep-success);
    pointer-events: none;
}

.eep-anota-container .eep-search-close {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: none;
    background: #f3f4f6;
    color: #6b7280;
    font-size: 1.25rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.eep-anota-container .eep-search-close:hover {
    background: #ef4444;
    color: white;
}

.eep-anota-container .eep-search-results-info {
    margin-top: 0.5rem;
    padding: 0.5rem;
    background: #f9fafb;
    border-radius: 6px;
    text-align: center;
    font-size: 0.875rem;
    color: #6b7280;
}

/* Grid Layout */
.eep-anota-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.25rem;
    margin: 0 0 1.5rem 0;
    padding: 0;
    transition: all 0.3s ease;
}

.eep-anota-grid.collapsed {
    display: none;
}

/* Item do Grid */
.eep-anota-item {
    position: relative;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s ease;
    cursor: pointer;
}

.eep-anota-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    border-color: #d1d5db;
}

.eep-anota-item.selected {
    border-color: var(--eep-group-accent, var(--eep-success));
    background: color-mix(in srgb, var(--eep-group-accent, #10b981) 6%, #ffffff);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--eep-group-accent, #10b981) 15%, transparent);
}

/* Radio apenas usa borda verde para indicar sele\u00e7\u00e3o */
.eep-anota-container[data-group-type="radio"] .eep-anota-item.selected {
    border-color: var(--eep-group-accent, var(--eep-success));
    background: color-mix(in srgb, var(--eep-group-accent, #10b981) 6%, #ffffff);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--eep-group-accent, #10b981) 25%, transparent);
}

/* Wrapper da Imagem */
.eep-anota-image-wrapper {
    position: relative;
    width: 100%;
    height: 180px;
    overflow: hidden;
}

/* Imagem */
.eep-anota-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.eep-anota-item:hover .eep-anota-image {
    transform: scale(1.05);
}

.eep-anota-image.placeholder {
    background: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    font-weight: 600;
    color: #9ca3af;
    text-transform: uppercase;
}

/* Botão Remover - Canto Superior Esquerdo */
.eep-anota-remove-btn {
    position: absolute;
    top: 0.5rem;
    left: 0.5rem;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: rgba(239, 68, 68, 0.2);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 1rem;
    font-weight: 400;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    z-index: var(--eep-z-base);
}

.eep-anota-remove-btn:hover {
    background: rgba(239, 68, 68, 0.95);
    color: white;
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.eep-anota-remove-btn:active {
    transform: scale(0.95);
}

/* Controles - Canto Superior Direito */
.eep-anota-controls {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    z-index: var(--eep-z-base);
}

/* Container dos botões de quantidade - Vertical */
.eep-quantity-controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(30px) saturate(150%);
    -webkit-backdrop-filter: blur(30px) saturate(150%);
    border-radius: 16px;
    padding: 3px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08),
                inset 0 0 0 0.5px rgba(255, 255, 255, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.15);
}

/* Display de quantidade */
.eep-quantity-display {
    width: 24px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #1f2937;
    font-size: 0.75rem;
    font-weight: 700;
    background: rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 4px;
    margin: 1px 0;
    box-shadow: inset 0 0 0 0.5px rgba(255, 255, 255, 0.8);
}

/* Botões de Controle de Quantidade */
.eep-control-btn {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 600;
    transition: all 0.15s ease;
    line-height: 1;
    position: relative;
}

/* Botão Menos */
.eep-control-minus {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(25px) saturate(150%);
    -webkit-backdrop-filter: blur(25px) saturate(150%);
    color: #dc2626;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05),
                inset 0 0 0 0.5px rgba(255, 255, 255, 0.7);
}

.eep-control-minus:hover:not(:disabled) {
    transform: scale(1.05);
    background: rgba(254, 226, 226, 0.9);
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.25);
}

.eep-control-minus:active:not(:disabled) {
    transform: scale(0.95);
}

.eep-control-minus:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    color: #d1d5db;
    background: rgba(243, 244, 246, 0.8);
}

/* Botão Mais */
.eep-control-plus {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(25px) saturate(150%);
    -webkit-backdrop-filter: blur(25px) saturate(150%);
    color: #059669;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05),
                inset 0 0 0 0.5px rgba(255, 255, 255, 0.7);
}

.eep-control-plus:hover:not(:disabled) {
    transform: scale(1.05);
    background: rgba(220, 252, 231, 0.9);
    box-shadow: 0 4px 12px rgba(5, 150, 105, 0.25);
}

.eep-control-plus:active:not(:disabled) {
    transform: scale(0.95);
}

.eep-control-plus:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    color: #d1d5db;
    background: rgba(243, 244, 246, 0.8);
}

/* Botão remover não é mais usado como classe separada pois agora está no canto esquerdo */

/* Conteúdo do Card */
.eep-anota-content {
    padding: 1rem;
}

.eep-anota-title {
    font-size: 0.9375rem;
    font-weight: 600;
    color: #111827;
    margin: 0 0 0.5rem 0;
    line-height: 1.4;
}

.eep-anota-description {
    font-size: 0.8125rem;
    color: #6b7280;
    margin: 0 0 0.75rem 0;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.eep-anota-price {
    font-size: 0.9375rem;
    font-weight: 600;
    color: #059669;
    margin: 0;
}

/* Footer com Contador e Botão Confirmar */
.eep-anota-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: #f9fafb;
    border-radius: 12px;
    margin-bottom: 1rem;
}

/* Contador de Seleções */
.eep-selection-counter {
    font-size: 0.875rem;
    color: #6b7280;
}

.eep-selected-count {
    font-weight: 700;
    color: var(--eep-success);
    font-size: 1.125rem;
}

.eep-selection-limit {
    font-weight: 600;
    color: #374151;
}

/* Botão Confirmar Seleção */
.eep-confirm-selection {
    background: linear-gradient(135deg, var(--eep-success) 0%, var(--eep-success-hover) 100%);
    color: white;
    border: none;
    border-radius: 10px;
    padding: 0.75rem 1.5rem;
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.eep-confirm-selection:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
}

.eep-confirm-selection:active {
    transform: translateY(0);
}

/* Botão Reabrir Seleção */
.eep-reopen-selection {
    background: rgba(59, 130, 246, 0.1);
    color: #3b82f6;
    border: 1px solid #3b82f6;
    border-radius: 8px;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.eep-reopen-selection:hover {
    background: rgba(59, 130, 246, 0.2);
    transform: scale(1.02);
}

/* Resumo da Seleção */
.eep-selection-summary {
    background: #f0fdf5;
    border: 1px solid #10b981;
    border-radius: 10px;
    padding: 1rem;
    margin: 1rem 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.eep-selection-summary-content {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.eep-selection-summary-image {
    width: 50px;
    height: 50px;
    border-radius: 8px;
    object-fit: cover;
    border: 1px solid #d1d5db;
}

.eep-selection-summary-text {
    flex: 1;
}

.eep-selection-summary-title {
    font-weight: 600;
    color: #1f2937;
    margin: 0 0 0.25rem 0;
    font-size: 0.9375rem;
}

.eep-selection-summary-price {
    color: #059669;
    font-size: 0.875rem;
    font-weight: 500;
}

/* Popup de Confirmação Flutuante - Namespace único para evitar conflitos */
.eep-anota-confirm-popup {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: white;
    border-radius: 12px;
    padding: 1rem 1.5rem;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    z-index: var(--eep-z-overlay);
    display: flex;
    align-items: center;
    gap: 1rem;
    animation: eepAnotaSlideUp 0.3s ease;
    max-width: 320px;
}

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

.eep-anota-confirm-popup-text {
    flex: 1;
}

.eep-anota-confirm-popup-title {
    font-weight: 600;
    color: #1f2937;
    margin: 0 0 0.25rem 0;
    font-size: 0.875rem;
}

.eep-anota-confirm-popup-option {
    color: #6b7280;
    font-size: 0.8125rem;
    margin: 0;
}

.eep-anota-confirm-popup-btn {
    background: linear-gradient(135deg, var(--eep-success) 0%, var(--eep-success-hover) 100%);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s ease;
}

.eep-anota-confirm-popup-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.eep-confirm-icon {
    font-size: 1.125rem;
}

/* Mensagem de Validação Melhorada */
.eep-validation-message {
    margin-top: 0.75rem;
    padding: 1rem;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 8px;
    color: #991b1b;
    font-size: 0.875rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    animation: eepAnotaSlideDown 0.3s ease;
}

.eep-validation-message.success {
    background: #f0fdf4;
    border-color: #86efac;
    color: #14532d;
}

.eep-validation-message.warning {
    background: #fefce8;
    border-color: #fde047;
    color: #713f12;
}

.eep-validation-message::before {
    content: "⚠️";
    font-size: 1.125rem;
}

.eep-validation-message.success::before {
    content: "✅";
}

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

/* Toast de Aviso para Limite - Precisa estar no body mas com namespace único */
.eep-anota-toast-warning {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    z-index: var(--eep-z-modal);
    max-width: 400px;
    text-align: center;
    animation: eepAnotaFadeInScale 0.3s ease;
}

.eep-anota-toast-warning h4 {
    color: #f59e0b;
    margin: 0 0 0.5rem 0;
    font-size: 1.125rem;
}

.eep-anota-toast-warning p {
    color: #374151;
    margin: 0 0 1rem 0;
    font-size: 0.9375rem;
}

.eep-anota-toast-warning button {
    background: #f59e0b;
    color: white;
    border: none;
    border-radius: 8px;
    padding: 0.5rem 1rem;
    font-weight: 600;
    cursor: pointer;
}

@keyframes eepAnotaFadeInScale {
    from {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

/* Responsividade - Tablet */
@media (max-width: 1024px) {
    .eep-anota-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Responsividade - Mobile */
@media (max-width: 768px) {
    .eep-anota-container {
        padding: 1rem;
    }

    .eep-anota-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }

    .eep-anota-image-wrapper {
        height: 140px;
    }

    .eep-anota-footer {
        flex-direction: column;
        gap: 1rem;
    }

    .eep-confirm-selection {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .eep-anota-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }

    .eep-anota-image-wrapper {
        height: 120px;
    }

    .eep-anota-content {
        padding: 0.75rem;
    }

    .eep-anota-title {
        font-size: 0.875rem;
    }
}

/* Acessibilidade */
.eep-anota-item:focus-visible {
    outline: 2px solid var(--eep-success);
    outline-offset: 2px;
}

.eep-control-btn:focus-visible {
    outline: 2px solid var(--eep-success);
    outline-offset: -1px;
}

/* Garantir visibilidade */
.eep-anota-container,
.eep-anota-grid,
.eep-anota-item {
    opacity: 1;
    visibility: visible;
}
