/*
 * Plugin: Catálogo de Peças e Manuais
 * Version: 1.2.1 (UI Fixes)
 */

/* --- Variáveis de Cor e Estilo --- */
:root {
    --cpm-primary-color: #0073aa;
    --cpm-primary-hover: #005a87;
    --cpm-light-gray: #f0f0f1;
    --cpm-medium-gray: #e0e0e0;
    --cpm-dark-gray: #555;
    --cpm-text-color: #333;
    --cpm-success-bg: #d4edda;
    --cpm-success-text: #155724;
    --cpm-error-bg: #f8d7da;
    --cpm-error-text: #721c24;
    --cpm-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    --cpm-shadow-hover: 0 6px 20px rgba(0, 0, 0, 0.12);
    --cpm-border-radius: 12px;
}

/* --- Base e Container --- */
#cpm-container {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: var(--cpm-text-color);
    background-color: #fff;
    padding: 20px;
    border-radius: var(--cpm-border-radius);
}

@media (min-width: 768px) {
    #cpm-container {
        padding: 40px;
    }
}

#cpm-container h2,
#cpm-container h3 {
    color: var(--cpm-text-color);
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.4em;
    margin-bottom: 20px;
}
#cpm-container h2 {
    font-size: 1.8em;
}

/* --- Botão "Voltar" e Notificações --- */
.cpm-back-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 25px;
    background-color: var(--cpm-light-gray);
    color: var(--cpm-dark-gray);
    padding: 8px 15px;
    border-radius: 20px;
    text-decoration: none;
    font-weight: bold;
    transition: all 0.2s ease;
}
.cpm-back-link:hover {
    background-color: var(--cpm-medium-gray);
    color: #000;
}
.cpm-notice { padding: 15px; margin-bottom: 20px; border-radius: 8px; border-width: 1px; border-style: solid; }
.cpm-success { background-color: var(--cpm-success-bg); color: var(--cpm-success-text); border-color: #c3e6cb; }
.cpm-error { background-color: var(--cpm-error-bg); color: var(--cpm-error-text); border-color: #f5c6cb; }
#cpm-form-notice { margin-bottom: 20px; }


/* --- Grid de Produtos --- */
.cpm-product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 25px; }
.cpm-product-list-item { background-color: #fff; border: 1px solid var(--cpm-medium-gray); border-radius: var(--cpm-border-radius); text-align: center; padding: 20px; text-decoration: none; color: var(--cpm-text-color); box-shadow: var(--cpm-shadow); transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out; }
.cpm-product-list-item:hover { transform: translateY(-5px); box-shadow: var(--cpm-shadow-hover); }
.cpm-product-list-item img { max-width: 100%; height: 150px; object-fit: contain; border-radius: 8px; margin-bottom: 15px; }
.cpm-product-list-item h3 { font-size: 1.1em; margin: 0; justify-content: center; }
.cpm-placeholder-image { width: 100%; height: 150px; background-color: var(--cpm-light-gray); display: flex; align-items: center; justify-content: center; border-radius: 8px; margin-bottom: 15px; font-size: 50px; color: var(--cpm-medium-gray); }


/* --- Cards de Peças --- */
.cpm-pecas-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 15px; margin-bottom: 30px; }
.cpm-card { border: 2px solid var(--cpm-medium-gray); border-radius: var(--cpm-border-radius); cursor: pointer; transition: all 0.2s ease; position: relative; background-color: #fff; }
.cpm-card:hover { transform: translateY(-3px); box-shadow: var(--cpm-shadow); }
.cpm-card label { display: flex; flex-direction: column; padding: 15px; align-items: center; text-align: center; width: 100%; height: 100%; box-sizing: border-box; }
.cpm-card img { max-width: 100%; height: 90px; object-fit: contain; margin-bottom: 10px; }
.cpm-placeholder-image-small { width: 100%; height: 90px; display: flex; align-items: center; justify-content: center; font-size: 40px; color: var(--cpm-medium-gray); }
.cpm-card-title { font-weight: bold; font-size: 14px; flex-grow: 1; }
.cpm-card input[type="checkbox"] { display: none; }
.cpm-card.selected { border-color: var(--cpm-primary-color); box-shadow: 0 0 10px var(--cpm-primary-color); }
.cpm-checkmark { display: none; position: absolute; top: 10px; right: 10px; width: 28px; height: 28px; background-color: var(--cpm-primary-color); color: white; border-radius: 50%; font-size: 14px; align-items: center; justify-content: center; }
.cpm-card.selected .cpm-checkmark, .cpm-card input[type="checkbox"]:checked ~ .cpm-checkmark { display: flex; }

/* --- Formulário --- */
.cpm-form-fields { padding-left: 30px; }
.cpm-form-fields p { margin-bottom: 15px; }
.cpm-form-fields label { display: block; margin-bottom: 5px; font-weight: bold; font-size: 0.9em; }
.cpm-form-fields input[type="text"], .cpm-form-fields input[type="email"], .cpm-form-fields input[type="tel"] { width: 100%; padding: 12px; border: 1px solid var(--cpm-medium-gray); border-radius: 8px; box-sizing: border-box; transition: border-color 0.2s, box-shadow 0.2s; }
.cpm-form-fields input:focus { outline: none; border-color: var(--cpm-primary-color); box-shadow: 0 0 5px var(--cpm-primary-color); }
.cpm-form-fields button { display: inline-flex; align-items: center; gap: 10px; padding: 12px 25px; background-color: var(--cpm-primary-color); color: white; border: none; border-radius: 8px; cursor: pointer; font-size: 16px; font-weight: bold; transition: background-color 0.2s; }
.cpm-form-fields button:hover { background-color: var(--cpm-primary-hover); }
.cpm-form-fields button:disabled { background-color: var(--cpm-medium-gray); cursor: not-allowed; }

/* --- Seções Adicionais (Manuais, Vídeo) --- */
.cpm-video-section { margin-top: 40px; padding-top: 20px; border-top: 1px solid var(--cpm-light-gray); }

/* **NOVO CONTAINER PARA MANUAIS** */
.cpm-manuais-section {
    margin-top: 40px;
    padding: 25px;
    background-color: var(--cpm-light-gray);
    border-radius: var(--cpm-border-radius);
    border: 1px solid var(--cpm-medium-gray);
}
.cpm-manuais-section h3 {
    margin-top: 0;
}
.cpm-manuais-list {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
}
.cpm-manual-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background-color: #fff;
    color: var(--cpm-dark-gray);
    padding: 10px 15px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: bold;
    transition: all 0.2s ease;
    border: 1px solid var(--cpm-medium-gray);
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}
.cpm-manual-button:hover {
    background-color: #fff;
    color: var(--cpm-primary-color);
    border-color: var(--cpm-primary-color);
    transform: translateY(-2px);
    box-shadow: var(--cpm-shadow);
}

.cpm-video-wrapper { position: relative; padding-bottom: 56.25%; height: 0; border-radius: var(--cpm-border-radius); overflow: hidden; }
.cpm-video-wrapper iframe { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }

/* --- Loader AJAX --- */
.cpm-loader { text-align: center; padding: 50px 20px; font-size: 1.2em; color: var(--cpm-dark-gray); font-weight: bold; }