/**
 * Estilos para Editor de Cards (Admin)
 * e Renderização de Cards (Frontend)
 *
 * @package RGMais_Flowgen
 */

/* ============================================
   ADMIN — Editor de Cards
   ============================================ */

.flowgen-card-editor,
.flowgen-card-editor-field {
	border: 1px solid #ddd;
	border-radius: 4px;
	padding: 1rem;
	margin-bottom: 1rem;
	background: #fff;
}

.flowgen-card-editor-field {
	border-left: 4px solid #0073aa;
}

/* Ícone no admin */
.flowgen-card-icon-select {
	padding: 0.5rem;
	border: 1px solid #ddd;
	border-radius: 3px;
	font-size: 0.9rem;
}

.flowgen-card-icon-preview {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 50px;
	height: 50px;
	border: 1px solid #ddd;
	border-radius: 3px;
	background: #fafafa;
	font-size: 1.5rem;
	line-height: 1;
	overflow: visible;
}

.flowgen-card-editor-field input[type="text"],
.flowgen-card-editor-field textarea {
	width: 100%;
	padding: 0.5rem;
	border: 1px solid #ddd;
	border-radius: 3px;
	font-size: 0.9rem;
	font-family: inherit;
}

.flowgen-card-editor-field textarea {
	font-family: 'Courier New', monospace;
	font-size: 0.85rem;
	min-height: 100px;
	resize: vertical;
}

.flowgen-card-remove {
	color: #dc3545 !important;
	text-decoration: none !important;
	cursor: pointer;
}

.flowgen-card-remove:hover {
	color: #c82333 !important;
}

.flowgen-card-accordion {
	padding: 0;
	overflow: hidden;
}

.flowgen-card-accordion > summary {
	list-style: none;
}

.flowgen-card-accordion > summary::-webkit-details-marker {
	display: none;
}

.flowgen-card-summary {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	padding: 0.8rem 1rem;
	background: #f6f7f7;
	border-bottom: 1px solid #ddd;
	cursor: pointer;
}

.flowgen-card-summary::after {
	content: '▾';
	margin-left: auto;
	color: #787c82;
	font-size: 12px;
}

.flowgen-card-accordion:not([open]) .flowgen-card-summary::after {
	content: '▸';
}

.flowgen-card-summary-title {
	font-weight: 600;
	color: #1d2327;
	flex: 1;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.flowgen-card-drag-handle {
	cursor: move;
	color: #787c82;
	flex-shrink: 0;
}

.flowgen-card-drag-handle:hover {
	color: #1d2327;
}

.flowgen-card-body {
	padding: 1rem;
	background: #fff;
}

.flowgen-card-actions {
	display: flex;
	justify-content: flex-end;
	margin-bottom: 0.75rem;
}

.flowgen-card-placeholder {
	min-height: 56px;
	border: 1px dashed #2271b1;
	border-radius: 4px;
	background: #f0f6fc;
	margin-bottom: 1rem;
}

/* ============================================
   FRONTEND — Card Grid
   ============================================ */

.flowgen-cards-section {
	margin: 2rem 0;
}

.flowgen-cards-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
	gap: 1.5rem;
	margin: 2rem 0;
}

/* Card individual */
.flowgen-card {
	display: flex;
	flex-direction: column;
	padding: 1.5rem;
	border: 1px solid #e0e0e0;
	border-radius: 6px;
	background: #fff;
	transition: box-shadow 0.3s ease, border-color 0.3s ease;
}

.flowgen-card:hover {
	border-color: var(--color-primary, #FF7A00);
	box-shadow: 0 4px 12px rgba(255, 122, 0, 0.1);
}

/* Ícone do card */
.flowgen-card-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 48px;
	height: 48px;
	margin-bottom: 1rem;
	border-radius: 50%;
	background: var(--color-primary, #FF7A00);
	color: #fff;
	font-size: 1.5rem;
	line-height: 1;
	overflow: visible;
	flex-shrink: 0;
}

.flowgen-card-icon i {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	height: 100%;
	line-height: 1;
	overflow: visible;
}

/* Conteúdo do card */
.flowgen-card-content {
	display: flex;
	flex-direction: column;
	flex-grow: 1;
}

.flowgen-card-title {
	margin: 0 0 0.75rem 0;
	font-size: 1.1rem;
	font-weight: 600;
	line-height: 1.3;
	color: var(--color-heading, #0D0D0D);
}

.flowgen-card-description {
	margin: 0 0 1rem 0;
	font-size: 0.95rem;
	line-height: 1.5;
	color: var(--color-text, #2B2B2B);
	flex-grow: 1;
}

.flowgen-card-description p {
	margin: 0;
	padding: 0;
}

.flowgen-card-description strong {
	font-weight: 600;
	color: var(--color-heading, #0D0D0D);
}

.flowgen-card-description em {
	font-style: italic;
}

.flowgen-card-description a {
	color: var(--color-link, #FF7A00);
	text-decoration: none;
	transition: color 0.2s ease;
}

.flowgen-card-description a:hover {
	color: var(--color-link-hover, #E06900);
	text-decoration: underline;
}

.flowgen-card-description br {
	display: block;
	content: '';
}

/* Bullets do card */
.flowgen-card-bullets {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
}

.flowgen-card-bullets li {
	display: flex;
	align-items: flex-start;
	margin: 0;
	padding: 0;
	padding-left: 1.5rem;
	position: relative;
	font-size: 0.95rem;
	line-height: 1.4;
	color: var(--color-text, #2B2B2B);
}

.flowgen-card-bullets li::before {
	content: '✓';
	position: absolute;
	left: 0;
	top: 0;
	color: var(--color-primary, #FF7A00);
	font-weight: bold;
	width: 1rem;
	display: flex;
	align-items: center;
	justify-content: center;
}

/* Variações de layout */
.flowgen-cards-grid.cards-2-col {
	grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
}

.flowgen-cards-grid.cards-4-col {
	grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

/* Responsivo */
@media (max-width: 768px) {
	.flowgen-cards-grid {
		grid-template-columns: 1fr;
	}

	.flowgen-card-icon {
		width: 40px;
		height: 40px;
		font-size: 1.2rem;
	}
}

/* Compatibilidade com Phosphor Icons */
i[class*="ph-"] {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	line-height: 1;
	font-style: normal;
	overflow: visible;
}

/* ============================================
   ADMIN — Meta box Sistema (accordion + campos)
   ============================================ */

.flowgen-meta-field {
	margin-bottom: 1rem;
}

.flowgen-meta-field > label {
	display: block;
	margin-bottom: 0.5rem;
	font-weight: 600;
}

.flowgen-meta-field input[type="text"] {
	width: 100%;
	padding: 0.5rem;
	border: 1px solid #ccc;
	border-radius: 3px;
}

.flowgen-meta-field textarea {
	width: 100%;
	padding: 0.5rem;
	border: 1px solid #ccc;
	border-radius: 3px;
	font-family: inherit;
	font-size: 14px;
}

.flowgen-meta-field--wp .flowgen-custom-wpeditor-wrap {
	margin-top: 0.25rem;
}

.flowgen-meta-field--wp .mce-tinymce {
	border-radius: 2px;
}

.flowgen-section .flowgen-custom-wpeditor-wrap .wp-editor-container {
	margin-bottom: 0.35rem;
}

.flowgen-meta-hint {
	font-size: 0.85em;
	color: #666;
	margin-top: 0.25rem;
}

.flowgen-meta-row {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 1rem;
}

@media (max-width: 782px) {
	.flowgen-meta-row {
		grid-template-columns: 1fr;
	}
}

.flowgen-section {
	margin-bottom: 0.65rem;
	border: 1px solid #c3c4c7;
	border-radius: 4px;
	background: #fff;
	box-shadow: 0 1px 1px rgba(0, 0, 0, 0.04);
}

.flowgen-section > .flowgen-section-toggle {
	list-style: none;
	cursor: pointer;
	padding: 0.65rem 1rem;
	margin: 0;
	display: flex;
	align-items: center;
	font-size: 14px;
	font-weight: 600;
	color: #1d2327;
	user-select: none;
}

.flowgen-section > .flowgen-section-toggle::-webkit-details-marker {
	display: none;
}

.flowgen-section > .flowgen-section-toggle::marker {
	content: '';
}

.flowgen-section .flowgen-section-summary-inner {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	flex: 1;
}

.flowgen-section .flowgen-section-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	color: var(--wp-admin-theme-color, #2271b1);
	font-size: 1.25rem;
	line-height: 1;
}

.flowgen-section .flowgen-section-title {
	flex: 1;
}

/* Reordenação de secções (arrastar) no metabox Sistema / Segmento */
.flowgen-section > .flowgen-section-toggle {
	display: flex;
	align-items: center;
	gap: 0.25rem;
	flex-wrap: wrap;
}

.flowgen-section-order-handle {
	cursor: move;
	color: #787c82;
	flex-shrink: 0;
}

.flowgen-section-order-handle:hover {
	color: #1d2327;
}

.flowgen-sections-sortable .ui-sortable-placeholder {
	visibility: visible !important;
	background: #f0f6fc;
	border: 1px dashed #2271b1;
	min-height: 2.5rem;
	border-radius: 2px;
}

.flowgen-section--custom .flowgen-section-summary-inner {
	width: 100%;
	box-sizing: border-box;
}

.flowgen-section .flowgen-section-body {
	padding: 1rem 1rem 1.1rem;
	border-top: 1px solid #dcdcde;
	background: #f6f7f7;
}

.flowgen-section[open] > .flowgen-section-toggle {
	border-bottom: 1px solid #dcdcde;
	background: #f0f0f1;
}
