/* ==============================================
   Plugin: Clinic Procedures - Layout CERPE Style
   ============================================== */

/* Container Principal */
.entry-content .cp-main-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 20px;
}

/* Título e Descrição */
.cp-page-title {
    font-size: 32px;
    font-weight: 700;
    color: #1a1a1a;
    margin-bottom: 12px;
    text-align: center;
}

.cp-page-description {
    font-size: 16px;
    color: #666;
    margin-bottom: 40px;
    text-align: center;
}

/* Layout com Sidebar */
.cp-content-wrapper {
    display: flex;
    gap: 32px;
    align-items: flex-start;
}

/* Sidebar - Categorias e Procedimentos */
.cp-sidebar {
    flex: 0 0 280px;
    background: #fff;
    border-radius: 8px;
    padding: 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    position: sticky;
    top: 20px;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
}

/* Seções da Sidebar */
.cp-sidebar-section {
    margin-bottom: 32px;
}

.cp-sidebar-section:last-child {
    margin-bottom: 0;
}

.cp-sidebar-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 16px;
    font-weight: 700;
    color: #1a1a1a;
    margin: 0 0 16px 0;
    padding-bottom: 12px;
    border-bottom: 2px solid #f0f0f0;
}

.cp-sidebar-title svg {
    color: #0073aa;
}

/* Lista de Categorias na Sidebar */
.cp-category-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.cp-category-list li {
    margin-bottom: 4px;
}

.cp-category-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    color: #333 !important;
    text-decoration: none !important;
    border-radius: 6px;
    font-size: 14px;
    transition: all 0.3s ease;
    border-left: 3px solid transparent;
}

.cp-category-item:hover {
    background: #f8f9fa;
    border-left-color: #0073aa;
    color: #0073aa !important;
    transform: translateX(4px);
}

.cp-category-item.active {
    background: #e8f4f8;
    border-left-color: #0073aa;
    color: #0073aa !important;
    font-weight: 600;
}

.cp-category-name {
    flex: 1;
}

.cp-category-count {
    font-size: 12px;
    color: #999;
    font-weight: 600;
}

.cp-category-item.active .cp-category-count {
    color: #0073aa;
}

/* Procedimentos em Destaque na Sidebar */
.cp-top-procedures {
    list-style: none;
    padding: 0;
    margin: 0;
}

.cp-top-procedures li {
    margin-bottom: 8px;
}

.cp-top-procedures a {
    display: block;
    padding: 8px 12px;
    color: #666;
    text-decoration: none;
    border-radius: 6px;
    font-size: 13px;
    transition: all 0.3s ease;
    border-left: 3px solid transparent;
    line-height: 1.4;
}

.cp-top-procedures a:hover {
    background: #f8f9fa;
    border-left-color: #0073aa;
    color: #0073aa;
    transform: translateX(4px);
}

/* Conteúdo Principal */
.cp-main-content {
    flex: 1;
    min-width: 0;
}

/* Campo de Busca e Botão Limpar */
.cp-search-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
}

.cp-search {
    position: relative;
    flex: 1;
}

.cp-search form {
    position: relative;
    display: flex;
    align-items: center;
}

.cp-search-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    color: #999;
    pointer-events: none;
    z-index: 1;
}

.cp-search input[type="text"] {
    width: 100%;
    padding: 16px 180px 16px 48px;
    border: 2px solid #e1e4e8;
    border-radius: 8px;
    font-size: 16px;
    transition: all 0.3s ease;
    background: white;
}

.cp-search input[type="text"]:focus {
    outline: none;
    border-color: #0073aa;
    box-shadow: 0 0 0 3px rgba(0, 115, 170, 0.1);
}

.cp-search input[type="text"]::placeholder {
    color: #999;
}

/* Container de Filtros Ativos */
.cp-active-filters {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    gap: 8px;
    pointer-events: none;
}

/* Badge de Pesquisa Ativa */
.cp-active-search {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: #28a745;
    color: white;
    border-radius: 6px;
    font-size: 13px;
}

.cp-active-search svg {
    stroke: white;
    flex-shrink: 0;
}

.cp-active-search strong {
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 150px;
}

/* Badge de Letra Ativa */
.cp-active-letter {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: #0073aa;
    color: white;
    border-radius: 6px;
    font-size: 14px;
}

.cp-active-letter strong {
    font-size: 16px;
    font-weight: 700;
}

/* Botão Limpar Filtros */
.cp-clear-filters {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 12px 20px;
    background: #f8f9fa;
    color: #666 !important;
    text-decoration: none !important;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
    border: 2px solid #e1e4e8;
    white-space: nowrap;
}

.cp-clear-filters:hover {
    background: #dc3545;
    color: white !important;
    border-color: #dc3545;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(220, 53, 69, 0.3);
}

.cp-clear-filters svg {
    stroke-width: 2.5px;
}

.cp-search select {
    display: none;
}

.cp-search button[type="submit"] {
    display: none;
}

/* Grid de Cards - Estilo CERPE */
.cp-grid {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 32px;
    min-height: 400px;
    position: relative;
}

/* Card Individual - Layout Vertical */
.cp-card {
    background: white;
    border-radius: 8px;
    padding: 24px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    border: 1px solid #e8e8e8;
    position: relative;
}

.cp-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
    transform: translateY(-2px);
}

/* Header do Card (Título + Redes Sociais) */
.cp-card__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    gap: 16px;
}

/* Redes Sociais ao Lado do Título */
.cp-card__social {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

.cp-social-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: transparent;
    color: #007cba; /* Mesma cor do botão principal */
    transition: all 0.2s ease;
    text-decoration: none;
}

.cp-social-icon:hover {
    background: #007cba;
    color: #fff;
    transform: translateY(-1px);
}

.cp-social-icon svg {
    display: block;
}

/* Informações do Card */
.cp-card-info {
    width: 100%;
    margin-bottom: 0;
}

/* Ícone do Card */
.cp-card__icon {
    float: left;
    width: 50px;
    height: 50px;
    margin-right: 16px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: #f8f9fa;
}

.cp-card__icon img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.cp-card__title {
    font-size: 20px;
    font-weight: 700;
    color: #1a1a1a;
    margin: 0 0 12px 0;
    line-height: 1.3;
}

.cp-card__desc {
    font-size: 14px;
    color: #666;
    line-height: 1.7;
    margin: 0;
    clear: both;
}

/* Footer do Card - Preço e Botões na mesma linha */
.cp-card__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid #f0f0f0;
}

.cp-card__price {
    font-size: 13px;
    color: #666;
    margin: 0;
    flex-shrink: 0;
}

.cp-card__price strong {
    font-size: 24px;
    font-weight: 700;
    color: #0073aa;
    display: block;
    margin-top: 4px;
}

/* Ações do Card */
.cp-card__actions {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-shrink: 0;
}

.cp-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 14px;
    text-decoration: none !important;
    transition: all 0.3s ease;
    white-space: nowrap;
    border: none;
    cursor: pointer;
}

.cp-btn-primary {
    background: #0073aa;
    color: white !important;
    box-shadow: 0 2px 6px rgba(0, 115, 170, 0.2);
}

.cp-btn-primary:hover {
    background: #005a87;
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(0, 115, 170, 0.3);
}

.cp-btn-secondary {
    background: transparent;
    color: #0073aa !important;
    border: 2px solid #0073aa;
}

.cp-btn-secondary:hover {
    background: #0073aa;
    color: white !important;
}

/* Ícone do Card (se houver) */
.cp-card__icon {
    flex-shrink: 0;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 16px;
    border-radius: 8px;
    background: #f8f9fa;
}

.cp-card__icon img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

/* Paginação - Estilo CERPE */
.cp-pagination-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    margin-top: 40px;
    flex-wrap: wrap;
}

.cp-pagination {
    display: flex;
    align-items: center;
    gap: 8px;
}

.cp-pagination a,
.cp-pagination span {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 12px;
    background: white;
    color: #333;
    text-decoration: none;
    border: 1px solid #e1e4e8;
    border-radius: 6px;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.3s ease;
}

.cp-pagination a:hover {
    background: #0073aa;
    color: white;
    border-color: #0073aa;
    transform: translateY(-1px);
}

.cp-pagination .current {
    background: #0073aa;
    color: white;
    border-color: #0073aa;
}

.cp-pagination .dots {
    border: none;
    background: transparent;
    color: #999;
}

.cp-results-count {
    font-size: 14px;
    color: #666;
    text-align: center;
    width: 100%;
}

/* Loading Overlay */
.cp-loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.95);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 999;
    border-radius: 8px;
    backdrop-filter: blur(2px);
}

.cp-loading-spinner {
    text-align: center;
}

.cp-spinner {
    width: 50px;
    height: 50px;
    margin: 0 auto 16px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #0073aa;
    border-radius: 50%;
    animation: cp-spin 1s linear infinite;
}

@keyframes cp-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.cp-loading-spinner p {
    color: #0073aa;
    font-weight: 600;
    font-size: 14px;
    margin: 0;
}

/* Estados do Input */
.cp-search input[type="text"].cp-input-incomplete {
    border-color: #ffa500;
    background: #fff9f0;
}

.cp-search input[type="text"].cp-input-error {
    border-color: #dc3545;
    background: #fff5f5;
    animation: cp-shake 0.3s ease;
}

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

.cp-char-counter {
    display: block;
    font-size: 12px;
    color: #999;
    margin-top: 6px;
    font-style: italic;
}

/* Mensagem de "Nenhum resultado" */
.cp-grid > p {
    text-align: center;
    padding: 60px 20px;
    font-size: 16px;
    color: #666;
    background: #f8f9fa;
    border-radius: 8px;
    grid-column: 1 / -1;
}

/* Animação dos Cards */
.cp-card {
    animation: cp-fadeIn 0.4s ease;
}

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

/* Responsividade - Tablets */
@media (max-width: 992px) {
    .cp-content-wrapper {
        flex-direction: column;
    }
    
    .cp-sidebar {
        flex: 0 0 auto;
        width: 100%;
        position: static;
        max-height: none;
    }
    
    .cp-sidebar-section {
        margin-bottom: 24px;
    }
}

/* Responsividade - Mobile */
@media (max-width: 768px) {
    .cp-page-title {
        font-size: 24px;
    }
    
    .cp-search-wrapper {
        flex-direction: column;
        gap: 10px;
    }
    
    .cp-search {
        width: 100%;
    }
    
    .cp-search input[type="text"] {
        padding: 14px 160px 14px 44px;
        font-size: 15px;
    }
    
    .cp-active-filters {
        right: 12px;
        gap: 6px;
    }
    
    .cp-active-search {
        padding: 4px 8px;
        font-size: 11px;
    }
    
    .cp-active-search svg {
        width: 12px;
        height: 12px;
    }
    
    .cp-active-search strong {
        font-size: 11px;
        max-width: 80px;
    }
    
    .cp-active-letter {
        padding: 4px 8px;
        font-size: 12px;
    }
    
    .cp-active-letter strong {
        font-size: 13px;
    }
    
    .cp-clear-filters {
        width: 100%;
        justify-content: center;
        padding: 10px 16px;
        font-size: 13px;
    }
    
    .cp-sidebar {
        padding: 16px;
    }
    
    .cp-card {
        padding: 16px;
    }
    
    .cp-card__icon {
        width: 40px;
        height: 40px;
        margin-right: 12px;
    }
    
    .cp-card__header {
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .cp-card__title {
        font-size: 18px;
        flex: 1 1 100%;
    }
    
    .cp-card__social {
        flex: 1 1 100%;
        justify-content: flex-start;
    }
    
    .cp-card__desc {
        font-size: 13px;
    }
    
    /* Footer responsivo - empilha em mobile */
    .cp-card__footer {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    .cp-card__price {
        width: 100%;
    }
    
    .cp-card__price strong {
        font-size: 20px;
    }
    
    .cp-card__actions {
        width: 100%;
        justify-content: flex-start;
        flex-direction: column;
        gap: 8px;
    }
    
    .cp-btn {
        width: 100%;
        padding: 10px 16px;
        font-size: 13px;
    }
    
    .cp-pagination a,
    .cp-pagination span {
        min-width: 36px;
        height: 36px;
        padding: 0 8px;
        font-size: 13px;
    }
}

/* Ajustes WordPress */
.entry-content .cp-search,
.entry-content .cp-grid,
.entry-content .cp-pagination {
    max-width: 100%;
}

.entry-content .cp-card p:last-child {
    margin-bottom: 0;
}

/* Botão desabilitado */
.cp-search button[type="submit"]:disabled,
.cp-btn:disabled {
    cursor: not-allowed;
    opacity: 0.6;
    transform: none !important;
}

/* ==============================================
   Filtro Alfabético Simples
   ============================================== */

.cp-alphabet-filter-simple {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 16px 0;
    margin-bottom: 24px;
    border-bottom: 1px solid #e8e8e8;
}

.cp-letter-simple {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    padding: 0 8px;
    color: #666 !important;
    text-decoration: none !important;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.2s ease;
    border-bottom: 2px solid transparent;
}

.cp-letter-simple:hover {
    color: #0073aa !important;
    border-bottom-color: #0073aa;
}

.cp-letter-simple.active {
    color: #0073aa !important;
    border-bottom-color: #0073aa;
    font-weight: 700;
}

.cp-letter-simple:first-child {
    min-width: 50px;
}

/* Responsividade do Filtro Alfabético */
@media (max-width: 768px) {
    .cp-alphabet-filter-simple {
        padding: 12px 0;
        gap: 4px;
    }
    
    .cp-letter-simple {
        min-width: 28px;
        height: 28px;
        font-size: 12px;
    }
    
    .cp-letter-simple:first-child {
        min-width: 45px;
    }
}
