/**
 * Custom Paid Forum - Frontend Styles
 * CSS mínimo - herda estilos do tema Woodmart
 */

/* ==========================================================================
   Layout Principal - 100% largura
   ========================================================================== */

/* Forçar largura total nas páginas My Account do WooCommerce (incl. Woodmart) */
body.woocommerce-account .container,
body.woocommerce-account .wd-container,
body.woocommerce-account .site-content .container,
body.woocommerce-account .content-area .container,
body.woocommerce-account .main-page-wrapper .container,
body.woocommerce-account .main-wrapper .container {
    max-width: 100% !important;
    width: 100% !important;
    padding-left: 15px;
    padding-right: 15px;
    box-sizing: border-box;
}

/* Coluna de conteúdo do My Account */
body.woocommerce-account .woocommerce-MyAccount-content,
.woocommerce-MyAccount-content {
    width: 100% !important;
    max-width: 100% !important;
    flex: 1 1 100% !important;
    box-sizing: border-box;
}

/* Override containers em páginas com shortcodes CPF */
.entry-content:has(.cpf-create-question),
.entry-content:has(.cpf-question-detail),
.entry-content:has(.cpf-my-questions),
.entry-content:has(.cpf-questions-list) {
    max-width: 100% !important;
    width: 100% !important;
}

.cpf-questions-list,
.cpf-my-questions,
.cpf-create-question,
.cpf-question-detail {
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 20px;
    box-sizing: border-box;
}

/* Garantir que o conteúdo do fórum ocupa toda a área disponível */
.woocommerce-account .woocommerce-MyAccount-content .cpf-stats-grid,
.woocommerce-account .woocommerce-MyAccount-content table {
    width: 100%;
}

/* Tabelas responsivas em largura total */
.woocommerce-MyAccount-content .woocommerce-orders-table,
.woocommerce-MyAccount-content .shop_table {
    width: 100%;
    table-layout: auto;
}

/* ==========================================================================
   Header
   ========================================================================== */

.cpf-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #e5e5e5;
}

.cpf-header h2 {
    margin: 0;
    font-size: 28px;
}

.cpf-subtitle {
    color: #666;
    margin-top: 10px;
}

/* Botões herdam do tema */
.cpf-header .button,
.cpf-header .btn {
    /* Herdar do Woodmart */
}

/* ==========================================================================
   Widget de Créditos
   ========================================================================== */

.cpf-credits-widget {
    background: #f8f9fa;
    padding: 15px 20px;
    border-radius: 4px;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.cpf-credits-count {
    font-size: 16px;
}

.credits-label {
    margin-right: 10px;
    color: #666;
}

.credits-number {
    font-size: 24px;
    font-weight: bold;
    color: #2c3e50;
}

/* ==========================================================================
   Estatísticas
   ========================================================================== */

.cpf-stats,
.cpf-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
    width: 100%;
}

.stat-item {
    background: #fff;
    padding: 20px;
    border-radius: 4px;
    border: 1px solid #e5e5e5;
    text-align: center;
}

.stat-label {
    display: block;
    color: #666;
    font-size: 14px;
    margin-bottom: 10px;
}

.stat-value {
    display: block;
    font-size: 32px;
    font-weight: bold;
    color: #2c3e50;
}

/* ==========================================================================
   Lista de Perguntas
   ========================================================================== */

.cpf-questions {
    margin-bottom: 30px;
}

.cpf-question-item {
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 4px;
    padding: 20px;
    margin-bottom: 15px;
    transition: box-shadow 0.3s ease;
}

.cpf-question-item:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.cpf-question-item.status-answered {
    border-left: 4px solid #27ae60;
}

.cpf-question-item.status-pending {
    border-left: 4px solid #f39c12;
}

.cpf-question-item.status-returned {
    border-left: 4px solid #e67e22;
}

.question-status {
    margin-bottom: 10px;
}

.question-title {
    margin: 0 0 10px 0;
    font-size: 20px;
}

.question-title a {
    color: #2c3e50;
    text-decoration: none;
}

.question-title a:hover {
    color: #3498db;
}

.question-excerpt {
    color: #666;
    margin-bottom: 15px;
    line-height: 1.6;
}

.question-meta {
    display: flex;
    gap: 20px;
    font-size: 14px;
    color: #999;
}

/* ==========================================================================
   Detalhe da Pergunta
   ========================================================================== */

.cpf-breadcrumb {
    margin-bottom: 20px;
}

.cpf-breadcrumb a {
    /* Herdar do tema Woodmart */
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.cpf-question {
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 4px;
    padding: 30px;
    margin-bottom: 30px;
}

.question-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 20px;
}

.question-header .question-title {
    font-size: 32px;
    margin: 0;
}

.question-content {
    line-height: 1.8;
    color: #333;
}

/* ==========================================================================
   Respostas
   ========================================================================== */

.cpf-answers {
    margin-bottom: 30px;
}

.answers-title {
    font-size: 24px;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #e5e5e5;
}

.cpf-answer {
    background: #f8f9fa;
    border: 1px solid #e5e5e5;
    border-left: 4px solid #3498db;
    border-radius: 4px;
    padding: 25px;
    margin-bottom: 20px;
}

.answer-header {
    display: flex;
    gap: 15px;
    align-items: center;
    margin-bottom: 15px;
    font-size: 14px;
    color: #666;
}

.answer-content {
    line-height: 1.8;
    color: #333;
}

/* ==========================================================================
   Formulários
   ========================================================================== */

.cpf-form-wrapper {
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 4px;
    padding: 30px;
    margin-bottom: 30px;
}

.cpf-form .form-group {
    margin-bottom: 20px;
}

.cpf-form label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: inherit;
}

.cpf-form .required {
    color: #e74c3c;
}

.cpf-form .form-control,
.cpf-form input[type="text"],
.cpf-form textarea {
    width: 100%;
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
    transition: border-color 0.3s ease;
}

.cpf-form .form-control:focus,
.cpf-form input[type="text"]:focus,
.cpf-form textarea:focus {
    border-color: var(--wd-primary-color, #3498db);
    outline: none;
}

.cpf-form .form-actions {
    margin-top: 20px;
}

/* Remover estilos dos botões - herdar do tema */
.cpf-form button,
.cpf-form .button {
    /* Herdar tudo do tema Woodmart */
}

.cpf-answer-form {
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 4px;
    padding: 30px;
}

.cpf-answer-form h3 {
    margin-top: 0;
    margin-bottom: 20px;
}

/* ==========================================================================
   Badges
   ========================================================================== */

.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 3px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-success {
    background: #27ae60;
    color: #fff;
}

.badge-pending {
    background: #f39c12;
    color: #fff;
}

.badge-admin {
    background: #3498db;
    color: #fff;
}

.badge-returned {
    background: #e67e22;
    color: #fff;
}

/* Estados nas listas Minhas Perguntas - mesmas cores do painel admin */
.cpf-status-pending {
    background: #f39c12 !important;
    color: #fff !important;
}

.cpf-status-answered {
    background: #27ae60 !important;
    color: #fff !important;
}

.cpf-status-returned {
    background: #e67e22 !important;
    color: #fff !important;
}

/* Badges na tabela e em todo o painel do utilizador */
.woocommerce-orders-table .cpf-status-pending,
.woocommerce-orders-table .cpf-status-answered,
.woocommerce-orders-table .cpf-status-returned,
.woocommerce-MyAccount-content .cpf-status-pending,
.woocommerce-MyAccount-content .cpf-status-answered,
.woocommerce-MyAccount-content .cpf-status-returned {
    padding: 4px 10px;
    border-radius: 4px;
    font-weight: 600;
    display: inline-block;
}

/* Garantir cores no painel do utilizador (Minhas Perguntas, tabela, listas) */
.woocommerce-MyAccount-content mark.cpf-status-pending,
.cpf-question-item .badge-pending {
    background: #f39c12 !important;
    color: #fff !important;
}

.woocommerce-MyAccount-content mark.cpf-status-answered,
.cpf-question-item .badge-success {
    background: #27ae60 !important;
    color: #fff !important;
}

.woocommerce-MyAccount-content mark.cpf-status-returned,
.cpf-question-item .badge-returned {
    background: #e67e22 !important;
    color: #fff !important;
}

/* ==========================================================================
   Avisos e Mensagens
   ========================================================================== */

.cpf-notice {
    padding: 20px;
    border-radius: 4px;
    margin-bottom: 20px;
}

.cpf-notice h3 {
    margin-top: 0;
}

.cpf-notice-warning {
    background: #fff3cd;
    border: 1px solid #ffc107;
    color: #856404;
}

.cpf-notice-info {
    background: #d1ecf1;
    border: 1px solid #17a2b8;
    color: #0c5460;
}

.cpf-notice-success {
    background: #d4edda;
    border: 1px solid #28a745;
    color: #155724;
}

.cpf-notice-error {
    background: #f8d7da;
    border: 1px solid #dc3545;
    color: #721c24;
}

.cpf-message {
    padding: 15px;
    border-radius: 4px;
    margin-top: 15px;
}

/* Botões nos avisos herdam do tema */
.cpf-notice .button,
.cpf-notice .btn {
    /* Herdar do Woodmart */
}

.cpf-no-questions {
    text-align: center;
    padding: 60px 20px;
    color: #999;
}

/* ==========================================================================
   Diretrizes
   ========================================================================== */

.cpf-guidelines {
    background: #f8f9fa;
    border: 1px solid #e5e5e5;
    border-radius: 4px;
    padding: 20px;
}

.cpf-guidelines h3 {
    margin-top: 0;
}

.cpf-guidelines ul {
    margin: 0;
    padding-left: 20px;
}

.cpf-guidelines li {
    margin-bottom: 8px;
    line-height: 1.6;
}

/* ==========================================================================
   Modal de Confirmação
   ========================================================================== */

.cpf-confirm-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.cpf-confirm-modal {
    background: #fff;
    border-radius: 6px;
    padding: 25px;
    max-width: 500px;
    width: 100%;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.cpf-confirm-modal h3 {
    margin: 0 0 15px 0;
    font-size: 20px;
}

.cpf-confirm-preview {
    background: #f8f9fa;
    border: 1px solid #e5e5e5;
    border-radius: 4px;
    padding: 12px;
    margin-bottom: 15px;
    max-height: 120px;
    overflow-y: auto;
    font-size: 14px;
    line-height: 1.5;
    color: #333;
}

.cpf-confirm-note {
    margin: 0 0 10px 0;
    font-size: 14px;
    color: #666;
}

.cpf-confirm-actions {
    margin-top: 20px;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.cpf-confirm-actions .button {
    min-width: 120px;
}

/* ==========================================================================
   Paginação
   ========================================================================== */

.cpf-pagination {
    text-align: center;
    margin-top: 30px;
}

.cpf-pagination .page-numbers {
    display: inline-block;
    padding: 8px 12px;
    margin: 0 2px;
    border: 1px solid #ddd;
    border-radius: 3px;
    text-decoration: none;
    color: #333;
    transition: all 0.3s ease;
}

.cpf-pagination .page-numbers:hover,
.cpf-pagination .page-numbers.current {
    background: #3498db;
    color: #fff;
    border-color: #3498db;
}

/* ==========================================================================
   Responsivo
   ========================================================================== */

@media (max-width: 768px) {
    .cpf-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .cpf-header .button {
        margin-top: 15px;
    }
    
    .cpf-stats {
        grid-template-columns: 1fr;
    }
    
    .question-meta {
        flex-direction: column;
        gap: 5px;
    }
    
    .answer-header {
        flex-wrap: wrap;
    }
}
