/* Dashboard page */
.dashboard-page {
	width: 100%;
	max-width: 700px;
	margin: 0 auto;
	padding: 0 1rem;
}

.dashboard-back {
	display: inline-flex;
	align-items: center;
	gap: 0.4rem;
	padding: 0.5rem 0;
	font-size: 0.9rem;
	color: var(--text-muted);
	cursor: pointer;
	background: none;
	border: none;
	transition: color 0.2s ease;
	margin-bottom: 1rem;
}

.dashboard-back:hover {
	color: var(--color-primary);
}

.dashboard-back i {
	font-size: 0.75rem;
}

/* Profile header */
.dashboard-profile {
	display: flex;
	align-items: center;
	gap: 1rem;
	padding: 1.25rem;
	background: var(--bg-surface);
	border: 1px solid var(--border-light);
	border-radius: var(--radius-large);
	margin-bottom: 1.25rem;
	flex-wrap: wrap;
}

.dashboard-user-info {
	flex: 1;
	min-width: 0;
}

.dashboard-user-meta {
	display: flex;
	align-items: center;
	gap: 0.75rem;
	margin-top: 0.35rem;
}

.dashboard-usage-inline {
	font-size: 0.8rem;
	color: var(--text-muted);
}

.dashboard-user-email-row {
	display: flex;
	align-items: center;
	gap: 0.5rem;
}

.dashboard-edit-btn {
	width: 24px;
	height: 24px;
	border-radius: 50%;
	border: 1px solid var(--border-light);
	background: var(--bg-tertiary);
	color: var(--text-muted);
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 0.6rem;
	cursor: pointer;
	transition: all 0.2s ease;
	flex-shrink: 0;
}

.dashboard-edit-btn:hover {
	border-color: var(--color-primary);
	color: var(--color-primary);
	background: rgba(var(--brand-blue-rgb), 0.08);
}

.dashboard-tier-badge.clickable {
	cursor: pointer;
	border: 1px solid var(--glassmorphism-border);
	box-shadow: var(--shadow-inset-light);
	backdrop-filter: var(--blur-backdrop);
	-webkit-backdrop-filter: var(--blur-backdrop);
	transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.dashboard-tier-badge.clickable:hover {
	transform: translateY(-1px);
	box-shadow: var(--shadow-md);
	border-color: var(--border-medium);
}

.dashboard-tier-badge.clickable:active {
	transform: translateY(1px);
	box-shadow: var(--shadow-inset-pressed);
	border-color: var(--border-medium);
	transition: all 0.1s cubic-bezier(0.4, 0, 0.2, 1);
}

.dashboard-tier-row {
	display: flex;
	align-items: center;
	justify-content: flex-end;
	gap: 0.6rem;
	margin-bottom: 0.5rem;
}

.dashboard-tier-expiry {
	font-size: 0.75rem;
	color: var(--text-muted);
}

.dashboard-usage-bar-section {
	margin-bottom: 1rem;
	padding: 0.75rem 1rem;
	background: var(--bg-surface);
	border: 1px solid var(--border-light);
	border-radius: var(--radius-medium);
}

.dashboard-usage-header {
	display: flex;
	justify-content: space-between;
	font-size: 0.8rem;
	color: var(--text-secondary);
	margin-bottom: 0.5rem;
}

.dashboard-usage-track {
	height: 6px;
	background: var(--bg-tertiary);
	border-radius: 3px;
	overflow: hidden;
}

.dashboard-usage-fill {
	height: 100%;
	background: var(--gradient-brand);
	border-radius: 3px;
	transition: width 0.3s ease;
}

.dashboard-user-name {
	font-size: 1rem;
	font-weight: 600;
	color: var(--text-primary);
}

/* Email change modal */
.dashboard-modal-overlay {
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, 0.5);
	backdrop-filter: blur(4px);
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 1000;
	padding: 1rem;
}

.dashboard-modal {
	position: relative;
	background: var(--bg-surface);
	border: 1px solid var(--border-light);
	border-radius: var(--radius-large);
	padding: 2rem;
	width: 100%;
	max-width: 400px;
	box-shadow: var(--shadow-lg);
}

.dashboard-user-email {
	font-size: 0.8rem;
	color: var(--text-muted);
}

.dashboard-tier-badge {
	padding: 0.3rem 0.75rem;
	font-size: 0.75rem;
	font-weight: 600;
	border-radius: var(--radius-button);
	text-transform: uppercase;
}

.dashboard-tier-badge.free {
	background: var(--bg-tertiary);
	color: var(--text-muted);
}

.dashboard-tier-badge.basic {
	background: rgba(var(--brand-blue-rgb), 0.1);
	color: var(--color-primary);
}

.dashboard-tier-badge.pro {
	background: var(--gradient-brand);
	color: #fff;
}

/* Tabs */
.dashboard-tabs {
	display: flex;
	gap: 0;
	border-bottom: 1px solid var(--border-light);
	margin-bottom: 1.25rem;
	overflow-x: auto;
}

.dashboard-tab {
	padding: 0.7rem 1rem;
	font-size: 0.85rem;
	font-weight: 500;
	color: var(--text-muted);
	cursor: pointer;
	background: none;
	border: none;
	border-bottom: 2px solid transparent;
	transition: color 0.2s ease, border-color 0.2s ease;
	white-space: nowrap;
}

.dashboard-tab:hover {
	color: var(--text-primary);
}

.dashboard-tab.active {
	color: var(--color-primary);
	border-bottom-color: var(--color-primary);
}

/* Usage card */
.dashboard-usage {
	background: var(--bg-surface);
	border: 1px solid var(--border-light);
	border-radius: var(--radius-medium);
	padding: 1.25rem;
	margin-bottom: 1.25rem;
}

.dashboard-usage-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-bottom: 0.75rem;
}

.dashboard-usage-title {
	font-size: 0.9rem;
	font-weight: 600;
	color: var(--text-primary);
}

.dashboard-usage-count {
	font-size: 0.85rem;
	color: var(--text-muted);
}

.dashboard-usage-bar {
	width: 100%;
	height: 6px;
	background: var(--bg-tertiary);
	border-radius: 3px;
	overflow: hidden;
}

.dashboard-usage-fill {
	height: 100%;
	background: var(--gradient-brand);
	border-radius: 3px;
	transition: width 0.3s ease;
}

/* Quick actions */
.dashboard-actions {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 0.75rem;
	margin-bottom: 1.25rem;
}

.dashboard-action-btn {
	padding: 0.75rem 1rem;
	font-size: 0.85rem;
	font-weight: 500;
	border: 1px solid var(--border-light);
	border-radius: var(--radius-medium);
	background: var(--bg-surface);
	color: var(--text-primary);
	cursor: pointer;
	transition: var(--transition-smooth);
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 0.5rem;
}

.dashboard-action-btn:hover {
	border-color: var(--color-primary);
	background: var(--bg-secondary);
	transform: translateY(-1px);
	box-shadow: var(--shadow-sm);
}

.dashboard-action-btn.primary {
	background: var(--gradient-brand);
	color: #fff;
	border-color: transparent;
}

.dashboard-action-btn.primary:hover {
	box-shadow: var(--shadow-md);
}

.dashboard-action-btn i {
	font-size: 0.8rem;
}

/* History table */
.dashboard-history {
	background: var(--bg-surface);
	border: 1px solid var(--border-light);
	border-radius: var(--radius-medium);
	overflow: hidden;
}

.dashboard-history-row {
	display: grid;
	grid-template-columns: 130px 1fr 60px;
	gap: 0.75rem;
	padding: 0.65rem 1rem;
	align-items: center;
	font-size: 0.85rem;
}

.dashboard-history-row.four-cols {
	grid-template-columns: 130px 1fr 80px 80px;
}

.dashboard-history-row.header {
	background: var(--bg-secondary);
	font-weight: 600;
	color: var(--text-secondary);
	font-size: 0.8rem;
	border-bottom: 1px solid var(--border-light);
}

.dashboard-history-row:not(.header):nth-child(even) {
	background: var(--bg-tertiary);
}

.dashboard-history-row.expired {
	opacity: 0.5;
}

.dashboard-history-title {
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	color: var(--text-primary);
}

.dashboard-dl-link {
	color: var(--color-primary);
	text-decoration: none;
}

.dashboard-dl-link:hover {
	text-decoration: underline;
}

.dashboard-history-platform {
	color: var(--text-muted);
	font-size: 0.8rem;
}

.dashboard-history-quality {
	font-weight: 500;
	text-align: center;
}

.dashboard-history-date {
	color: var(--text-muted);
	font-size: 0.8rem;
	white-space: nowrap;
}

.dashboard-history-amount {
	font-weight: 600;
	color: var(--text-primary);
	text-align: right;
}

.dashboard-history-provider {
	color: var(--text-muted);
	font-size: 0.8rem;
	text-align: right;
}

/* Status badges */
.status-badge {
	display: inline-block;
	padding: 0.15rem 0.5rem;
	font-size: 0.7rem;
	font-weight: 600;
	border-radius: var(--radius-small);
	text-transform: uppercase;
}

.status-badge.active {
	background: rgba(16, 185, 129, 0.1);
	color: #10b981;
}

.status-badge.expired {
	background: var(--bg-tertiary);
	color: var(--text-muted);
}

.dashboard-empty {
	text-align: center;
	padding: 2rem;
	color: var(--text-muted);
	font-size: 0.9rem;
}

.dashboard-login-prompt {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	min-height: 60vh;
	text-align: center;
	color: var(--text-muted);
	gap: 0.75rem;
}

.dashboard-login-prompt p {
	font-size: 1.05rem;
	margin: 0;
}

.dashboard-login-prompt-icon {
	width: 56px;
	height: 56px;
	border-radius: 50%;
	background: var(--bg-surface);
	border: 1px solid var(--border-light);
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 1.3rem;
	color: var(--text-muted);
	margin-bottom: 0.25rem;
}

/* Settings section */
.dashboard-settings-section {
	background: var(--bg-surface);
	border: 1px solid var(--border-light);
	border-radius: var(--radius-medium);
	padding: 1.25rem;
	margin-bottom: 1rem;
}

.dashboard-settings-title {
	font-size: 0.9rem;
	font-weight: 600;
	color: var(--text-primary);
	margin-bottom: 1rem;
}

.dashboard-settings-divider {
	border-top: 1px solid var(--border-light);
	margin: 1rem 0;
}

.dashboard-settings-row {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 0.5rem 0;
	border-bottom: 1px solid var(--border-light);
}

.dashboard-settings-row:last-child {
	border-bottom: none;
}

.dashboard-settings-label {
	font-size: 0.85rem;
	color: var(--text-secondary);
	display: flex;
	align-items: center;
	gap: 0.5rem;
}

.dashboard-settings-label i {
	width: 1rem;
	text-align: center;
}

.dashboard-settings-value {
	font-size: 0.85rem;
	color: var(--text-muted);
}

.dashboard-settings-value.connected {
	color: #10b981;
}

/* Settings forms */
.dashboard-settings-form {
	display: flex;
	gap: 0.5rem;
	flex-wrap: wrap;
}

.dashboard-input {
	flex: 1;
	min-width: 150px;
	padding: 0.6rem 0.8rem;
	font-size: 0.85rem;
	background: var(--bg-secondary);
	border: 1px solid var(--border-light);
	border-radius: var(--radius-small);
	color: var(--text-primary);
	outline: none;
	transition: border-color 0.2s ease;
}

.dashboard-input:focus {
	border-color: var(--color-primary);
}

.dashboard-settings-btn {
	padding: 0.6rem 1rem;
	font-size: 0.85rem;
	font-weight: 500;
	background: var(--color-primary);
	color: #fff;
	border: none;
	border-radius: var(--radius-small);
	cursor: pointer;
	transition: opacity 0.2s ease;
	white-space: nowrap;
}

.dashboard-settings-btn:hover {
	opacity: 0.9;
}

.dashboard-settings-btn:disabled {
	opacity: 0.5;
	cursor: not-allowed;
}

/* Messages */
.dashboard-msg {
	margin-top: 0.5rem;
	padding: 0.5rem 0.75rem;
	font-size: 0.8rem;
	border-radius: var(--radius-small);
}

.dashboard-msg.success {
	background: rgba(16, 185, 129, 0.1);
	color: #10b981;
}

.dashboard-msg.error {
	background: rgba(239, 68, 68, 0.1);
	color: #ef4444;
}

.dashboard-logout-btn {
	width: 100%;
	padding: 0.7rem 1rem;
	font-size: 0.85rem;
	font-weight: 500;
	border: 1px solid var(--color-error);
	border-radius: var(--radius-button);
	background: transparent;
	color: var(--color-error);
	cursor: pointer;
	transition: var(--transition-smooth);
	margin-top: 1rem;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 0.5rem;
}

.dashboard-logout-btn:hover {
	background: var(--color-error);
	color: #fff;
}

/* Dark theme */
:root[data-theme="dark"] .dashboard-profile,
:root[data-theme="dark"] .dashboard-usage,
:root[data-theme="dark"] .dashboard-history,
:root[data-theme="dark"] .dashboard-action-btn:not(.primary),
:root[data-theme="dark"] .dashboard-settings-section {
	background: var(--bg-surface);
	border-color: var(--border-medium);
}

:root[data-theme="dark"] .dashboard-input {
	background: var(--bg-tertiary);
	border-color: var(--border-medium);
	color: var(--text-primary);
}

/* Responsive */
@media (max-width: 480px) {
	.dashboard-actions {
		grid-template-columns: 1fr;
	}

	.dashboard-history-row {
		grid-template-columns: 1fr auto;
		gap: 0.5rem;
	}

	.dashboard-history-platform,
	.dashboard-history-date {
		display: none;
	}

	.dashboard-profile {
		flex-direction: column;
		text-align: center;
	}

	.dashboard-settings-form {
		flex-direction: column;
	}

	.dashboard-settings-btn {
		width: 100%;
	}
}
