/* ================================
   THEME VARIABLES
   ================================ */
:root {
	/* Fonts & Base */
	--font-family: "Inter", "Segoe UI", Roboto, Arial, sans-serif;
	--font-size: 16px;
	--text-color: #333;
	--bg-color: #f8f9fa;

	/* Brand Colors */
	--primary-color: #007bff;
	--primary-color-hover: #0056b3;
	--secondary-bg: #f1f1f1;
	--secondary-border: #b3d7ff;
	--danger-color: #e74c3c;
	--danger-color-hover: #c0392b;
	--success-color: #28a745;
	--muted-color: #555;

	/* Accents */
	--border-color: #ccc;
	--light-border: #ddd;
	--light-bg: #fff;
	--shadow-small: 0 1px 3px rgba(0, 0, 0, 0.05);
	--shadow-medium: 0 2px 6px rgba(0, 0, 0, 0.05);
	--shadow-hover: 0 4px 10px rgba(0, 0, 0, 0.08);

	/* Radius */
	--radius-small: 4px;
	--radius: 6px;
	--radius-large: 10px;
}

/* ================================
   BASE LAYOUT
   ================================ */
body {
	font-family: var(--font-family);
	font-size: var(--font-size);
	line-height: 1.5;
	color: var(--text-color);
	background: var(--bg-color);
	max-width: 1140px;
	margin: 0 auto;
	padding: 0 1em 3em;
}

h1,
h2,
h3,
h4 {
	font-weight: 600;
	margin-bottom: 0.5em;
}

.container {
	max-width: 960px;
	margin: 0 auto;
	padding: 0 1em 2em;
}

/* ================================
   NAVBAR
   ================================ */
.navbar {
	background: var(--secondary-bg);
	border: 1px solid var(--light-border);
	border-radius: var(--radius);
	box-shadow: var(--shadow-small);
	padding: 0.8em 1.2em;
	margin: 1em auto 2em;
	display: flex;
	align-items: center;
	gap: 1em;
	max-width: 960px;
}

.navbar a {
	text-decoration: none;
	color: var(--text-color);
	padding: 6px 14px;
	border-radius: var(--radius);
	font-weight: 500;
	transition:
		background 0.2s,
		color 0.2s;
}

.navbar a.active {
	background: var(--primary-color);
	color: #fff;
}

.navbar a:hover:not(.disabled):not(.active) {
	background: rgba(0, 123, 255, 0.1);
	color: var(--primary-color);
}

.navbar a.disabled {
	color: #aaa;
	pointer-events: none;
}

.navbar a:last-child {
	margin-left: auto;
}

@media (max-width: 700px) {
	.navbar {
		flex-direction: column;
		align-items: flex-start;
	}

	.navbar a:last-child {
		margin-left: 0;
	}
}

/* ================================
   BUTTONS
   ================================ */
.btn {
	padding: 7px 18px;
	border-radius: var(--radius);
	font-size: 1em;
	cursor: pointer;
	transition:
		background 0.2s,
		color 0.2s;
}

.btn-primary {
	background: var(--primary-color);
	color: #fff;
	border: 1px solid var(--primary-color);
}

.btn-primary:hover {
	background: var(--primary-color-hover);
}

.btn-secondary {
	background: var(--secondary-bg);
	color: var(--primary-color);
	border: 1px solid var(--secondary-border);
}

.btn-danger {
	background: var(--danger-color);
	color: #fff;
	border: 1px solid var(--danger-color);
}

.btn-danger:hover {
	background: var(--danger-color-hover);
}

.btn:disabled {
	opacity: 0.6;
	cursor: not-allowed;
}

/* ================================
   CARD CONTAINERS
   ================================ */
.step,
.report-container,
.login-container {
	background: var(--light-bg);
	border: 1px solid var(--border-color);
	border-radius: var(--radius);
	box-shadow: var(--shadow-medium);
	padding: 1.5em;
	margin-top: 1.5em;
}

/* ================================
   LEAD FINDER
   ================================ */
.input-area {
	display: flex;
	align-items: center;
	gap: 10px;
	margin-bottom: 10px;
}

.bubble-container {
	display: flex;
	flex-wrap: wrap;
	gap: 5px;
	margin-top: 10px;
}

.bubble {
	background: #e0e0e0;
	padding: 5px 10px;
	border-radius: 15px;
	display: flex;
	align-items: center;
}

.bubble .close {
	margin-left: 8px;
	cursor: pointer;
	font-weight: bold;
}

.location-selectors {
	display: flex;
	gap: 1em;
	margin: 1em 0;
}

.location-selectors>div {
	flex: 1;
	border: 1px solid var(--light-border);
	padding: 10px;
	border-radius: var(--radius);
	background: var(--secondary-bg);
}

.location-list {
	border: 1px solid var(--light-border);
	padding: 5px;
	background: var(--light-bg);
}

.location-canada {
	margin: 1em 0;
	padding: 0.8em 1em;
	border: 1px solid var(--light-border);
	border-radius: var(--radius);
	background: var(--secondary-bg);
}

.location-canada label {
	font-size: 1.1em;
}

.location-note {
	font-size: 0.9em;
	color: var(--muted-color);
	margin: 0.4em 0 0 1.8em;
}

.location-list input[type="checkbox"]:disabled+label,
.location-canada input[type="checkbox"]:disabled+strong {
	opacity: 0.6;
	cursor: not-allowed;
}

#clear-keywords-btn {
	margin-top: 0.5em;
	font-size: 0.9em;
}

@media (max-width: 700px) {
	.location-selectors {
		flex-direction: column;
	}

	.step {
		padding: 0.8em;
	}

	table,
	th,
	td {
		font-size: 12px;
	}
}

/* ================================
   ALERT / ERROR
   ================================ */
#error-message {
	color: var(--error-color);
	background: var(--error-bg);
	border: 1px solid #ebccd1;
	padding: 8px;
	border-radius: var(--radius);
	margin-bottom: 1em;
	display: none;
}

/* ================================
   TABLES
   ================================ */
table {
	border-collapse: collapse;
	width: 100%;
	background: var(--light-bg);
}

th,
td {
	border: 1px solid var(--light-border);
	padding: 8px 10px;
	text-align: left;
	word-break: break-word;
}

th {
	background: var(--secondary-bg);
	cursor: pointer;
}

.results-table-container {
	overflow-x: auto;
}

#results-table {
	font-size: 13px;
	margin-top: 1em;
}

#results-table td:last-child {
	white-space: nowrap;
}

.status-actions {
	display: flex;
	gap: 0.5em;
	align-items: center;
}

.status-select {
	padding: 2px 6px;
	border-radius: var(--radius-small);
	min-width: 110px;
}

.delete-lead-btn {
	background: var(--danger-color);
	color: #fff;
	border-radius: var(--radius-small);
	padding: 2px 8px;
	cursor: pointer;
}

.delete-lead-btn:hover {
	background: var(--danger-color-hover);
}

/* Report-style tables */
.report-table th {
	background: #f9fafb;
}

.report-summary {
	background: var(--secondary-bg);
	padding: 0.8em 1em;
	border-radius: var(--radius);
	margin-bottom: 1em;
	font-size: 0.95em;
}

.success-box {
	background: #d4edda;
	color: #155724;
	border: 1px solid #c3e6cb;
}

.error-box {
	background: #f2dede;
	color: #b94a48;
	border: 1px solid #ebccd1;
}

/* ================================
   PAGINATION
   ================================ */
.pagination {
	display: flex;
	justify-content: center;
	align-items: center;
	gap: 6px;
	margin: 1.5em 0;
	flex-wrap: wrap;
}

.pagination a {
	padding: 6px 12px;
	border: 1px solid var(--light-border);
	border-radius: var(--radius-small);
	background: var(--light-bg);
	color: var(--primary-color);
	text-decoration: none;
	font-size: 0.9em;
	transition: all 0.2s;
}

.pagination a.active {
	background: var(--primary-color);
	color: #fff;
	border-color: var(--primary-color);
}

.pagination a:hover:not(.active) {
	background: var(--secondary-bg);
	border-color: var(--border-color);
}

.pagination .disabled {
	pointer-events: none;
	color: #aaa;
	background: #fafafa;
	border-color: #eee;
}

@media (max-width: 600px) {
	.pagination a {
		padding: 4px 8px;
		font-size: 0.8em;
		min-width: 32px;
		text-align: center;
	}
}

/* ================================
   SPINNER / PROGRESS
   ================================ */
.spinner,
.audit-spinner {
	border: 4px solid #f3f3f3;
	display: none;
	border-top: 4px solid var(--primary-color);
	border-radius: 50%;
	width: 26px;
	height: 26px;
	animation: spin 1s linear infinite;
}

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

#progress-container {
	display: none;
	margin-top: 1em;
	text-align: center;
}

#audit-progress,
#progress-box {
	background: #d3d3d3;
	color: black;
	font-family: monospace;
	padding: 1em;
	max-height: 280px;
	overflow-y: auto;
	border-radius: var(--radius);
	font-size: 0.9em;
}

#progress-box em {
	color: black;
}

#progress-box .success {
	color: var(--success-color);
}

#progress-box .error {
	color: var(--danger-color-hover);
}

/* ================================
   TOOLBAR (Lead Finder)
   ================================ */
.toolbar {
	display: flex;
	flex-direction: column;
	gap: 1em;
	margin-bottom: 1em;
}

.toolbar-group {
	display: flex;
	align-items: center;
	gap: 0.5em;
	flex-wrap: wrap;
}

.toolbar-explanation {
	font-size: 0.95em;
	color: var(--muted-color);
	font-style: italic;
}

/* ================================
   MODALS
   ================================ */
.modal {
	display: none;
	position: fixed;
	z-index: 1000;
	left: 0;
	top: 0;
	width: 100%;
	height: 100%;
	overflow: auto;
	background: rgba(0, 0, 0, 0.4);
}

.modal-content {
	background: var(--light-bg);
	margin: 8% auto;
	padding: 20px;
	border: 1px solid var(--border-color);
	border-radius: var(--radius);
	max-width: 600px;
	width: 90%;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.modal-section {
	margin-bottom: 15px;
}

.modal-content h3 {
	margin-top: 0;
}

.modal button {
	margin-top: 0.5em;
}

#help-btn {
	float: right;
	font-size: 1.2em;
	background: none;
	border: none;
	color: var(--primary-color);
	cursor: pointer;
}

#final-banner {
	display: none;
}

/* ================================
   LOGIN / AUTH PAGES
   ================================ */
.login-container {
	border-radius: var(--radius-large);
	box-shadow: 0 2px 16px #e0e0e0;
	padding: 2.5em 2em;
	text-align: center;
	max-width: 420px;
	margin: 4em auto;
}

.login-logo {
	font-size: 1.8em;
	font-weight: bold;
	color: var(--primary-color);
	margin-bottom: 0.5em;
}

.login-title {
	font-size: 1.3em;
	margin-bottom: 1.2em;
	color: #222;
}

.login-form input[type="email"],
.login-form input[type="password"] {
	width: 90%;
	padding: 10px;
	margin: 0.5em 0 1em;
	border: 1px solid var(--border-color);
	border-radius: var(--radius-small);
}

.login-form button {
	padding: 10px 32px;
	background: var(--primary-color);
	color: #fff;
	border: none;
	border-radius: var(--radius-small);
	font-weight: bold;
	cursor: pointer;
	margin-bottom: 1em;
}

.login-form button:hover {
	background: var(--primary-color-hover);
}

.login-links {
	margin-top: 1em;
	font-size: 0.95em;
}

.login-links a {
	color: var(--primary-color);
	text-decoration: none;
	margin: 0 0.5em;
}

.login-links a:hover {
	text-decoration: underline;
}

.login-error {
	color: var(--danger-color);
	margin-bottom: 1em;
}

.login-message {
	color: var(--success-color);
	margin-bottom: 1em;
}

/* ================================
   DASHBOARD
   ================================ */
.dashboard-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
	gap: 1.5em;
	margin-top: 1.5em;
}

.tool-card {
	background: var(--light-bg);
	border: 1px solid var(--light-border);
	border-radius: var(--radius);
	padding: 1.2em;
	box-shadow: var(--shadow-small);
	display: flex;
	flex-direction: column;
	justify-content: space-between;
	height: 100%;
}

.tool-card h3 {
	margin-top: 0;
}

.tool-card p {
	margin: 0.5em 0 1.2em;
	color: var(--muted-color);
	font-size: 0.9em;
	flex-grow: 1;
}

.tool-card .btn {
	align-self: center;
	margin-top: auto;
}

.stat-card {
	background: linear-gradient(135deg, #fff 0, #f9f9f9 100%);
	border: 1px solid var(--light-border);
	border-radius: var(--radius-large);
	padding: 1.5em;
	box-shadow: var(--shadow-medium);
	display: flex;
	flex-direction: column;
	transition:
		transform 0.2s,
		box-shadow 0.2s;
}

.stat-card:hover {
	transform: translateY(-2px);
	box-shadow: var(--shadow-hover);
}

.stat-value {
	font-size: 2em;
	font-weight: 700;
	margin-bottom: 0.3em;
}

.stat-label {
	font-size: 0.95em;
	color: #666;
}

.stat-card::before {
	content: "";
	display: block;
	width: 40px;
	height: 4px;
	border-radius: 2px;
	margin-bottom: 0.8em;
}

.stat-card.api-usage::before {
	background: var(--primary-color);
}

.stat-card.saved-searches::before {
	background: var(--success-color);
}

.stat-card.shared-reports::before {
	background: #6f42c1;
}

.stat-card.api-usage .stat-value {
	color: var(--primary-color);
}

.stat-card.saved-searches .stat-value {
	color: var(--success-color);
}

.stat-card.shared-reports .stat-value {
	color: #6f42c1;
}

/* ================================
   TABLE SHARED REPORTS 
   ================================ */
tr.status-new-lead {
	background: #e8f4ff;
}

tr.status-emailed {
	background: #fff7e6;
}

tr.status-follow-up-required {
	background: #fff0f5;
}

tr.status-meeting-scheduled {
	background: #e6f9f0;
}

tr.status-not-interested {
	background: #f9ecec;
}

tr.status-closed-won {
	background: #ecf9ec;
}

/* ================================
   SEO AUDIT FORM
   ================================ */

.audit-form {
	display: flex;
	flex-direction: column;
	gap: 1em;
	max-width: 600px;
}

.audit-form input[type="url"],
.audit-form input[type="text"],
.audit-form input[type="number"] {
	padding: 10px;
	border: 1px solid var(--border-color);
	border-radius: var(--radius);
	font-size: 1em;
	width: 100%;
	box-sizing: border-box;
}

.seo-audit-options {
	display: flex;
	flex-direction: column;
	gap: 0.6em;
}

.seo-audit-options label {
	display: flex;
	align-items: center;
	gap: 0.6em;
	background: var(--secondary-bg);
	padding: 0.6em 0.8em;
	border-radius: var(--radius-small);
	border: 1px solid var(--light-border);
	cursor: pointer;
	transition: background 0.2s;
}

.seo-audit-options label:hover {
	background: #eef6ff;
}

.seo-audit-options input[type="radio"] {
	accent-color: var(--primary-color);
}

.seo-audit-options span {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 0.4em;
}

.seo-audit-options input[type="number"] {
	width: 70px;
	padding: 6px;
	text-align: right;
}

.audit-form button[type="submit"] {
	align-self: flex-start;
	margin-top: 0.5em;
}

/* Audit Status Bar */
.audit-status-bar {
	background: #f8f9fa;
	border: 1px solid #dee2e6;
	border-radius: var(--radius);
	padding: 1em;
	margin: 1em 0;
	box-shadow: var(--shadow-small);
}

.status-content {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 0.5em;
}

.status-icon {
	font-size: 1.2em;
	margin-right: 0.5em;
}

.status-running {
	border-left: 4px solid #007bff;
	background: #e3f2fd;
}

.status-completed {
	border-left: 4px solid #28a745;
	background: #d4edda;
}

.status-error {
	border-left: 4px solid #dc3545;
	background: #f8d7da;
}

.status-cancelled {
	border-left: 4px solid #6c757d;
	background: #f8f9fa;
}

.progress-bar {
	height: 6px;
	background: #e9ecef;
	border-radius: 3px;
	overflow: hidden;
}

.progress-fill {
	height: 100%;
	background: linear-gradient(90deg, #007bff, #0056b3);
	transition: width 0.3s ease;
	width: 0%;
}

/* Enhanced Console */
.audit-console {
	background: #1a1a1a;
	border-radius: var(--radius);
	overflow: hidden;
	box-shadow: var(--shadow-medium);
	margin: 1em 0;
}

.console-header {
	background: #2d2d2d;
	color: #fff;
	padding: 0.5em 1em;
	display: flex;
	justify-content: space-between;
	align-items: center;
	font-size: 0.9em;
}

.console-content {
	background: #1a1a1a;
	color: black;
	font-family: 'Courier New', monospace;
	padding: 1em;
	max-height: 300px;
	overflow-y: auto;
	font-size: 0.9em;
	line-height: 1.4;
}

.console-line {
	margin-bottom: 0.2em;
	padding: 2px 0;
}

.console-line.success {
	color: #28a745;
}

.console-line.error {
	color: #dc3545;
}

.console-line.warning {
	color: #ffc107;
}

/* Form Enhancements */
#start-audit-btn:disabled {
	opacity: 0.6;
	cursor: not-allowed;
}

.btn-secondary.console-btn {
	font-size: 0.8em;
	padding: 4px 8px;
}

/* Responsive Design */
@media (max-width: 768px) {
	.status-content {
		flex-direction: column;
		align-items: flex-start;
		gap: 0.5em;
	}

	.console-content {
		font-size: 0.8em;
		max-height: 200px;
	}
}
