/**
 * Noqstock Authentication Styles
 *
 * @package Noqstock_Platform_Theme
 *
 * Dependencies: style.css (design tokens loaded via main theme stylesheet)
 * Note: This file uses design tokens from style.css. No :root tokens defined here.
 */

/* ==========================================================================
   Layout
   ========================================================================== */
.noqstock-auth {
	min-height: 100vh;
	display: flex;
	align-items: center;
	justify-content: center;
	background: var(--color-bg-base);
	padding: var(--space-8) var(--space-4);
}

.noqstock-auth__wrapper {
	width: 100%;
	max-width: var(--content-narrow);
}

.noqstock-auth__container {
	position: relative;
}

.noqstock-auth__card {
	background: var(--color-bg-surface);
	border: 1px solid var(--color-border);
	border-radius: var(--radius-md);
	padding: var(--space-10) var(--space-8);
}

/* ==========================================================================
   Welcome Section (Registration page)
   ========================================================================== */
.noqstock-auth__welcome {
	text-align: left;
	margin-bottom: var(--space-8);
	padding-bottom: var(--space-6);
	border-bottom: 1px solid var(--color-border);
}

.noqstock-auth__welcome-title {
	font-size: var(--font-size-lg);
	font-weight: var(--font-weight-semibold);
	color: var(--color-text-primary);
	margin: 0 0 var(--space-4);
	line-height: var(--line-height-tight);
}

.noqstock-auth__welcome-text {
	color: var(--color-text-secondary);
	font-size: var(--font-size-sm);
	line-height: var(--line-height-relaxed);
	margin: 0 0 var(--space-3);
}

.noqstock-auth__welcome-highlight {
	color: var(--color-text-primary);
	font-size: var(--font-size-sm);
	line-height: var(--line-height-relaxed);
	margin: var(--space-4) 0;
}

/* ==========================================================================
   Auth Section Cards (Dynamic Content from Admin)
   ========================================================================== */
.noqstock-auth__section-card {
	text-align: left;
	margin-bottom: var(--space-6);
}

.noqstock-auth__section-card:last-of-type {
	margin-bottom: var(--space-8);
}

.noqstock-auth__section-title {
	font-size: var(--font-size-lg);
	font-weight: var(--font-weight-semibold);
	color: var(--color-text-primary);
	margin: 0 0 var(--space-4);
	line-height: var(--line-height-tight);
}

.noqstock-auth__section-content {
	color: var(--color-text-secondary);
	font-size: var(--font-size-sm);
	line-height: var(--line-height-relaxed);
}

.noqstock-auth__section-content p {
	margin: 0 0 var(--space-3);
}

.noqstock-auth__section-content p:last-child {
	margin-bottom: 0;
}

.noqstock-auth__section-content strong {
	color: var(--color-text-primary);
	font-weight: var(--font-weight-semibold);
}

.noqstock-auth__section-content small {
	font-size: var(--font-size-xs);
	color: var(--color-text-muted);
}

/* ==========================================================================
   Header
   ========================================================================== */
.noqstock-auth__header {
	text-align: center;
	margin-bottom: var(--space-8);
}

.noqstock-auth__title {
	font-size: var(--font-size-xl);
	font-weight: var(--font-weight-semibold);
	color: var(--color-text-primary);
	margin: 0 0 var(--space-2);
	line-height: var(--line-height-tight);
}

.noqstock-auth__subtitle {
	color: var(--color-text-muted);
	margin: 0;
	font-size: var(--font-size-base);
}

/* ==========================================================================
   Form
   ========================================================================== */
.noqstock-auth__form {
	display: flex;
	flex-direction: column;
	gap: var(--space-5);
}

.noqstock-auth__field {
	position: relative;
}

.noqstock-auth__field-wrapper {
	position: relative;
}

/* ==========================================================================
   Input Fields
   ========================================================================== */
.noqstock-auth__input {
	width: 100%;
	height: var(--input-height-md);
	padding: var(--space-3) var(--space-4);
	font-size: var(--font-size-base);
	color: var(--color-text-primary);
	background: var(--color-bg-muted);
	border: 1px solid var(--color-border);
	border-radius: var(--radius-md);
	transition: border-color var(--transition-normal) var(--ease-out),
	            box-shadow var(--transition-normal) var(--ease-out);
	outline: none;
}

.noqstock-auth__input:focus {
	border-color: var(--color-accent);
	box-shadow: 0 0 0 3px var(--color-focus-ring);
}

/* Autofill override */
.noqstock-auth__input:-webkit-autofill,
.noqstock-auth__input:-webkit-autofill:hover,
.noqstock-auth__input:-webkit-autofill:focus,
.noqstock-auth__input:-webkit-autofill:active {
	-webkit-box-shadow: 0 0 0 1000px var(--color-bg-muted) inset !important;
	-webkit-text-fill-color: var(--color-text-primary) !important;
	transition: background-color 5000s ease-in-out 0s;
}

/* Floating Label */
.noqstock-auth__label--float {
	position: absolute;
	left: var(--space-4);
	top: 50%;
	transform: translateY(-50%);
	color: var(--color-text-muted);
	pointer-events: none;
	transition: all var(--transition-normal) var(--ease-out);
	background: var(--color-bg-muted);
	padding: 0 var(--space-1);
}

/* Label floats up when input has value or is focused */
.noqstock-auth__input:focus ~ .noqstock-auth__label--float,
.noqstock-auth__input:not(:placeholder-shown) ~ .noqstock-auth__label--float,
.noqstock-auth__field--has-value .noqstock-auth__label--float {
	top: 0;
	font-size: var(--font-size-xs);
	color: var(--color-accent);
}

/* Error State */
.noqstock-auth__field--error .noqstock-auth__input {
	border-color: var(--color-error);
}

.noqstock-auth__field--error .noqstock-auth__label--float {
	color: var(--color-error);
}

.noqstock-auth__description {
	color: var(--color-text-muted);
	font-size: var(--font-size-sm);
	margin: var(--space-2) 0 0;
}

.noqstock-auth__error {
	color: var(--color-error);
	font-size: var(--font-size-sm);
	margin: var(--space-2) 0 0;
}

.noqstock-auth__global-error {
	background: var(--color-error-bg);
	border: 1px solid var(--color-error);
	border-radius: var(--radius-md);
	color: var(--color-error);
	padding: var(--space-3) var(--space-4);
	margin-bottom: var(--space-4);
	font-size: var(--font-size-sm);
}

.noqstock-auth__success {
	background: var(--color-success-bg);
	border: 1px solid var(--color-success);
	border-radius: var(--radius-md);
	color: var(--color-success);
	padding: var(--space-3) var(--space-4);
	margin-bottom: var(--space-4);
	font-size: var(--font-size-sm);
}

/* Magic Link Success State */
.noqstock-auth__success--magic-link,
.noqstock-auth__card > .noqstock-auth__success {
	text-align: center;
	padding: var(--space-8) var(--space-6);
	background: transparent;
	border: none;
	color: inherit;
	margin: 0;
}

.noqstock-auth__success-icon {
	display: flex;
	justify-content: center;
	margin-bottom: var(--space-4);
}

.noqstock-auth__success-icon svg {
	color: var(--color-success);
}

.noqstock-auth__success-title {
	font-size: var(--font-size-xl);
	font-weight: var(--font-weight-semibold);
	color: var(--color-text-primary);
	margin: 0 0 var(--space-3);
}

.noqstock-auth__success-message {
	font-size: var(--font-size-base);
	color: var(--color-text-primary);
	margin: 0 0 var(--space-2);
}

.noqstock-auth__success-hint {
	font-size: var(--font-size-sm);
	color: var(--color-text-muted);
	margin: 0;
}

/* ==========================================================================
   Phone Number Fields (Country Code Selector + Number)
   ========================================================================== */
.noqstock-auth__phone-row {
	display: flex;
	gap: var(--space-3);
	align-items: flex-start;
}

.noqstock-auth__field--country-code {
	flex: 0 0 auto;
	width: 120px;
	min-width: 120px;
}

.noqstock-auth__field--phone-number {
	flex: 1 1 auto;
}

/* Country Selector Button */
.noqstock-auth__country-selector {
	position: relative;
}

.noqstock-auth__country-selector-btn {
	display: flex;
	align-items: center;
	gap: var(--space-2);
	width: 100%;
	height: var(--input-height-md);
	padding: var(--space-3) var(--space-4);
	font-size: var(--font-size-base);
	color: var(--color-text-primary);
	background: var(--color-bg-muted);
	border: 1px solid var(--color-border);
	border-radius: var(--radius-md);
	cursor: pointer;
	transition: border-color var(--transition-normal) var(--ease-out),
	            box-shadow var(--transition-normal) var(--ease-out);
	outline: none;
	text-align: left;
}

.noqstock-auth__country-selector-btn:hover {
	border-color: var(--color-text-muted);
}

.noqstock-auth__country-selector-btn:focus {
	border-color: var(--color-accent);
	box-shadow: 0 0 0 3px var(--color-focus-ring);
}

.noqstock-auth__country-selector-flag {
	font-size: var(--font-size-lg);
	line-height: 1;
	min-width: var(--space-6);
}

.noqstock-auth__country-selector-code {
	flex: 1;
	font-weight: var(--font-weight-medium);
}

.noqstock-auth__country-selector-arrow {
	color: var(--color-text-muted);
	transition: transform var(--transition-normal) var(--ease-out);
}

.noqstock-auth__country-selector[data-open="true"] .noqstock-auth__country-selector-arrow {
	transform: rotate(180deg);
}

/* Error state */
.noqstock-auth__field--error .noqstock-auth__country-selector-btn {
	border-color: var(--color-error);
}

/* Country Dropdown */
.noqstock-auth__country-dropdown {
	position: absolute;
	top: calc(100% + var(--space-2));
	left: 0;
	width: 300px;
	max-height: 350px;
	background: var(--color-bg-elevated);
	border: 1px solid var(--color-border);
	border-radius: var(--radius-md);
	box-shadow: var(--shadow-lg);
	z-index: var(--z-dropdown);
	display: none;
	flex-direction: column;
	overflow: hidden;
}

.noqstock-auth__country-selector[data-open="true"] .noqstock-auth__country-dropdown {
	display: flex;
}

/* Dropdown Search */
.noqstock-auth__country-dropdown-search {
	display: flex;
	align-items: center;
	gap: var(--space-3);
	padding: var(--space-3) var(--space-4);
	border-bottom: 1px solid var(--color-border);
}

.noqstock-auth__country-dropdown-search-icon {
	color: var(--color-text-muted);
	flex-shrink: 0;
}

.noqstock-auth__country-dropdown-search-input {
	flex: 1;
	border: none;
	background: transparent;
	color: var(--color-text-primary);
	font-size: var(--font-size-base);
	outline: none;
}

.noqstock-auth__country-dropdown-search-input::placeholder {
	color: var(--color-text-muted);
}

/* Country List */
.noqstock-auth__country-dropdown-list {
	flex: 1;
	overflow-y: auto;
	padding: var(--space-2) 0;
}

/* Custom scrollbar */
.noqstock-auth__country-dropdown-list::-webkit-scrollbar {
	width: 6px;
}

.noqstock-auth__country-dropdown-list::-webkit-scrollbar-track {
	background: transparent;
}

.noqstock-auth__country-dropdown-list::-webkit-scrollbar-thumb {
	background: var(--color-border);
	border-radius: 3px;
}

.noqstock-auth__country-dropdown-list::-webkit-scrollbar-thumb:hover {
	background: var(--color-text-muted);
}

/* Country Item */
.noqstock-auth__country-item {
	display: flex;
	align-items: center;
	gap: var(--space-3);
	width: 100%;
	padding: var(--space-3) var(--space-4);
	border: none;
	background: transparent;
	color: var(--color-text-primary);
	font-size: var(--font-size-base);
	cursor: pointer;
	text-align: left;
	transition: background-color var(--transition-normal) var(--ease-out);
}

.noqstock-auth__country-item:hover,
.noqstock-auth__country-item:focus {
	background: var(--color-overlay-light);
	outline: none;
}

.noqstock-auth__country-item[aria-selected="true"] {
	background: var(--color-accent-subtle);
}

.noqstock-auth__country-item-flag {
	font-size: var(--font-size-xl);
	line-height: 1;
	min-width: var(--space-8);
}

.noqstock-auth__country-item-code {
	color: var(--color-text-muted);
	min-width: 50px;
}

.noqstock-auth__country-item-name {
	flex: 1;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

/* No results message */
.noqstock-auth__country-dropdown-empty {
	padding: var(--space-6) var(--space-4);
	text-align: center;
	color: var(--color-text-muted);
	font-size: var(--font-size-sm);
}

/* Responsive: Stack on very small screens */
@media (max-width: 360px) {
	.noqstock-auth__phone-row {
		flex-direction: column;
		gap: var(--space-5);
	}

	.noqstock-auth__field--country-code {
		width: 100%;
	}

	.noqstock-auth__country-dropdown {
		width: 100%;
		position: fixed;
		top: auto;
		bottom: 0;
		left: 0;
		right: 0;
		max-height: 60vh;
		border-radius: var(--radius-md) var(--radius-md) 0 0;
	}
}

/* ==========================================================================
   Password Toggle
   ========================================================================== */
.noqstock-auth__toggle-password {
	position: absolute;
	right: var(--space-4);
	top: 50%;
	transform: translateY(-50%);
	background: none;
	border: none;
	cursor: pointer;
	padding: var(--space-1);
	color: var(--color-text-muted);
	transition: color var(--transition-normal) var(--ease-out);
}

.noqstock-auth__toggle-password:hover {
	color: var(--color-text-primary);
}

.noqstock-auth__eye-icon {
	display: block;
	width: var(--icon-sm);
	height: var(--icon-sm);
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%23d4a373'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M15 12a3 3 0 11-6 0 3 3 0 016 0z'/%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z'/%3E%3C/svg%3E");
	background-size: contain;
	background-repeat: no-repeat;
}

.noqstock-auth__toggle-password--visible .noqstock-auth__eye-icon {
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%23d4a373'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M13.875 18.825A10.05 10.05 0 0112 19c-4.478 0-8.268-2.943-9.543-7a9.97 9.97 0 011.563-3.029m5.858.908a3 3 0 114.243 4.243M9.878 9.878l4.242 4.242M9.88 9.88l-3.29-3.29m7.532 7.532l3.29 3.29M3 3l3.59 3.59m0 0A9.953 9.953 0 0112 5c4.478 0 8.268 2.943 9.543 7a10.025 10.025 0 01-4.132 5.411m0 0L21 21'/%3E%3C/svg%3E");
}

/* ==========================================================================
   Button
   ========================================================================== */
.noqstock-auth__button {
	width: 100%;
	height: var(--button-height-md);
	padding: 0 var(--space-6);
	font-size: var(--font-size-base);
	font-weight: var(--font-weight-semibold);
	color: var(--color-bg-base);
	background: var(--color-accent);
	border: none;
	border-radius: var(--radius-md);
	cursor: pointer;
	transition: background var(--transition-normal) var(--ease-out),
	            transform var(--transition-fast) var(--ease-out);
}

.noqstock-auth__button:hover {
	background: var(--color-accent-hover);
}

.noqstock-auth__button:active {
	transform: scale(0.98);
}

.noqstock-auth__button:disabled {
	opacity: var(--opacity-disabled);
	cursor: not-allowed;
}

/* ==========================================================================
   Footer & Links
   ========================================================================== */
.noqstock-auth__footer {
	text-align: center;
	margin-top: var(--space-6);
	padding-top: var(--space-6);
	border-top: 1px solid var(--color-border);
}

.noqstock-auth__footer p {
	color: var(--color-text-muted);
	margin: 0;
}

.noqstock-auth__link {
	color: var(--color-accent);
	text-decoration: none;
	transition: color var(--transition-normal) var(--ease-out);
}

.noqstock-auth__link:hover {
	color: var(--color-accent-hover);
	text-decoration: underline;
}

/* ==========================================================================
   Options Row (Remember me & Forgot password)
   ========================================================================== */
.noqstock-auth__options {
	display: flex;
	justify-content: space-between;
	align-items: center;
	font-size: var(--font-size-sm);
}

.noqstock-auth__checkbox {
	display: flex;
	align-items: center;
	gap: var(--space-2);
	color: var(--color-text-muted);
	cursor: pointer;
}

.noqstock-auth__checkbox input[type="checkbox"] {
	width: 16px;
	height: 16px;
	accent-color: var(--color-accent);
}

/* ==========================================================================
   Honeypot (Hidden from users)
   ========================================================================== */
.noqstock-auth__hp {
	position: absolute !important;
	left: -9999px !important;
	top: -9999px !important;
}

/* ==========================================================================
   Status Icon (Verification Page)
   ========================================================================== */
.noqstock-auth__icon {
	display: flex;
	align-items: center;
	justify-content: center;
	width: var(--icon-xl);
	height: var(--icon-xl);
	margin: 0 auto var(--space-5);
	border-radius: var(--radius-full);
	background: var(--color-accent-subtle);
	color: var(--color-accent);
}

.noqstock-auth__icon--success {
	background: var(--color-success-bg);
	color: var(--color-success);
}

.noqstock-auth__icon--error {
	background: var(--color-error-bg);
	color: var(--color-error);
}

.noqstock-auth__icon--info {
	background: var(--color-accent-subtle);
	color: var(--color-accent);
}

/* ==========================================================================
   Message Box (Verification Page)
   ========================================================================== */
.noqstock-auth__message {
	text-align: center;
	padding: var(--space-4);
	margin-bottom: var(--space-6);
	border-radius: var(--radius-md);
	background: var(--color-overlay-lighter);
	border: 1px solid var(--color-border);
}

.noqstock-auth__message p {
	margin: 0;
	color: var(--color-text-muted);
	font-size: var(--font-size-base);
	line-height: var(--line-height-base);
}

.noqstock-auth__message p + p {
	margin-top: var(--space-2);
}

.noqstock-auth__message--success {
	background: var(--color-success-bg);
	border-color: var(--color-success-border);
}

.noqstock-auth__message--success p {
	color: var(--color-success);
}

.noqstock-auth__message--info {
	background: var(--color-accent-subtle-medium);
	border-color: var(--color-accent-border);
}

.noqstock-auth__hint {
	font-size: var(--font-size-sm);
	opacity: var(--opacity-hover);
}

/* ==========================================================================
   Divider
   ========================================================================== */
.noqstock-auth__divider {
	position: relative;
	text-align: center;
	margin: var(--space-6) 0;
}

.noqstock-auth__divider::before {
	content: "";
	position: absolute;
	top: 50%;
	left: 0;
	right: 0;
	height: 1px;
	background: var(--color-border);
}

.noqstock-auth__divider span {
	position: relative;
	background: var(--color-bg-surface);
	padding: 0 var(--space-4);
	color: var(--color-text-muted);
	font-size: var(--font-size-sm);
}

/* ==========================================================================
   Button Variants
   ========================================================================== */
a.noqstock-auth__button {
	display: flex;
	align-items: center;
	justify-content: center;
	text-decoration: none;
}

.noqstock-auth__button--secondary {
	background: transparent;
	color: var(--color-accent);
	border: 1px solid var(--color-accent);
}

.noqstock-auth__button--secondary:hover {
	background: var(--color-accent-subtle);
}

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 480px) {
	.noqstock-auth__card {
		padding: var(--space-8) var(--space-6);
	}

	.noqstock-auth__title {
		font-size: var(--font-size-xl);
	}

	.noqstock-auth__options {
		flex-direction: column;
		gap: var(--space-3);
		align-items: flex-start;
	}
}
