/* ========================================
   ESTILOS DOS CARDS DE TEMPLATE
   ======================================== */

/* Card Container */
.dashboard-card {
    background: #ffffff;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.dashboard-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
}

/* Badge Numerada */
.card-number {
    position: absolute;
    top: 16px;
    left: 16px;
    background: #ffc107;
    color: #ffffff;
    font-weight: 700;
    font-size: 13px;
    padding: 6px 14px;
    border-radius: 16px;
    z-index: 10;
    box-shadow: 0 3px 10px rgba(255, 107, 53, 0.35);
    letter-spacing: 0.3px;
}

/* Preview do Dashboard */
.card-preview {
    position: relative;
    width: 100%;
    height: 260px;
    background: linear-gradient(135deg, #1e2a3a 0%, #2d3e52 100%);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.preview-iframe {
    width: 290%;
    height: 300%;
    border: none;
    border-radius: 6px;
    transition: transform 0.4s ease;
    /* Para simular o efeito de imagem */
    transform-origin: top left;
    transform: scale(0.35); /* Ajuste a escala para caber no preview */
    position: absolute;
    top: 0;
    left: 0;
    pointer-events: none; /* Desabilita interação dentro do iframe */
}

.dashboard-card:hover .preview-iframe {
    transform: scale(0.37); /* Ajuste a escala para o hover */
}

.card-preview {
    /* Ajuste o padding para compensar a escala */
    padding: 0;
    overflow: hidden;
}

/* Informações do Card */
.card-info {
    padding: 20px 20px 18px 20px;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.card-title {
    font-size: 20px;
    font-weight: 700;
    color: #1a1a1a;
    margin: 0 0 6px 0;
    line-height: 1.3;
    letter-spacing: -0.2px;
}

.card-subtitle {
    font-size: 13px;
    color: #6b7280;
    margin: 0 0 16px 0;
    line-height: 1.5;
    flex: 1;
}

/* Botões de Ação */
.card-buttons {
    display: flex;
    gap: 10px;
    margin-bottom: 12px;
}

.btn-view,
.btn-copy {
    flex: 1;
    padding: 9px 14px;
    border: none;
    border-radius: 10px;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.25s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.btn-view i,
.btn-copy i {
    font-size: 15px;
}

.btn-view {
    background-color: #f3f4f6;
    color: #374151;
}

.btn-view:hover {
    background-color: #e5e7eb;
    transform: translateY(-1px);
}

.btn-copy {
    background: #ffc107;
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(255, 107, 53, 0.25);
}

.btn-copy:hover {
    box-shadow: 0 4px 14px rgba(255, 107, 53, 0.35);
    transform: translateY(-1px);
}

/* Botão Ver Código */
.btn-code {
    background: none;
    border: none;
    color: #9ca3af;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    padding: 6px 0;
    transition: color 0.25s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.btn-code:hover {
    color: #ff6b35;
}

.btn-code i {
    font-size: 13px;
}

/* ========================================
   MODAL DE CÓDIGO
   ======================================== */

.code-modal {
    display: none;
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.75);
    animation: fadeIn 0.3s ease;
}

.code-modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.code-modal-content {
    background: #ffffff;
    border-radius: 16px;
    width: 90%;
    max-width: 900px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease;
}

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

.code-modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.code-modal-title {
    font-size: 18px;
    font-weight: 700;
    color: #1a1a1a;
    margin: 0;
}

.code-modal-close {
    background: none;
    border: none;
    font-size: 28px;
    color: #9ca3af;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.code-modal-close:hover {
    background-color: #f3f4f6;
    color: #374151;
}

.code-modal-body {
    padding: 0;
    overflow-y: auto;
    flex: 1;
    background-color: #1e1e1e;
}

.code-modal-body pre {
    margin: 0;
    padding: 24px;
    background-color: #1e1e1e;
    border-radius: 0;
    overflow-x: auto;
}

.code-modal-body code {
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', monospace;
    font-size: 13px;
    line-height: 1.6;
    color: #d4d4d4;
    white-space: pre;
    display: block;
}

.code-modal-footer {
    padding: 16px 24px;
    border-top: 1px solid #e5e7eb;
    display: flex;
    justify-content: flex-end;
}

.btn-copy-code {
    padding: 10px 20px;
    background: #ffc107;
    color: #ffffff;
    border: none;
    border-radius: 10px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.25s ease;
    box-shadow: 0 2px 8px rgba(255, 107, 53, 0.25);
}

.btn-copy-code:hover {
    box-shadow: 0 4px 14px rgba(255, 107, 53, 0.35);
    transform: translateY(-1px);
}

.btn-copy-code i {
    font-size: 16px;
}

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

@media (max-width: 768px) {
    .card-preview {
        height: 220px;
    }
    
    .card-title {
        font-size: 18px;
    }
    
    .card-subtitle {
        font-size: 12px;
    }
    
    .card-buttons {
        flex-direction: column;
    }
    
    .btn-view,
    .btn-copy {
        width: 100%;
    }
    
    .code-modal-content {
        width: 95%;
        max-height: 90vh;
    }
    
    .code-modal-body code {
        font-size: 12px;
    }
}

/* ========================================
   ESTADO OCULTO PARA FILTROS
   ======================================== */

.template-card.hidden {
    display: none;
}

/* ========================================
   MODAL DE VISUALIZAÇÃO EM TELA CHEIA
   ======================================== */

.preview-modal {
    display: none;
    position: fixed;
    z-index: 9998; /* Abaixo do modal de código */
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: #f5f5f5; /* Fundo claro para o modal */
    animation: fadeIn 0.3s ease;
}

.preview-modal.active {
    display: flex;
    flex-direction: column;
}

.preview-modal-header {
    height: 64px;
    background-color: #ffffff;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    flex-shrink: 0;
}

.header-info {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-info .card-number {
    position: static;
    transform: none;
    background: #ffc107;
    color: #ffffff;
    font-weight: 700;
    font-size: 13px;
    padding: 6px 14px;
    border-radius: 16px;
    box-shadow: none;
}

.header-info .text-info {
    display: flex;
    flex-direction: column;
}

.header-info .card-title {
    font-size: 16px;
    font-weight: 600;
    color: #1a1a1a;
    margin: 0;
}

.header-info .card-subtitle {
    font-size: 12px;
    color: #6b7280;
    margin: 0;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.btn-action {
    padding: 8px 16px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
    background-color: transparent;
    color: #374151;
}

.btn-action:hover {
    background-color: #f3f4f6;
}

.btn-action i {
    font-size: 14px;
}

.btn-action#btnCopyHTML {
    background: #ffc107;
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(255, 107, 53, 0.25);
}

.btn-action#btnCopyHTML:hover {
    box-shadow: 0 4px 14px rgba(255, 107, 53, 0.35);
    background: linear-gradient(135deg, #ff8856 0%, #ff6b35 100%);
}

.btn-close-modal {
    padding: 8px;
    font-size: 18px;
    color: #9ca3af;
}

.btn-close-modal:hover {
    background-color: #f3f4f6;
    color: #1a1a1a;
}

.preview-modal-body {
    flex: 1;
    overflow: hidden;
}

.preview-modal-body iframe {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
}

/* Ajuste no modal de código para ficar acima do preview */
.code-modal {
    z-index: 9999;
}

/* Responsividade para o cabeçalho do modal */
@media (max-width: 768px) {
    .preview-modal-header {
        height: auto;
        flex-direction: column;
        align-items: flex-start;
        padding: 16px;
        gap: 10px;
    }
    
    .header-info {
        gap: 10px;
    }
    
    .header-info .card-title {
        font-size: 14px;
    }
    
    .header-info .card-subtitle {
        font-size: 11px;
    }
    
    .header-actions {
        width: 100%;
        justify-content: space-between;
    }
    
    .btn-action {
        flex: 1;
        padding: 6px 10px;
        font-size: 12px;
    }
    
    .btn-close-modal {
        flex: none;
        padding: 6px;
    }
}
