/**
 * Frontend App CSS — Shortcode [lsikc_app]
 * Gaya untuk antarmuka tool clustering yang diakses user di halaman publik.
 *
 * @package LSI_Keyword_Clustering
 * @since   2.0.0
 */

/* ============================================================
   RESET & BASE
   ============================================================ */
.lsikc-app-wrapper *,
.lsikc-app-wrapper *::before,
.lsikc-app-wrapper *::after {
	box-sizing: border-box;
}

.lsikc-app-wrapper {
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
	color: #1e293b;
	line-height: 1.6;
	max-width: 1100px;
	margin: 0 auto;
}

/* ============================================================
   APP HEADER
   ============================================================ */
.lsikc-app-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	background: linear-gradient(135deg, #1e1b4b 0%, #3730a3 55%, #6366f1 100%);
	border-radius: 16px 16px 0 0;
	padding: 22px 26px;
	color: #fff;
	gap: 16px;
	flex-wrap: wrap;
}

.lsikc-app-header-left {
	display: flex;
	align-items: center;
	gap: 14px;
}

.lsikc-app-logo {
	width: 46px;
	height: 46px;
	background: rgba(255,255,255,0.15);
	border-radius: 12px;
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
}

.lsikc-app-logo svg {
	width: 26px;
	height: 26px;
	color: #fff;
}

.lsikc-app-title {
	font-size: 1.25rem;
	font-weight: 700;
	color: #fff;
	margin: 0 0 3px;
	padding: 0;
}

.lsikc-app-subtitle {
	font-size: 0.85rem;
	color: rgba(255,255,255,0.8);
	margin: 0;
	padding: 0;
}

.lsikc-app-subtitle a.lsikc-inline-link {
	color: #a5b4fc;
	text-decoration: underline;
}

.lsikc-app-header-right {
	display: flex;
	gap: 8px;
}

/* Tab Triggers */
.lsikc-tab-trigger {
	display: flex;
	align-items: center;
	gap: 6px;
	padding: 8px 16px;
	background: rgba(255,255,255,0.1);
	border: 1.5px solid rgba(255,255,255,0.2);
	border-radius: 8px;
	color: rgba(255,255,255,0.75);
	font-size: 0.85rem;
	font-weight: 600;
	cursor: pointer;
	transition: all 0.15s;
}

.lsikc-tab-trigger svg {
	width: 16px;
	height: 16px;
}

.lsikc-tab-trigger:hover {
	background: rgba(255,255,255,0.18);
	color: #fff;
}

.lsikc-tab-trigger.lsikc-tab-active {
	background: #fff;
	border-color: #fff;
	color: #4f46e5;
}

/* ============================================================
   GUEST BANNER
   ============================================================ */
.lsikc-guest-banner {
	display: flex;
	align-items: center;
	gap: 14px;
	background: linear-gradient(135deg, #fef3c7, #fffbeb);
	border: 1.5px solid #fcd34d;
	border-radius: 10px;
	padding: 14px 18px;
	margin: 18px 18px 0;
	flex-wrap: wrap;
}

.lsikc-guest-banner-icon {
	font-size: 1.8rem;
	flex-shrink: 0;
}

.lsikc-guest-banner-text {
	flex: 1;
}

.lsikc-guest-banner-text strong {
	display: block;
	color: #92400e;
	font-size: 0.9rem;
	margin-bottom: 2px;
}

.lsikc-guest-banner-text p {
	margin: 0;
	font-size: 0.82rem;
	color: #78350f;
}

.lsikc-guest-banner-actions {
	display: flex;
	gap: 8px;
	flex-shrink: 0;
}

/* ============================================================
   MAIN LAYOUT
   ============================================================ */
.lsikc-tab-panel {
	background: #f8fafc;
	border: 1px solid #e2e8f0;
	border-top: none;
	border-radius: 0 0 16px 16px;
	padding: 20px;
}

.lsikc-app-layout {
	display: grid;
	grid-template-columns: 360px 1fr;
	gap: 18px;
}

@media (max-width: 800px) {
	.lsikc-app-layout {
		grid-template-columns: 1fr;
	}
}

/* ============================================================
   PANEL CARDS
   ============================================================ */
.lsikc-app-panel {
	background: #fff;
	border: 1.5px solid #e2e8f0;
	border-radius: 12px;
	overflow: hidden;
	display: flex;
	flex-direction: column;
}

.lsikc-panel-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 14px 18px;
	border-bottom: 1px solid #f1f5f9;
	background: #f8fafc;
	gap: 10px;
	flex-wrap: wrap;
}

.lsikc-panel-head h3 {
	margin: 0;
	padding: 0;
	font-size: 0.95rem;
	font-weight: 700;
	color: #1e293b;
}

.lsikc-kw-counter {
	font-size: 0.8rem;
	font-weight: 600;
	color: #6366f1;
	background: #ede9fe;
	padding: 3px 10px;
	border-radius: 20px;
}

.lsikc-results-meta {
	display: flex;
	align-items: center;
	gap: 10px;
}

#lsikc-app-summary {
	font-size: 0.8rem;
	color: #64748b;
}

/* ============================================================
   FORM ELEMENTS
   ============================================================ */
.lsikc-session-row {
	padding: 12px 16px 0;
}

.lsikc-input {
	width: 100%;
	border: 1.5px solid #d1d5db;
	border-radius: 8px;
	padding: 9px 12px;
	font-size: 0.88rem;
	font-family: inherit;
	color: #1e293b;
	background: #fff;
	transition: border-color 0.15s, box-shadow 0.15s;
}

.lsikc-input:focus {
	outline: none;
	border-color: #6366f1;
	box-shadow: 0 0 0 3px rgba(99,102,241,0.15);
}

.lsikc-app-textarea {
	display: block;
	width: 100%;
	border: none;
	border-top: 1.5px solid #f1f5f9;
	padding: 14px 16px;
	font-size: 0.85rem;
	font-family: 'Cascadia Code', 'Fira Code', 'Courier New', monospace;
	line-height: 1.7;
	color: #1e293b;
	resize: vertical;
	min-height: 240px;
	flex: 1;
	transition: border-color 0.15s;
}

.lsikc-app-textarea:focus {
	outline: none;
	border-color: #6366f1;
}

.lsikc-input-actions {
	padding: 14px 16px;
	display: flex;
	gap: 8px;
	border-top: 1px solid #f1f5f9;
}

/* ============================================================
   BUTTONS
   ============================================================ */
.lsikc-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	padding: 9px 18px;
	border-radius: 8px;
	font-size: 0.875rem;
	font-weight: 600;
	cursor: pointer;
	border: 1.5px solid transparent;
	transition: all 0.15s;
	text-decoration: none;
	font-family: inherit;
	line-height: 1.4;
}

.lsikc-btn svg {
	width: 16px;
	height: 16px;
	flex-shrink: 0;
}

.lsikc-btn-primary {
	background: linear-gradient(135deg, #6366f1, #4f46e5);
	color: #fff;
	border-color: #4f46e5;
}

.lsikc-btn-primary:hover:not(:disabled) {
	background: linear-gradient(135deg, #818cf8, #6366f1);
	transform: translateY(-1px);
	box-shadow: 0 4px 12px rgba(99,102,241,0.35);
}

.lsikc-btn-primary:disabled {
	opacity: 0.6;
	cursor: not-allowed;
	transform: none;
}

.lsikc-btn-success {
	background: #10b981;
	color: #fff;
	border-color: #059669;
}

.lsikc-btn-success:hover:not(:disabled) {
	background: #059669;
}

.lsikc-btn-outline {
	background: #fff;
	color: #6366f1;
	border-color: #c7d2fe;
}

.lsikc-btn-outline:hover {
	background: #f5f3ff;
	border-color: #6366f1;
}

.lsikc-btn-ghost {
	background: transparent;
	color: #64748b;
	border-color: #e2e8f0;
}

.lsikc-btn-ghost:hover {
	background: #f8fafc;
}

.lsikc-btn-danger {
	background: transparent;
	color: #ef4444;
	border-color: #fecaca;
}

.lsikc-btn-danger:hover {
	background: #fef2f2;
}

.lsikc-btn-full { width: 100%; }

.lsikc-btn-sm {
	padding: 6px 12px;
	font-size: 0.8rem;
}

.lsikc-btn-icon {
	transition: transform 0.3s;
}

.lsikc-btn-loading .lsikc-btn-icon {
	animation: lsikc-spin 0.8s linear infinite;
}

@keyframes lsikc-spin {
	to { transform: rotate(360deg); }
}

/* ============================================================
   UPGRADE PROMPT
   ============================================================ */
.lsikc-upgrade-prompt {
	padding: 10px 16px;
	background: #f5f3ff;
	border-top: 1px solid #ede9fe;
}

.lsikc-upgrade-prompt p {
	margin: 0;
	font-size: 0.8rem;
	color: #5b21b6;
}

.lsikc-inline-link {
	color: #6366f1;
	text-decoration: underline;
	font-weight: 600;
}

/* ============================================================
   STATE DISPLAYS
   ============================================================ */
.lsikc-app-state {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	padding: 50px 24px;
	text-align: center;
	color: #94a3b8;
	gap: 12px;
}

.lsikc-state-icon {
	font-size: 2.5rem;
	line-height: 1;
}

.lsikc-app-state p {
	margin: 0;
	font-size: 0.9rem;
	max-width: 280px;
}

.lsikc-state-error {
	color: #b91c1c;
	background: #fef2f2;
	border-radius: 8px;
	margin: 16px;
}

/* Loading Spinner */
.lsikc-loading-spinner {
	width: 40px;
	height: 40px;
	border: 3px solid #e2e8f0;
	border-top-color: #6366f1;
	border-radius: 50%;
	animation: lsikc-spin 0.7s linear infinite;
}

/* ============================================================
   CLUSTER RESULT CARDS
   ============================================================ */
#lsikc-app-state-results,
#lsikc-history-grid {
	padding: 16px;
}

.lsikc-result-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
	gap: 12px;
}

.lsikc-result-card {
	background: #fff;
	border: 1.5px solid #e2e8f0;
	border-left: 4px solid var(--card-color, #6366f1);
	border-radius: 8px;
	padding: 12px;
	transition: box-shadow 0.15s, transform 0.15s;
}

.lsikc-result-card:hover {
	box-shadow: 0 4px 14px rgba(0,0,0,0.09);
	transform: translateY(-2px);
}

.lsikc-result-card-title {
	font-size: 0.82rem;
	font-weight: 700;
	color: #1e293b;
	margin: 0 0 8px;
	padding: 0;
	display: flex;
	align-items: center;
	gap: 6px;
}

.lsikc-result-card-title::before {
	content: '';
	display: inline-block;
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: var(--card-color, #6366f1);
	flex-shrink: 0;
}

.lsikc-result-tags {
	display: flex;
	flex-wrap: wrap;
	gap: 4px;
	list-style: none;
	margin: 0;
	padding: 0;
}

.lsikc-result-tag {
	background: #f1f5f9;
	color: #475569;
	font-size: 0.75rem;
	padding: 2px 8px;
	border-radius: 20px;
	border: 1px solid #e2e8f0;
}

.lsikc-result-card-footer {
	margin-top: 8px;
	font-size: 0.75rem;
	color: #94a3b8;
	text-align: right;
}

/* ============================================================
   LIMITED WARNING STRIP
   ============================================================ */
.lsikc-limited-strip {
	background: #fffbeb;
	border: 1px solid #fcd34d;
	border-radius: 8px;
	padding: 10px 14px;
	margin: 0 16px 12px;
	font-size: 0.82rem;
	color: #92400e;
	display: flex;
	align-items: center;
	gap: 8px;
}

/* ============================================================
   HISTORY TAB
   ============================================================ */
.lsikc-history-toolbar {
	display: flex;
	align-items: center;
	gap: 12px;
	margin-bottom: 16px;
	flex-wrap: wrap;
}

.lsikc-search-input {
	flex: 1;
	min-width: 180px;
}

.lsikc-history-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
	gap: 14px;
}

/* History Card */
.lsikc-history-card {
	background: #fff;
	border: 1.5px solid #e2e8f0;
	border-top: 4px solid var(--card-color, #6366f1);
	border-radius: 10px;
	overflow: hidden;
	transition: box-shadow 0.15s, transform 0.15s;
}

.lsikc-history-card:hover {
	box-shadow: 0 5px 16px rgba(0,0,0,0.09);
	transform: translateY(-2px);
}

.lsikc-history-card[data-hidden="true"] {
	display: none;
}

.lsikc-history-card-head {
	padding: 12px 14px 10px;
	border-bottom: 1px solid #f1f5f9;
}

.lsikc-history-card-name {
	font-size: 0.88rem;
	font-weight: 700;
	color: #1e293b;
	margin: 0 0 5px;
	padding: 0;
}

.lsikc-history-card-meta {
	display: flex;
	gap: 6px;
	align-items: center;
	flex-wrap: wrap;
}

.lsikc-chip {
	display: inline-flex;
	align-items: center;
	font-size: 0.75rem;
	font-weight: 600;
	padding: 2px 8px;
	border-radius: 20px;
}

.lsikc-chip-purple {
	background: #ede9fe;
	color: #7c3aed;
}

.lsikc-chip-blue {
	background: #eff6ff;
	color: #1d4ed8;
}

.lsikc-chip-gray {
	background: #f1f5f9;
	color: #475569;
}

.lsikc-history-card-body {
	padding: 12px 14px;
}

.lsikc-history-tags {
	display: flex;
	flex-wrap: wrap;
	gap: 5px;
}

.lsikc-history-card-footer {
	padding: 10px 14px;
	border-top: 1px solid #f1f5f9;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
}

.lsikc-sc-copy-row {
	display: flex;
	align-items: center;
	gap: 5px;
	flex: 1;
	min-width: 0;
}

.lsikc-sc-code {
	font-size: 0.75rem;
	background: #f8fafc;
	border: 1px solid #e2e8f0;
	border-radius: 4px;
	padding: 2px 7px;
	color: #7c3aed;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	cursor: pointer;
	flex: 1;
	min-width: 0;
}

.lsikc-icon-btn {
	background: none;
	border: none;
	cursor: pointer;
	color: #94a3b8;
	padding: 4px;
	border-radius: 4px;
	transition: color 0.15s, background 0.15s;
	flex-shrink: 0;
}

.lsikc-icon-btn:hover { color: #6366f1; background: #f5f3ff; }

.lsikc-icon-btn.lsikc-delete:hover { color: #ef4444; background: #fef2f2; }

.lsikc-icon-btn svg {
	width: 16px;
	height: 16px;
	display: block;
}

/* ============================================================
   NOTICE
   ============================================================ */
.lsikc-app-notice {
	position: fixed;
	bottom: 24px;
	left: 50%;
	transform: translateX(-50%);
	padding: 12px 22px;
	border-radius: 10px;
	font-size: 0.88rem;
	font-weight: 600;
	z-index: 99999;
	box-shadow: 0 6px 24px rgba(0,0,0,0.18);
	animation: lsikc-notice-in 0.25s ease;
	white-space: nowrap;
}

@keyframes lsikc-notice-in {
	from { opacity: 0; transform: translateX(-50%) translateY(12px); }
	to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.lsikc-app-notice.success {
	background: #10b981;
	color: #fff;
}

.lsikc-app-notice.error {
	background: #ef4444;
	color: #fff;
}

.lsikc-app-notice.info {
	background: #6366f1;
	color: #fff;
}

/* ============================================================
   COPY TIP
   ============================================================ */
.lsikc-copy-tip {
	position: fixed;
	bottom: 70px;
	left: 50%;
	transform: translateX(-50%);
	background: #1e293b;
	color: #fff;
	font-size: 0.8rem;
	padding: 6px 14px;
	border-radius: 6px;
	z-index: 99999;
	pointer-events: none;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 600px) {
	.lsikc-app-header {
		border-radius: 12px 12px 0 0;
		padding: 16px;
	}
	.lsikc-tab-panel {
		padding: 14px;
		border-radius: 0 0 12px 12px;
	}
	.lsikc-history-grid {
		grid-template-columns: 1fr;
	}
	.lsikc-result-grid {
		grid-template-columns: 1fr 1fr;
	}
	.lsikc-app-notice {
		white-space: normal;
		text-align: center;
		width: 90%;
	}
}

@media (max-width: 400px) {
	.lsikc-result-grid {
		grid-template-columns: 1fr;
	}
}

/* ============================================================
   ADMIN SETTINGS SHORTCODE BOX
   ============================================================ */
.lsikc-shortcode-copy-box {
	margin-top: 10px;
	background: #f5f3ff;
	border: 1px solid #ddd6fe;
	border-radius: 8px;
	padding: 10px 14px;
	font-size: 13px;
	color: #5b21b6;
}

.lsikc-shortcode-copy-box code {
	background: #ede9fe;
	padding: 2px 7px;
	border-radius: 4px;
	font-size: 12px;
}
