/**
 * ===================================
 * GRIGLIA PERSONAGGI
 * ===================================
 */

/* Griglia card personaggi */
.aac-characters-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
	gap: 24px;
	margin: 30px 0;
	font-family: 'Inter', sans-serif;
}

/* Singola card personaggio */
.aac-character-card {
	background: linear-gradient(145deg, #1a1a2e, #16213e);
	border: 1px solid rgba(255,255,255,0.08);
	border-radius: 16px;
	overflow: hidden;
	transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
	cursor: pointer;
}

.aac-character-card:hover {
	transform: translateY(-6px);
	box-shadow: 0 20px 50px rgba(233,69,96,0.2);
	border-color: rgba(233,69,96,0.4);
}

.aac-card-photo {
	width: 100%;
	height: 180px;
	object-fit: cover;
	object-position: top;
	display: block;
	transition: transform 0.4s ease;
}

.aac-character-card:hover .aac-card-photo {
	transform: scale(1.04);
}

.aac-card-photo-wrap {
	overflow: hidden;
	position: relative;
}

/* Badge "AI" in alto a destra sulla foto */
.aac-card-ai-badge {
	position: absolute;
	top: 10px;
	right: 10px;
	background: rgba(0,0,0,0.7);
	color: #e94560;
	font-size: 10px;
	font-weight: 700;
	letter-spacing: 1px;
	padding: 4px 8px;
	border-radius: 20px;
	border: 1px solid rgba(233,69,96,0.4);
	backdrop-filter: blur(4px);
	font-family: 'Inter', sans-serif;
}

/* Disponibile H24 dot */
.aac-card-ai-badge::before {
	content: '';
	display: inline-block;
	width: 6px;
	height: 6px;
	background: #2ecc71;
	border-radius: 50%;
	margin-right: 5px;
	animation: aac-pulse 2s infinite;
}

@keyframes aac-pulse {
	0%, 100% { opacity: 1; }
	50% { opacity: 0.3; }
}

.aac-card-body {
	padding: 16px;
}

.aac-card-name {
	color: #fff;
	font-size: 17px;
	font-weight: 700;
	margin: 0 0 6px;
}

.aac-card-desc {
	color: #aaa;
	font-size: 13px;
	line-height: 1.55;
	margin: 0 0 14px;
	white-space: pre-line;
}

.aac-chat-trigger {
	display: block;
	width: 100%;
	background: linear-gradient(135deg, #e94560, #c0392b);
	color: #fff !important;
	border: none;
	border-radius: 10px;
	padding: 11px;
	font-size: 13px;
	font-weight: 700;
	text-align: center;
	cursor: pointer;
	transition: opacity 0.2s, transform 0.1s;
	letter-spacing: 0.3px;
	text-decoration: none !important;
}

.aac-chat-trigger:hover {
	opacity: 0.88;
	transform: scale(1.01);
}

/**
 * ===================================
 * MODALE CHAT
 * ===================================
 */

/* Overlay scuro */
.aac-modal-overlay {
	display: none;
	position: fixed;
	inset: 0;
	background: rgba(0,0,0,0.85);
	z-index: 99998;
	backdrop-filter: blur(3px);
	animation: aac-overlay-in 0.2s ease;
}

@keyframes aac-overlay-in {
	from { opacity: 0; }
	to   { opacity: 1; }
}

.aac-modal-overlay.aac-open {
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 16px;
}

/* Contenitore modale */
.aac-modal {
	background: #1a1a2e;
	border-radius: 18px;
	width: 100%;
	max-width: 700px;
	max-height: 92vh;
	display: flex;
	flex-direction: column;
	overflow: hidden;
	box-shadow: 0 30px 80px rgba(0,0,0,0.7);
	border: 1px solid rgba(255,255,255,0.07);
	animation: aac-modal-in 0.28s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes aac-modal-in {
	from { opacity: 0; transform: scale(0.92) translateY(20px); }
	to   { opacity: 1; transform: scale(1) translateY(0); }
}

/* Barra superiore del modale con X di chiusura */
.aac-modal-topbar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 14px 16px;
	background: #13132a;
	border-bottom: 1px solid rgba(255,255,255,0.06);
	flex-shrink: 0;
}

.aac-modal-actions {
	display: flex;
	align-items: center;
	gap: 8px;
}

.aac-modal-topbar-title {
	color: #fff;
	font-size: 14px;
	font-weight: 600;
	font-family: 'Inter', sans-serif;
}

.aac-modal-close {
	background: rgba(255,255,255,0.08);
	border: none;
	color: #aaa;
	width: 30px;
	height: 30px;
	border-radius: 50%;
	font-size: 18px;
	line-height: 1;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background 0.2s, color 0.2s;
}

.aac-modal-close:hover {
	background: #e94560;
	color: #fff;
}

.aac-modal-fullscreen {
	background: rgba(255,255,255,0.08);
	border: none;
	color: #aaa;
	width: 30px;
	height: 30px;
	border-radius: 50%;
	font-size: 14px;
	line-height: 1;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background 0.2s, color 0.2s;
}

.aac-modal-fullscreen:hover {
	background: #2f80ed;
	color: #fff;
}

/* Il wrapper della chat all'interno del modale */
.aac-modal-body {
	flex: 1;
	overflow-y: auto;
	overflow-x: hidden;
}

/* Sovrascrive il margin auto del wrapper dentro al modale */
.aac-modal-body .aac-chat-wrapper {
	margin: 0;
	border-radius: 0;
	box-shadow: none;
	border: none;
	max-width: 100%;
}

.aac-modal.aac-fullscreen {
	max-width: 100vw;
	max-height: 100vh;
	height: 100vh;
	border-radius: 0;
}

/* Mobile */
@media (max-width: 600px) {
	.aac-modal {
		max-height: 100vh;
		border-radius: 0;
	}
	.aac-modal-overlay.aac-open {
		padding: 0;
		align-items: flex-end;
	}
}

/**
 * ===================================
 * CHAT WINDOW (stili condivisi)
 * ===================================
 */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

.aac-chat-wrapper {
	font-family: 'Inter', sans-serif;
	max-width: 680px;
	margin: 30px auto;
	background: #1a1a2e;
	border-radius: 16px;
	overflow: hidden;
	box-shadow: 0 20px 60px rgba(0,0,0,0.5);
	border: 1px solid rgba(255,255,255,0.07);
}

.aac-header {
	display: flex;
	align-items: center;
	gap: 14px;
	padding: 18px 20px;
	background: linear-gradient(135deg, #16213e, #0f3460);
	border-bottom: 1px solid rgba(255,255,255,0.08);
}

.aac-avatar {
	width: 52px;
	height: 52px;
	border-radius: 50%;
	object-fit: cover;
	border: 2px solid #e94560;
}

.aac-header-info h3 {
	margin: 0 0 4px;
	color: #fff;
	font-size: 16px;
	font-weight: 600;
}

.aac-badge {
	font-size: 11px;
	color: #e94560;
	background: rgba(233,69,96,0.12);
	border: 1px solid rgba(233,69,96,0.3);
	border-radius: 20px;
	padding: 2px 10px;
}

.aac-package-counter {
	margin-left: auto;
	text-align: right;
	color: #aaa;
	font-size: 12px;
	line-height: 1.6;
}

/* Acquisto pacchetti */
.aac-purchase-screen {
	padding: 30px 24px;
	text-align: center;
}

.aac-purchase-intro {
	color: #fff;
	font-size: 16px;
	margin-bottom: 6px;
}

.aac-packages-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
	gap: 14px;
	margin-top: 16px;
}

.aac-package-card {
	background: rgba(255,255,255,0.05);
	border: 1px solid rgba(255,255,255,0.1);
	border-radius: 12px;
	padding: 20px 14px;
	transition: all 0.2s ease;
}

.aac-package-card:hover:not(.aac-disabled) {
	border-color: #e94560;
	background: rgba(233,69,96,0.08);
	transform: translateY(-2px);
}

.aac-package-card.aac-disabled { opacity: 0.4; }

.aac-package-name {
	color: #fff;
	font-weight: 600;
	font-size: 14px;
	margin-bottom: 6px;
}

.aac-package-price {
	color: #e94560;
	font-size: 22px;
	font-weight: 700;
	margin-bottom: 4px;
}

.aac-package-desc {
	color: #aaa;
	font-size: 12px;
	margin-bottom: 14px;
}

.aac-buy-btn {
	background: linear-gradient(135deg, #e94560, #c0392b);
	color: #fff;
	border: none;
	border-radius: 8px;
	padding: 9px 18px;
	font-size: 13px;
	font-weight: 600;
	cursor: pointer;
	width: 100%;
	transition: opacity 0.2s;
}

.aac-buy-btn:hover { opacity: 0.88; }
.aac-no-credits { color: #666; font-size: 12px; }

/* Finestra messaggi */
.aac-messages {
	height: 420px;
	overflow-y: auto;
	padding: 20px;
	display: flex;
	flex-direction: column;
	gap: 12px;
	background: #0d0d1a;
	scroll-behavior: smooth;
}

.aac-messages::-webkit-scrollbar { width: 4px; }
.aac-messages::-webkit-scrollbar-track { background: transparent; }
.aac-messages::-webkit-scrollbar-thumb { background: #333; border-radius: 4px; }

.aac-message {
	max-width: 78%;
	padding: 10px 14px;
	border-radius: 14px;
	font-size: 14px;
	line-height: 1.55;
	word-break: break-word;
	animation: aac-fadein 0.25s ease;
}

@keyframes aac-fadein {
	from { opacity: 0; transform: translateY(6px); }
	to   { opacity: 1; transform: translateY(0); }
}

.aac-msg-user {
	align-self: flex-end;
	background: linear-gradient(135deg, #e94560, #c0392b);
	color: #fff;
	border-bottom-right-radius: 4px;
}

.aac-msg-bot {
	align-self: flex-start;
	background: rgba(255,255,255,0.07);
	color: #e0e0e0;
	border-bottom-left-radius: 4px;
}

.aac-photo-bubble { margin-top: 8px; }

.aac-photo-bubble img {
	max-width: 240px;
	border-radius: 10px;
	border: 2px solid rgba(233,69,96,0.4);
	display: block;
	cursor: pointer;
	transition: transform 0.2s;
}

.aac-photo-bubble img:hover { transform: scale(1.02); }
.aac-no-photo { color: #888; font-style: italic; font-size: 13px; }

/* Typing indicator */
.aac-typing {
	display: flex;
	gap: 4px;
	padding: 10px 14px;
	align-self: flex-start;
}

.aac-typing span {
	width: 7px;
	height: 7px;
	background: #e94560;
	border-radius: 50%;
	animation: aac-bounce 1.2s infinite;
}
.aac-typing span:nth-child(2) { animation-delay: 0.2s; }
.aac-typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes aac-bounce {
	0%, 60%, 100% { transform: translateY(0); }
	30% { transform: translateY(-6px); }
}

/* Area input */
.aac-input-area {
	display: flex;
	gap: 10px;
	padding: 14px 16px;
	background: #13132a;
	border-top: 1px solid rgba(255,255,255,0.06);
}

.aac-clear-chat-btn {
	background: rgba(255,255,255,0.08);
	color: #ddd;
	border: 1px solid rgba(255,255,255,0.18);
	border-radius: 10px;
	padding: 0 12px;
	font-size: 12px;
	cursor: pointer;
	flex-shrink: 0;
}

.aac-clear-chat-btn:hover {
	background: rgba(233,69,96,0.18);
	border-color: rgba(233,69,96,0.45);
	color: #fff;
}

.aac-clear-chat-btn:disabled {
	opacity: 0.5;
	cursor: not-allowed;
}

.aac-input-area textarea {
	flex: 1;
	background: rgba(255,255,255,0.06);
	border: 1px solid rgba(255,255,255,0.1);
	border-radius: 10px;
	color: #fff;
	padding: 10px 14px;
	font-size: 14px;
	font-family: 'Inter', sans-serif;
	resize: none;
	outline: none;
	transition: border-color 0.2s;
}

.aac-input-area textarea:focus { border-color: #e94560; }
.aac-input-area textarea::placeholder { color: #555; }

.aac-send-btn {
	background: linear-gradient(135deg, #e94560, #c0392b);
	border: none;
	border-radius: 10px;
	width: 44px;
	height: 44px;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	color: #fff;
	flex-shrink: 0;
	transition: opacity 0.2s, transform 0.1s;
}

.aac-send-btn:hover { opacity: 0.88; }
.aac-send-btn:active { transform: scale(0.95); }
.aac-send-btn:disabled { opacity: 0.4; cursor: not-allowed; }

.aac-notice {
	background: rgba(255,255,255,0.05);
	color: #aaa;
	padding: 20px;
	border-radius: 10px;
	text-align: center;
	font-family: 'Inter', sans-serif;
}

@media (max-width: 600px) {
	.aac-chat-wrapper { margin: 10px; border-radius: 12px; }
	.aac-messages { height: 340px; }
	.aac-packages-grid { grid-template-columns: 1fr; }
	.aac-characters-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
}

