/* ====================================================
   KSC Auth & Dashboard - Standalone CSS
   Không phụ thuộc vào theme hay WooCommerce
   ==================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

/* ---- AUTH PAGE ---- */
.ksc-auth-page {
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 40px 16px;
	font-family: 'Inter', sans-serif;
}

.ksc-auth-card {
	background: #fff;
	border-radius: 20px;
	border: 1.5px solid #eaeaef;
	padding: 44px 44px 36px;
	width: 100%;
	max-width: 480px;
}

/* Tabs - hidden, kept for JS compat */
.ksc-auth-tabs {
	display: none;
}

/* Panels */
.ksc-auth-panel {
	display: none;
}
.ksc-auth-panel.active {
	display: block;
}

/* Header - centered like style 2 */
.ksc-auth-header {
	text-align: center;
	margin-bottom: 28px;
}
.ksc-auth-title {
	font-size: 28px !important;
	font-weight: 800 !important;
	color: #1a1a2e !important;
	margin: 0 0 6px !important;
	padding: 0 !important;
	border: none !important;
	line-height: 1.3 !important;
}
.ksc-auth-subtitle {
	font-size: 14px;
	color: #7a7a8c;
	margin: 0;
}

/* Form */
.ksc-form-group {
	margin-bottom: 18px;
}
.ksc-form-label {
	display: block;
	font-weight: 600;
	font-size: 14px;
	color: #1a1a2e;
	margin-bottom: 8px;
}
.ksc-form-input {
	width: 100%;
	padding: 14px 16px;
	border-radius: 30px;
	border: none;
	background: #f4f5f7;
	font-size: 15px;
	color: #1e293b;
	outline: none;
	transition: background-color 0.2s, box-shadow 0.2s;
	box-sizing: border-box;
	font-family: 'Inter', sans-serif;
}
.ksc-form-input:focus {
	background: #ffffff;
	box-shadow: 0 0 0 2px rgba(218, 37, 29, 0.1);
}
.ksc-form-input::placeholder {
	color: #b0b3c1;
}

/* Password field */
.ksc-input-password-wrap {
	position: relative;
}
.ksc-input-password-wrap .ksc-form-input {
	padding-right: 48px;
}
.ksc-toggle-password {
	position: absolute;
	right: 14px;
	top: 50%;
	transform: translateY(-50%);
	background: none;
	border: none;
	cursor: pointer;
	color: #b0b3c1;
	padding: 0;
	display: flex;
	align-items: center;
	transition: color 0.2s;
}
.ksc-toggle-password:hover {
	color: #7a7a8c;
}

/* Remember + Forgot */
.ksc-form-row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 20px;
}
.ksc-form-checkbox {
	display: flex;
	align-items: center;
	gap: 8px;
	font-size: 14px;
	color: #4a4a5a;
	cursor: pointer;
}
.ksc-form-checkbox input[type="checkbox"] {
	width: 16px;
	height: 16px;
	accent-color: #da251d;
}
.ksc-forgot-link {
	font-size: 14px;
	font-weight: 600;
	color: #1a1a2e;
	text-decoration: underline;
}
.ksc-forgot-link:hover {
	color: #da251d;
}

/* Main CTA Button */
.ksc-auth-btn {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	width: 100%;
	padding: 16px;
	background: linear-gradient(135deg, #da251d, #da251d);
	color: #fff;
	border: none;
	border-radius: 14px;
	font-size: 16px;
	font-weight: 700;
	cursor: pointer;
	transition: all 0.25s ease;
	font-family: 'Inter', sans-serif;
	letter-spacing: 0.3px;
}
.ksc-auth-btn:hover {
	background: linear-gradient(135deg, #d44e16, #e8712e);
	transform: translateY(-1px);
	box-shadow: 0 6px 20px rgba(237, 90, 30, 0.35);
}
.ksc-auth-btn:active {
	transform: translateY(0);
}
.ksc-auth-btn:disabled {
	opacity: 0.7;
	cursor: not-allowed;
	transform: none;
}
.ksc-btn-small {
	border-radius: 30px;
	width: auto;
	padding: 12px 28px;
}

/* Spinner animation */
@keyframes ksc-spin {
	to { transform: rotate(360deg); }
}
.ksc-spin {
	animation: ksc-spin 0.8s linear infinite;
}

/* Divider */
.ksc-auth-divider {
	display: flex;
	align-items: center;
	gap: 12px;
	margin: 20px 0;
	color: #b0b3c1;
	font-size: 13px;
}
.ksc-auth-divider::before,
.ksc-auth-divider::after {
	content: '';
	flex: 1;
	height: 1px;
	background: #e8e8f0;
}

/* Google Button */
.ksc-google-btn {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
	width: 100%;
	padding: 14px;
	background: #fff;
	border: 1.5px solid #e0e0eb;
	border-radius: 14px;
	font-size: 15px;
	font-weight: 600;
	color: #1a1a2e;
	cursor: pointer;
	text-decoration: none;
	transition: all 0.2s ease;
	box-sizing: border-box;
	font-family: 'Inter', sans-serif;
}
.ksc-google-btn:hover {
	border-color: #4285F4;
	background: #f8fbff;
	box-shadow: 0 2px 12px rgba(66,133,244,0.12);
	color: #1a1a2e;
	text-decoration: none;
}
.ksc-google-disabled {
	opacity: 0.5;
	cursor: not-allowed;
	pointer-events: none;
}

/* Switch link */
.ksc-auth-switch {
	text-align: center;
	margin-top: 20px;
	font-size: 14px;
	color: #7a7a8c;
}
.ksc-auth.ksc-switch-tab {
	color: #da251d;
	font-weight: 600;
	cursor: pointer;
}

/* Dashboard Tabs */
.ksc-dash-tab-content {
	display: none;
	animation: kscFadeIn 0.3s ease;
}
.ksc-dash-tab-content.active {
	border: 1px solid #e1e1e1;
	display: block;
	padding: 20px;
	background: #ffffff;
	border-radius: 15px;
}
@keyframes kscFadeIn {
	from { opacity: 0; transform: translateY(5px); }
	to { opacity: 1; transform: translateY(0); }
}

.ksc-auth-switch a {
	color: #da251d;
	font-weight: 700;
	text-decoration: none;
}
.ksc-auth-switch a:hover {
	text-decoration: underline;
}

/* Back link (← Quay lại) */
.ksc-back-link {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	color: #7a7a8c !important;
	font-weight: 500 !important;
}
.ksc-back-link:hover {
	color: #da251d !important;
}

/* Forgot icon */
.ksc-forgot-icon {
	width: 64px;
	height: 64px;
	background: #fff7f0;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	margin: 0 auto 16px;
	color: #da251d;
}

/* Alerts */
.ksc-auth-alert {
	padding: 12px 16px;
	border-radius: 10px;
	font-size: 14px;
	margin-bottom: 16px;
}
.ksc-alert-error {
	background: #fff1f0;
	color: #c0392b;
	border-left: 4px solid #e74c3c;
}
.ksc-alert-success {
	background: #f0fdf4;
	color: #166534;
	border-left: 4px solid #22c55e;
}

/* Desktop: hide mobile-only elements */
.ksc-mobile-only { display: none; }

/* ===================================================
   DASHBOARD
   =================================================== */
.ksc-dashboard-wrap {
    display: flex;
    gap: 28px;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px 0;
    font-family: 'Inter', sans-serif;
    align-items: flex-start;
}

/* Sidebar */
.ksc-dashboard-sidebar {
	width: 260px;
	flex-shrink: 0;
	background: #f6f6f6;
	border-radius: 16px;
	padding: 24px 16px;
}
.ksc-dashboard-user {
	display: flex;
	flex-direction: column;
	align-items: center;
	text-align: center;
	margin-bottom: 24px;
}
.ksc-user-avatar {
	width: 56px;
	height: 56px;
	border-radius: 50%;
	overflow: hidden;
	background: linear-gradient(135deg, #da251d, #da251d);
	display: flex;
	align-items: center;
	justify-content: center;
	margin-bottom: 12px;
}
.ksc-user-avatar img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}
.ksc-avatar-initials {
	font-size: 24px;
	font-weight: 800;
	color: #fff;
}
.ksc-user-label {
	font-size: 11px;
	text-transform: uppercase;
	letter-spacing: 0.5px;
	color: #64748b;
	font-weight: 700;
	margin-bottom: 4px;
}
.ksc-user-info strong {
	display: block;
	font-size: 16px;
	color: #1e293b;
	font-weight: 700;
}
.ksc-user-info span {
	display: none; /* Hide email for cleaner look */
}

/* Nav */
.ksc-dashboard-nav {
	display: flex;
	flex-direction: column;
	gap: 8px;
}
.ksc-dashboard-nav .ksc-nav-item {
	display: flex;
	flex-direction: row;
	align-items: center;
	gap: 12px;
	padding: 8px 20px;
	color: #475569;
	font-size: 14px;
	font-weight: 600;
	text-decoration: none;
	border: none;
	background: transparent;
	width: 100%;
	text-align: left;
	cursor: pointer;
	border-radius: 99px;
	transition: all 0.2s;
	font-family: 'Inter', sans-serif;
}
.ksc-dashboard-nav .ksc-nav-item:hover {
	color: #da251d;
	background: #f1f5f9;
}
.ksc-dashboard-nav .ksc-nav-item.active {
	background: #da251d;
	color: #fff;
}
.ksc-dashboard-nav .ksc-nav-item svg {
	flex-shrink: 0;
}
.ksc-dashboard-nav .ksc-nav-divider {
	height: 1px;
	background: #e2e8f0;
	margin: 16px 0;
}
.ksc-dashboard-nav .ksc-nav-logout {
	color: #ef4444;
	border: 1px solid #fca5a5;
	background: #fff;
	justify-content: center;
}
.ksc-nav-logout:hover {
	background: #fef2f2;
	border-color: #ef4444;
}

/* Main area */
.ksc-dashboard-main {
	flex: 1;
	min-width: 0;
}
.ksc-dash-section {
	background: transparent;
}
.ksc-dash-title {
	font-size: 20px !important;
	font-weight: 700 !important;
	color: #1e293b !important;
	margin: 0 0 24px !important;
	padding: 0 !important;
	border: none !important;
}
.ksc-dash-form {
	max-width: 100%;
}
.ksc-form-row-2 {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 16px;
}

/* Orders table */
.ksc-orders-table-wrap {
	overflow-x: auto;
	background: #fff;
	border: 1px solid #f1f5f9;
	border-radius: 12px;
}
.ksc-orders-table {
	width: 100%;
	border-collapse: collapse;
	font-size: 14px;
}
.ksc-orders-table th {
	text-align: left;
	padding: 16px 20px;
	font-weight: 700;
	color: #1e293b;
	background: #f8f9fa;
	border-bottom: 1px solid #e2e8f0;
	text-transform: uppercase;
	font-size: 12px;
	letter-spacing: 0.5px;
}
.ksc-orders-table td {
	padding: 16px 20px;
	color: #475569;
	border-bottom: 1px solid #f1f5f9;
}
.ksc-orders-table tr:last-child td {
	border-bottom: none;
}
.ksc-orders-table tbody tr:hover {
	background: #f8fafc;
}

.ksc-order-status {
	padding: 4px 12px;
	border-radius: 20px;
	font-size: 12px;
	font-weight: 600;
	display: inline-block;
}
.ksc-status-processing { background: #eff6ff; color: #3b82f6; }
.ksc-status-completed { background: #f0fdf4; color: #22c55e; }
.ksc-status-on-hold { background: #fffbeb; color: #f59e0b; }
.ksc-status-cancelled { background: #fef2f2; color: #ef4444; }
.ksc-status-pending { background: #f8fafc; color: #64748b; }

/* Modal */
.ksc-modal-overlay {
	position: fixed;
	top: 0; left: 0; right: 0; bottom: 0;
	background: rgba(15, 23, 42, 0.4);
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 99999;
	backdrop-filter: blur(2px);
}
.ksc-modal-box {
	background: #fff;
	width: 100%;
	max-width: 400px;
	border-radius: 20px;
	padding: 32px 24px;
	text-align: center;
	box-shadow: 0 10px 40px rgba(0,0,0,0.1);
	animation: kscModalPop 0.3s ease-out;
}
@keyframes kscModalPop {
	0% { opacity: 0; transform: scale(0.95) translateY(10px); }
	100% { opacity: 1; transform: scale(1) translateY(0); }
}
.ksc-modal-icon {
	width: 64px;
	height: 64px;
	background: #fef2f2;
	color: #dc2626;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	margin: 0 auto 20px;
}
.ksc-modal-title {
	font-size: 20px;
	font-weight: 700;
	color: #1e293b;
	margin: 0 0 12px;
}
.ksc-modal-desc {
	font-size: 14px;
	color: #64748b;
	margin: 0 0 28px;
	line-height: 1.5;
}
.ksc-modal-actions {
	display: flex;
	gap: 12px;
}
.ksc-modal-btn {
	flex: 1;
	padding: 12px;
	border-radius: 12px;
	font-size: 14px;
	font-weight: 600;
	cursor: pointer;
	border: none;
	transition: all 0.2s;
}
.ksc-btn-cancel {
	border-radius: 30px;
	background: #f1f5f9;
	color: #475569;
}
.ksc-btn-cancel:hover {
	background: #e2e8f0;
}
.ksc-btn-confirm {
	border-radius: 30px;
	background: #dc2626;
	color: #fff;
}
.ksc-btn-confirm:hover {
	background: #b91c1c;
}

.ksc-order-view-btn {
	color: #da251d;
	font-weight: 600;
	text-decoration: none;
	transition: all 0.2s;
	background: transparent;
	border: none;
	cursor: pointer;
	padding: 0;
	font-size: 14px;
}
.ksc-order-view-btn:hover { text-decoration: underline; }

/* Empty state */
.ksc-empty-state {
	text-align: center;
	padding: 48px 20px;
	color: #9898a8;
}
.ksc-empty-state svg { margin-bottom: 16px; }
.ksc-empty-state p { font-size: 15px; margin-bottom: 20px; }
.ksc-empty-state .ksc-auth-btn { display: inline-flex; width: auto; }

/* Address */
.ksc-address-card {
	background: #f8f8fc;
	border-radius: 12px;
	padding: 20px;
	margin-top: 16px;
	font-size: 15px;
	color: #1a1a2e;
}
.ksc-text-muted { color: #9898a8; }

/* Responsive */
@media (max-width: 768px) {
	.ksc-auth-card {
		padding: 24px 16px;
	}
	.ksc-dashboard-wrap {
		flex-direction: column;
		padding: 0;
		gap: 0;
	}
	.ksc-dashboard-main {
		padding: 20px 16px;
		padding-bottom: 100px;
		width: 100%;
		box-sizing: border-box;
	}
	.ksc-dashboard-sidebar {
		width: 100%;
		padding: 16px 16px 0;
		border-radius: 0;
		background: transparent;
	}
	.ksc-dashboard-user {
		margin-bottom: 0;
		background: #f1f5f9;
		border-radius: 16px;
		padding: 20px 16px;
	}
	.ksc-dashboard-user img {
		width: 60px;
		height: 60px;
	}
	.ksc-mobile-bottom-nav {
		display: none !important;
	}
	body {
		padding-bottom: 80px; /* Nhường chỗ cho menu bottom */
	}
	.ksc-dashboard-nav {
		position: fixed;
		bottom: 0;
		left: 0;
		width: 100%;
		background: #fff;
		flex-direction: row;
		justify-content: space-around;
		padding: 10px 5px;
		padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
		box-shadow: 0 -4px 20px rgba(0,0,0,0.08);
		border-radius: 24px 24px 0 0;
		z-index: 9999;
		margin: 0;
		gap: 0;
		overflow: hidden;
	}
	.ksc-dashboard-nav::-webkit-scrollbar {
		display: none;
	}
	.ksc-dashboard-nav .ksc-nav-item {
		flex-direction: column;
		padding: 5px 2px;
		font-size: 11px;
		gap: 4px;
		text-align: center;
		justify-content: flex-start;
		color: #64748b;
		background: transparent;
		border-radius: 0;
		width: 20%;
		white-space: normal;
		line-height: 1.2;
		font-weight: 400;
	}
	.ksc-dashboard-nav .ksc-nav-item svg {
		width: 22px;
		height: 22px;
	}
	.ksc-dashboard-nav .ksc-nav-item.active {
		background: transparent;
		color: #da251d;
	}
	.ksc-dashboard-nav .ksc-nav-item:hover {
		background: transparent;
		color: #da251d;
	}
	.ksc-dashboard-nav .ksc-nav-divider {
		display: none;
	}
	.ksc-dashboard-nav .ksc-nav-logout {
		border: none;
		color: #ef4444;
	}
	.ksc-desktop-only {
		display: none !important;
	}
	.ksc-mobile-only {
		display: block;
	}
	.ksc-mobile-logout-wrap {
		margin-top: 24px;
		padding-top: 20px;
		border-top: 1px solid #f1f5f9;
	}
	.ksc-mobile-logout-btn {
		display: flex;
		align-items: center;
		gap: 10px;
		width: 100%;
		padding: 14px 20px;
		border: 1.5px solid #fca5a5;
		border-radius: 99px;
		background: #fff;
		color: #ef4444;
		font-size: 15px;
		font-weight: 700;
		cursor: pointer;
		justify-content: center;
		font-family: 'Inter', sans-serif;
	}
	.ksc-dash-section {
		padding: 0;
		background: transparent;
		box-shadow: none;
	}
	/* Address & Profile: 1 column layout on mobile */
	.ksc-form-row-2 {
		grid-template-columns: 1fr;
	}
	/* Full-width buttons on mobile */
	.ksc-auth-btn.ksc-btn-small {
		width: 100%;
		text-align: center;
		justify-content: center;
	}

	/* ── Orders: Card layout on mobile ── */
	.ksc-orders-table-wrap {
		background: transparent;
		border: none;
		border-radius: 0;
		overflow: visible;
	}
	.ksc-orders-table,
	.ksc-orders-table thead,
	.ksc-orders-table tbody,
	.ksc-orders-table tr,
	.ksc-orders-table th,
	.ksc-orders-table td {
		display: block;
		width: 100%;
	}
	.ksc-orders-table thead {
		display: none;
	}
	.ksc-orders-table tbody tr {
		background: #fff;
		border: 1px solid #e8ecf0;
		border-radius: 14px;
		margin-bottom: 16px;
		padding: 6px 16px;
		position: relative;
	}
	.ksc-orders-table td {
		display: flex;
		justify-content: space-between;
		align-items: center;
		padding: 12px 0;
		border-bottom: 1px dashed #e8ecf0;
		font-size: 14px;
		color: #1e293b;
		text-align: right;
	}
	.ksc-orders-table td:last-child {
		border-bottom: none;
		position: static;
	}
	.ksc-orders-table td::before {
		content: attr(data-label);
		font-size: 11px;
		font-weight: 700;
		letter-spacing: 0.5px;
		text-transform: uppercase;
		color: #94a3b8;
		text-align: left;
		flex-shrink: 0;
		margin-right: 12px;
	}
	/* Mã đơn row: order number bold left, "Xem chi tiết" blue right */
	.ksc-orders-table td:first-child {
		padding-top: 14px;
	}
	.ksc-orders-table td:first-child strong {
		font-size: 16px;
	}
	/* Xem chi tiết button */
	.ksc-orders-table td[data-label=""] {
		justify-content: flex-end;
		padding-top: 0;
		margin-top: -8px;
		border-bottom: none;
	}
	.ksc-orders-table td[data-label=""]::before {
		display: none;
	}
	.ksc-order-view-btn {
		background: transparent !important;
		color: #2563eb !important;
		border: none !important;
		padding: 0 !important;
		font-size: 13px !important;
		text-decoration: underline;
		cursor: pointer;
	}
	.ksc-order-status {
		font-size: 12px;
		padding: 4px 12px;
		border-radius: 20px;
	}
}
