/* =========================================
   IP Checker Plugin – Frontend Styles v2.3
   JumpIt EDV Service Mallorca · jumpit.eu
   ========================================= */

/* CSS-Variablen – Standard = JumpIT-Farben.
   Werden per inline style auf .ip-checker-card
   per Instanz überschrieben. */
.ip-checker-card {
	--ipc-primary:   #e9993e;
	--ipc-secondary: #f4bf38;
	--ipc-ip-color:  #1d4ed8;
	--ipc-ip-bg:     #eff6ff;
	--ipc-border:    #e5e7eb;
	--ipc-text:      #111827;
}

/* ---- Card ---- */
.ip-checker-card {
	background: #ffffff;
	border: 1px solid var(--ipc-border);
	border-radius: 12px;
	max-width: 460px;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	box-shadow: 0 4px 24px rgba(0, 0, 0, 0.07);
	overflow: hidden;
	transition: box-shadow 0.2s ease;
	color: var(--ipc-text);
}

.ip-checker-card:hover {
	box-shadow: 0 6px 32px rgba(0, 0, 0, 0.12);
}

/* ---- Header ---- */
.ip-checker-header {
	display: flex;
	align-items: center;
	gap: 10px;
	background: linear-gradient(135deg, var(--ipc-primary) 0%, var(--ipc-secondary) 100%);
	color: #ffffff;
	padding: 16px 20px;
}

.ip-checker-icon {
	width: 20px;
	height: 20px;
	flex-shrink: 0;
	opacity: 0.9;
}

.ip-checker-title {
	font-size: 15px;
	font-weight: 600;
	letter-spacing: 0.01em;
}

/* ---- Body ---- */
.ip-checker-body {
	padding: 4px 0;
}

/* ---- Rows
   Label: feste Breite, läuft nie um.
   Rechte Spalte: flex:1 + min-width:0 = Umbruch
   nur wenn nötig, kein Overflow.
   ------------------------------------------------- */
.ip-checker-row {
	display: flex;
	align-items: flex-start;
	gap: 12px;
	padding: 11px 20px;
	border-bottom: 1px solid var(--ipc-border);
}

.ip-checker-row:last-child {
	border-bottom: none;
}

.ip-checker-label {
	flex: 0 0 82px;
	font-size: 13px;
	color: #6b7280;
	font-weight: 500;
	padding-top: 2px;
	white-space: nowrap;
}

/* Rechte Spalten-Elemente teilen sich den verbleibenden Platz */
.ip-checker-value,
.ip-checker-ip-block,
.ip-checker-provider-block,
.ip-checker-cgnat-block {
	flex: 1;
	min-width: 0;               /* lässt flex-children schrumpfen */
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	gap: 4px;
}

/* ---- IP-Adresse ---- */
.ip-checker-ip-block {
	gap: 3px;
}

.ip-checker-ip-line {
	display: flex;
	align-items: center;
	gap: 6px;
	flex-wrap: wrap;
	justify-content: flex-end;
}

.ip-checker-ip {
	font-family: "SF Mono", "Fira Code", "Fira Mono", "Roboto Mono", Consolas, monospace;
	font-size: 14px;
	color: var(--ipc-ip-color);
	background: var(--ipc-ip-bg);
	padding: 2px 8px;
	border-radius: 6px;
	letter-spacing: 0.02em;
	/* IPv6-Adressen (39 Zeichen) dürfen nach Doppelpunkten umbrechen */
	word-break: break-all;
	overflow-wrap: anywhere;
}

/* IPv6: etwas kleiner damit die Adresse auf eine Zeile passt */
.ip-checker-card--v6 .ip-checker-ip {
	font-size: 12px;
	letter-spacing: 0;
}

/* ---- Land ---- */
.ip-checker-value {
	flex-direction: row;
	flex-wrap: wrap;
	justify-content: flex-end;
	align-items: center;
	font-size: 14px;
	font-weight: 500;
	color: var(--ipc-text);
	word-break: break-word;
	overflow-wrap: anywhere;
}

.ip-checker-flag {
	font-size: 18px;
	line-height: 1;
	flex-shrink: 0;
}

/* ---- Provider + RIPE-Badge ---- */
.ip-checker-provider-block {
	align-items: flex-end;
	gap: 5px;
}

.ip-checker-provider {
	font-size: 13px;
	line-height: 1.45;
	color: var(--ipc-text);
	font-weight: 500;
	text-align: right;
	/* Lange Namen (z. B. "Deutsche Telekom AG / Siemens AG") umbrechen sauber */
	word-break: break-word;
	overflow-wrap: anywhere;
}

/* ---- Badges ---- */
.ip-checker-badge {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	font-size: 10px;
	font-weight: 700;
	border-radius: 20px;
	padding: 2px 8px;
	white-space: nowrap;
	flex-shrink: 0;
	letter-spacing: 0.03em;
	text-transform: uppercase;
}

.ip-checker-badge svg {
	width: 11px;
	height: 11px;
	flex-shrink: 0;
}

/* IPv4 – Blau */
.ip-checker-badge--ipv4 {
	background: #dbeafe;
	color: #1e40af;
	border: 1px solid #bfdbfe;
}

/* IPv6 – Lila */
.ip-checker-badge--ipv6 {
	background: #ede9fe;
	color: #5b21b6;
	border: 1px solid #ddd6fe;
}

/* CGNAT – Gelb-Orange */
.ip-checker-badge--cgnat {
	background: #fef3c7;
	color: #92400e;
	border: 1px solid #fcd34d;
	text-transform: none;
	font-size: 11px;
}

/* ---- Dual-Stack: zweite Protokoll-IP (von JS eingefügt) ---- */
.ip-checker-ip-line--alt {
	margin-top: 6px;
	padding-top: 6px;
	border-top: 1px dashed var(--ipc-border);
	flex-direction: column;
	align-items: flex-end;
	gap: 4px;
	width: 100%;
}

.ip-checker-ip-line--alt > .ip-checker-badge,
.ip-checker-ip-line--alt > .ip-checker-ip {
	align-self: flex-end;
}

.ip-checker-ip--alt {
	font-size: 12px;
	opacity: 0.92;
	letter-spacing: 0;
}

.ip-checker-alt-meta {
	font-size: 11px;
	color: #6b7280;
	font-weight: 400;
	text-align: right;
	line-height: 1.4;
	width: 100%;
	margin-top: 2px;
	display: flex;
	align-items: center;
	gap: 4px;
	justify-content: flex-end;
	flex-wrap: wrap;
}

.ip-checker-alt-flag {
	font-size: 14px;
}

.ip-checker-alt-cgnat {
	color: #92400e;
	font-weight: 600;
	background: #fef3c7;
	border-radius: 3px;
	padding: 0 5px;
}

/* ---- CGNAT-Zeile ---- */
.ip-checker-cgnat-row {
	background: #fffbeb;
	border-left: 3px solid #f59e0b;
}

.ip-checker-cgnat-block {
	align-items: flex-end;
}

.ip-checker-cgnat-hint {
	font-size: 11px;
	color: #78716c;
	font-weight: 400;
	line-height: 1.4;
	text-align: right;
	word-break: break-word;
	overflow-wrap: anywhere;
}

/* ---- Footer ---- */
.ip-checker-footer {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 10px 16px 12px;
	background: #f9fafb;
	border-top: 1px solid var(--ipc-border);
	gap: 8px;
	flex-wrap: wrap;
}

/* ---- Refresh-Button ---- */
.ip-checker-refresh-btn {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	background: none;
	border: 1px solid #d1d5db;
	border-radius: 6px;
	padding: 5px 11px;
	font-size: 12px;
	font-weight: 500;
	color: #374151;
	cursor: pointer;
	transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.ip-checker-refresh-btn svg {
	width: 13px;
	height: 13px;
	transition: transform 0.5s ease;
}

.ip-checker-refresh-btn:hover {
	background: #f3f4f6;
	border-color: #9ca3af;
	color: #111827;
}

.ip-checker-refresh-btn.loading svg {
	animation: ipc-spin 0.7s linear infinite;
}

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

/* ---- JumpIT Branding – immer sichtbar ---- */
.ip-checker-branding {
	display: inline-flex;
	align-items: center;
	gap: 5px;
	text-decoration: none;
	opacity: 0.75;
	transition: opacity 0.15s;
	flex-shrink: 0;
}

.ip-checker-branding:hover {
	opacity: 1;
}

.ip-checker-branding-text {
	font-size: 10px;
	color: #9ca3af;
	white-space: nowrap;
}

.ip-checker-logo {
	height: 18px;
	width: auto;
	display: block;
	max-width: 90px;
}

/* =========================================
   Dark Mode
   ========================================= */
@media (prefers-color-scheme: dark) {
	.ip-checker-card {
		background: #1f2937;
		--ipc-border: #374151;
		--ipc-text: #f3f4f6;
		box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
	}

	.ip-checker-label {
		color: #9ca3af;
	}

	.ip-checker-ip {
		background: #1e3a5f;
		color: #93c5fd;
	}

	.ip-checker-badge--ipv4 {
		background: #1e3a5f;
		color: #93c5fd;
		border-color: #1d4ed8;
	}

	.ip-checker-badge--ipv6 {
		background: #2e1065;
		color: #c4b5fd;
		border-color: #5b21b6;
	}

	.ip-checker-badge--cgnat {
		background: #292524;
		color: #fcd34d;
		border-color: #92400e;
	}

	.ip-checker-alt-meta {
		color: #9ca3af;
	}

	.ip-checker-alt-cgnat {
		background: #292524;
		color: #fcd34d;
	}

	.ip-checker-cgnat-row {
		background: #1c1917;
		border-left-color: #d97706;
	}

	.ip-checker-cgnat-hint {
		color: #a8a29e;
	}

	.ip-checker-footer {
		background: #111827;
	}

	.ip-checker-refresh-btn {
		border-color: #4b5563;
		color: #d1d5db;
	}

	.ip-checker-refresh-btn:hover {
		background: #374151;
		border-color: #6b7280;
		color: #f9fafb;
	}

	.ip-checker-branding-text {
		color: #6b7280;
	}

	.ip-checker-logo {
		filter: brightness(0) invert(1) opacity(0.5);
	}
}

/* =========================================
   Responsive ≤ 480 px
   Zeile wird vertikal (Label über Value).
   ========================================= */
@media (max-width: 480px) {
	.ip-checker-card {
		max-width: 100%;
	}

	.ip-checker-row {
		flex-direction: column;
		gap: 3px;
	}

	.ip-checker-label {
		flex: none;
		padding-top: 0;
	}

	.ip-checker-value,
	.ip-checker-ip-block,
	.ip-checker-provider-block,
	.ip-checker-cgnat-block {
		align-items: flex-start;
	}

	.ip-checker-ip-line {
		justify-content: flex-start;
	}

	.ip-checker-cgnat-hint,
	.ip-checker-provider {
		text-align: left;
	}

	.ip-checker-footer {
		flex-direction: column;
		align-items: flex-start;
	}
}
