
:root {
	--bg: #202124; /* requested background */
	--card: #1b1e24; /* gray card */
	--muted: #b6bfca;
	--text: #f1f5fb;
	--accent: #4f8cff; /* blue buttons */
	--accent-600: #3c73d6;
	--danger: #ff6b6b;
	--ok: #2bd67b;
	--neutral: #9aa3af;
	--border: #2a2e39;
	--content-max: 640px; /* keep drag/drop width aligned with chips below */
}

/* Light mode variables when body is NOT dark */
body:not(.dark) {
	--bg: #ffffff;
	--card: #ffffff;
	--muted: #5f6368;
	--text: #202124; /* higher contrast */
	--accent: #1a73e8;
	--accent-600: #1557b0;
	--danger: #d93025;
	--ok: #137333;
	--neutral: #5f6368;
	--border: #dfe1e5;
}

* { box-sizing: border-box; }

html, body {
	margin: 0;
	padding: 0;
	background: var(--bg);
	color: var(--text);
	font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Arial, "Apple Color Emoji", "Segoe UI Emoji";
	line-height: 1.5;
}

.container {
	max-width: 1100px;
	margin: 0 auto;
	padding: 16px;
}

/* Header */
.header {
	display: flex;
	justify-content: flex-end;
	padding: 20px;
	background: transparent;
}

.theme-toggle {
	background: transparent;
	border: 1px solid var(--border);
	border-radius: 50%;
	width: 40px;
	height: 40px;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 18px;
	transition: all 0.2s ease;
}

.theme-toggle:hover {
	background: var(--card);
	box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* Main content */
.main-content {
	flex: 1;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	padding: 20px;
	text-align: center;
	min-height: calc(100vh - 80px);
}

/* Logo section */
.logo-section {
	margin-bottom: 40px;
}

.logo-section h1 {
	font-size: 3.5rem;
	font-weight: 400;
	color: var(--text);
	margin-bottom: 10px;
	letter-spacing: -0.02em;
}

.logo-section p {
	font-size: 1.1rem;
	color: var(--muted);
	font-weight: 400;
}

/* Typewriter */
.typewriter { color: var(--muted); font-weight: 500; }

/* Typewriter caret */
.typewriter::after { content: '\2588'; margin-left: 4px; opacity: .7; animation: caretBlink 1s step-end infinite; }
@keyframes caretBlink { 50% { opacity: 0; } }

.input-card {
	background: transparent; /* center-focused */
	border: 0;
	border-radius: 12px;
	padding: 0;
	margin-top: 0;
}

.input-card.hero { text-align: center; padding: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }

/* Drag & Drop square */



.drop-square {
	margin: 0 auto 16px auto;
	width: min(var(--content-max), 100%);
	min-height: 180px;
	border: 2px dashed var(--border); /* segmented border to indicate drag/drop */
	border-radius: 16px;
	background: transparent; /* no blue background */
	display: flex;
	align-items: center;
	justify-content: center;
	flex-direction: column;
	color: var(--muted);
	box-shadow: 0 2px 5px 1px rgba(64,60,67,.16);
	cursor: pointer;
	transition: all 0.2s ease;
}
.drop-square .drop-icon { font-size: 40px; margin-bottom: 6px; }
.drop-square .drop-text { font-weight: 600; }
.drop-square:hover { 
	border-color: var(--accent); 
	color: var(--text);
	transform: translateY(-2px);
	box-shadow: 0 4px 10px rgba(0,0,0,.2);
}
.drop-square.dragover { outline: 0; box-shadow: 0 2px 8px 1px rgba(64,60,67,.24); border-color: var(--accent); animation: dashMove 1s linear infinite; }
@keyframes dashMove { 0% { border-style: dashed; border-width: 2px; } 50% { border-style: dashed; border-width: 3px; } 100% { border-style: dashed; border-width: 2px; } }



.button {
	appearance: none;
	border: 1px solid var(--border);
	background: #1a1d25;
	color: var(--text);
	border-radius: 8px;
	padding: 8px 12px;
	cursor: pointer;
	font-weight: 600;
}
.button.primary { background: var(--accent); border-color: var(--accent-600); }
.button.primary:hover { background: var(--accent-600); }
.button.secondary { background: #171a21; }
.button.ghost { background: transparent; }

#header-input {
	width: 100%;
	min-height: 220px;
	margin-top: 12px;
	background: #0f1117;
	color: var(--text);
	border: 1px dashed var(--border);
	border-radius: 8px;
	padding: 12px;
	font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

#drop-zone.dragover { outline: 2px dashed var(--accent); outline-offset: 6px; }

.results { margin-top: 20px; display: grid; gap: 16px; }
.summary { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 12px; }

.grid { display: grid; gap: 16px; grid-template-columns: 1fr; }

.table-wrap { overflow: auto; background: var(--card); border: 1px solid var(--border); border-radius: 12px; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 10px 12px; border-bottom: 1px solid var(--border); text-align: left; }
thead th { position: sticky; top: 0; background: #151820; z-index: 1; }
tbody tr:last-child td { border-bottom: 0; }

/* Avoid horizontal scroll: let table content wrap */
table { table-layout: fixed; }
th, td { word-break: break-word; overflow-wrap: anywhere; white-space: normal; }

tr.highlight { background: rgba(255, 107, 107, 0.08); }
td.delta-ok { color: var(--ok); }
td.delta-warn { color: var(--danger); }

/* Status badges for SPF/DKIM/DMARC */
.auth-status { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 12px; margin-bottom: 8px; }
.badges { display: flex; flex-wrap: wrap; gap: 8px; }
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 999px; border: 1px solid var(--border); background: #161920; color: var(--text); font-weight: 600; }
.badge.pass { border-color: rgba(43,214,123,.3); color: var(--ok); }
.badge.pass::before { content: '✓ '; }
.badge.fail { border-color: rgba(255,107,107,.3); color: var(--danger); }
.badge.fail::before { content: '✗ '; }
.badge.neutral { color: var(--neutral); }
.badge.neutral::before { content: '? '; }
.auth-details { margin-top: 8px; color: var(--muted); }
.auth-details ul { margin: 6px 0 0 18px; }

.help { color: var(--muted); margin-top: 10px; }
.help a { color: var(--accent); text-decoration: none; }
.help a:hover { text-decoration: underline; }

.site-footer { border-top: 1px solid var(--border); margin-top: 24px; }
.site-footer .container { display: flex; justify-content: space-between; align-items: center; }

/* Modal styles */
.modal { position: fixed; inset: 0; display: none; }
.modal.show { display: block; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.6); opacity: 0; transition: opacity .2s ease; }
.modal.show .modal-backdrop { opacity: 1; }
.modal-dialog { position: relative; margin: 40px auto; width: min(1100px, calc(100% - 24px)); height: calc(100% - 80px); background: var(--bg); border: 1px solid var(--border); border-radius: 16px; opacity: 0; display: flex; flex-direction: column; }
.modal.show .modal-dialog { animation: popIn .22s ease forwards; }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--border); flex: 0 0 auto; }
.modal-actions { display: flex; align-items: center; gap: 8px; }
.modal-body { padding: 16px; overflow: auto; flex: 1 1 auto; }

/* Prevent horizontal overflow in tables */
.table-wrap { overflow: auto; max-width: 100%; }
table { table-layout: auto; max-width: 100%; }

@keyframes popIn { from { transform: translateY(12px) scale(.98); opacity: 0 } to { transform: translateY(0) scale(1); opacity: 1 } }
@keyframes fadeIn { from { opacity: 0 } to { opacity: 1 } }
.modal.show .modal-backdrop { animation: fadeIn .2s ease forwards; }

/* Help icon styling */
.help-icon {
	display: inline-block;
	width: 12px;
	height: 12px;
	border-radius: 50%;
	background: var(--muted);
	color: var(--bg);
	font-size: 9px;
	font-weight: bold;
	text-align: center;
	line-height: 12px;
	cursor: help;
	margin-left: 3px;
	transition: all 0.2s ease;
	opacity: 0.7;
	position: relative;
}

.help-icon:hover {
	background: var(--accent);
	color: white;
	opacity: 1;
	transform: scale(1.1);
}

/* Tooltip styling */
.help-icon::after {
	content: attr(title);
	position: absolute;
	top: 50%;
	left: 100%;
	transform: translateY(-50%);
	background: rgba(0, 0, 0, 0.9);
	color: white;
	padding: 4px 6px;
	border-radius: 4px;
	font-size: 10px;
	white-space: nowrap;
	opacity: 0;
	pointer-events: none;
	transition: opacity 0.2s ease;
	z-index: 1000;
	margin-left: 6px;
}

.help-icon:hover::after {
	opacity: 1;
}

/* IP popup styling */
.ip-popup {
	position: fixed;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	background: var(--card);
	border: 1px solid var(--border);
	border-radius: 12px;
	padding: 20px;
	max-width: 400px;
	width: 90%;
	z-index: 10001;
	box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

.ip-popup-overlay {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	background: rgba(0,0,0,0.5);
	z-index: 10000;
}

.ip-popup h3 {
	margin: 0 0 12px 0;
	color: var(--text);
}

.ip-popup .close-btn {
	position: absolute;
	top: 8px;
	right: 8px;
	background: transparent;
	border: none;
	color: var(--muted);
	font-size: 18px;
	cursor: pointer;
	padding: 4px;
}

.ip-popup .close-btn:hover {
	color: var(--text);
}

.ip-popup .info-item {
	margin: 8px 0;
	display: flex;
	justify-content: space-between;
}

.ip-popup .info-label {
	font-weight: 600;
	color: var(--muted);
}

.ip-popup .info-value {
	color: var(--text);
	text-align: right;
}

.ip-popup .loading {
	text-align: center;
	color: var(--muted);
	padding: 20px;
}

/* Clickable IP addresses and domains */
.ip-address, .domain-address {
	color: var(--accent);
	cursor: pointer;
	text-decoration: underline;
	text-decoration-style: dotted;
}

.ip-address:hover, .domain-address:hover {
	color: var(--accent-600);
}

/* Email Preview Styling */
.email-preview {
	max-height: 70vh;
	overflow: auto;
}

/* Link Checker Styling */
.link-checker {
	max-height: 80vh;
	overflow-y: auto;
}

.urls-list {
	display: flex;
	flex-direction: column;
	gap: 16px;
}

.url-item {
	border: 1px solid var(--border);
	border-radius: 8px;
	padding: 16px;
	background: var(--card);
}

.url-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-bottom: 12px;
}

.url-text {
	font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
	font-size: 14px;
	color: var(--text);
	word-break: break-all;
	flex: 1;
	margin-right: 12px;
}

.check-btn {
	background: var(--accent);
	color: white;
	border: none;
	padding: 8px 16px;
	border-radius: 4px;
	cursor: pointer;
	font-size: 14px;
	white-space: nowrap;
}

.check-btn:hover {
	background: var(--accent-600);
}

.url-preview {
	margin-top: 12px;
	min-height: 20px;
}

.preview-content {
	background: var(--bg);
	border: 1px solid var(--border);
	border-radius: 6px;
	padding: 16px;
}

.preview-title-section {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-bottom: 8px;
}

.preview-header h4 {
	margin: 0;
	color: var(--text);
	font-size: 16px;
	flex: 1;
}

.preview-controls {
	display: flex;
	gap: 4px;
	margin-left: 8px;
}

.expand-btn,
.collapse-btn {
	background: var(--border);
	color: var(--text);
	border: 1px solid var(--border);
	padding: 4px 8px;
	border-radius: 4px;
	cursor: pointer;
	font-size: 14px;
	font-weight: bold;
	width: 24px;
	height: 24px;
	display: flex;
	align-items: center;
	justify-content: center;
}

.expand-btn:hover,
.collapse-btn:hover {
	background: var(--accent);
	color: white;
	border-color: var(--accent);
}

.expanded-preview {
	max-height: 80vh;
	overflow-y: auto;
}

.expanded-preview .preview-image img,
.expanded-preview .preview-screenshot img {
	max-height: 500px !important;
	max-width: 100% !important;
}

.preview-description {
	margin: 0 0 12px 0;
	color: var(--text-secondary);
	font-size: 14px;
	line-height: 1.4;
}

.preview-image,
.preview-screenshot {
	margin: 12px 0;
	text-align: center;
}

.preview-meta {
	margin: 12px 0;
	padding: 12px;
	background: var(--card);
	border-radius: 4px;
}

.meta-item {
	margin-bottom: 6px;
	font-size: 14px;
}

.meta-item:last-child {
	margin-bottom: 0;
}

.preview-actions {
	margin-top: 12px;
	text-align: center;
}

.visit-btn {
	display: inline-block;
	background: var(--accent);
	color: white;
	padding: 8px 16px;
	border-radius: 4px;
	text-decoration: none;
	font-size: 14px;
}

.visit-btn:hover {
	background: var(--accent-600);
}

.preview-error {
	background: #ffebee;
	border: 1px solid #f44336;
	border-radius: 6px;
	padding: 16px;
	text-align: center;
}

.preview-error p {
	margin: 0 0 8px 0;
	color: #d32f2f;
}

.error-detail {
	font-size: 12px;
	color: #666;
}

.email-headers h4,
.email-body h4 {
	margin: 0 0 12px 0;
	color: var(--text);
	font-size: 16px;
}

.headers-list {
	max-height: 300px;
	overflow-y: auto;
	border: 1px solid var(--border);
	border-radius: 6px;
	padding: 12px;
	background: var(--card);
}

.header-item {
	margin-bottom: 8px;
	padding-bottom: 8px;
	border-bottom: 1px solid var(--border);
}

.header-item:last-child {
	border-bottom: none;
	margin-bottom: 0;
	padding-bottom: 0;
}

.header-item strong {
	color: var(--accent);
	display: block;
	margin-bottom: 4px;
}

.header-item span {
	color: var(--text);
	word-break: break-word;
}

.body-content {
	max-height: 400px;
	overflow-y: auto;
}

.mime-part {
	margin-bottom: 20px;
	padding: 12px;
	border: 1px solid var(--border);
	border-radius: 6px;
	background: var(--card);
}

.mime-part h5 {
	margin: 0 0 8px 0;
	color: var(--text);
	font-size: 14px;
}

.mime-part iframe {
	background: white;
}

.mime-part pre {
	margin: 0;
	font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
	font-size: 12px;
	line-height: 1.4;
}

/* Dark mode styles */
body.dark {
	background: var(--bg);
	color: var(--text);
}

body.dark .theme-toggle {
	border-color: var(--border);
	color: var(--text);
}

body.dark .theme-toggle:hover {
	background: var(--card);
}

body.dark .logo-section h1 {
	color: var(--text);
}

body.dark .logo-section p {
	color: var(--muted);
}

/* Watermark */
.watermark { position: fixed; right: 20px; bottom: 20px; color: rgba(255,255,255,.14); font-size: 12px; user-select: none; }
[data-theme="light"] .watermark { color: rgba(0,0,0,.2); }

/* Theme switch */
.theme-switch { margin-left: auto; display: inline-flex; align-items: center; }
.icon-toggle { background: transparent; border: 1px solid var(--border); width: 44px; height: 44px; border-radius: 999px; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; margin-right: 8px; }
.icon-toggle .icon { position: absolute; transition: opacity .2s ease, transform .2s ease; }
.icon-toggle .sun { opacity: 0; transform: scale(.8); }
.icon-toggle .moon { opacity: 1; }
[data-theme="light"] .icon-toggle .sun { opacity: 1; transform: scale(1); }
[data-theme="light"] .icon-toggle .moon { opacity: 0; transform: scale(.8); }

