/* ==========================================================================
   Apexmart MLM System — Frontend Styles
   Covers: cards, forms, dashboard, profile, badges, buttons, utilities
   ========================================================================== */

/* ---- CSS Custom Properties ----------------------------------------------- */
:root {
	--am-primary:      #1e40af;
	--am-primary-dark: #1e3a8a;
	--am-green:        #10b981;
	--am-orange:       #f59e0b;
	--am-purple:       #8b5cf6;
	--am-danger:       #ef4444;
	--am-text:         #1e293b;
	--am-muted:        #64748b;
	--am-border:       #e2e8f0;
	--am-bg:           #f8fafc;
	--am-white:        #ffffff;
	--am-radius:       12px;
	--am-radius-sm:    8px;
	--am-shadow:       0 1px 4px rgba(0,0,0,.08), 0 4px 16px rgba(0,0,0,.04);
	--am-transition:   .18s ease;
}

/* ---- Base resets --------------------------------------------------------- */
.am-card,
.am-dashboard,
.am-panel {
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, sans-serif;
	color: var(--am-text);
	box-sizing: border-box;
}

.am-card *,
.am-dashboard *,
.am-panel * {
	box-sizing: border-box;
}

/* ========================================================================= */
/*  CARD                                                                       */
/* ========================================================================= */
.am-card {
	background: var(--am-white);
	border-radius: var(--am-radius);
	box-shadow: var(--am-shadow);
	overflow: hidden;
	max-width: 680px;
	margin: 24px auto;
}

.am-register-card,
.am-profile-card {
	max-width: 860px;
}

/* Card header */
.am-card-header {
	background: linear-gradient(135deg, var(--am-primary) 0%, var(--am-purple) 100%);
	padding: 28px 32px 24px;
	color: #fff;
	text-align: center;
}

.am-card-header .dashicons {
	font-size: 40px;
	width: 40px;
	height: 40px;
	margin-bottom: 8px;
}

.am-card-header h2 {
	margin: 0 0 6px;
	font-size: 22px;
	font-weight: 700;
	color: #fff;
}

.am-card-header p,
.am-card-header a {
	margin: 0;
	font-size: 14px;
	opacity: .85;
	color: #fff;
}

.am-card-footer {
	padding: 16px 32px;
	text-align: center;
	border-top: 1px solid var(--am-border);
	font-size: 14px;
	color: var(--am-muted);
}

.am-card-footer a {
	color: var(--am-primary);
	font-weight: 600;
}

/* ========================================================================= */
/*  FORMS                                                                      */
/* ========================================================================= */
.am-form {
	padding: 28px 32px;
}

.am-form-row {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 20px;
}

@media (max-width: 600px) {
	.am-form-row { grid-template-columns: 1fr; }
	.am-card,
	.am-card-header,
	.am-form,
	.am-card-footer { padding-left: 18px; padding-right: 18px; }
}

.am-field {
	display: flex;
	flex-direction: column;
	margin-bottom: 18px;
}

.am-field label {
	font-size: 13px;
	font-weight: 600;
	color: var(--am-muted);
	text-transform: uppercase;
	letter-spacing: .4px;
	margin-bottom: 6px;
}

.am-field input[type="text"],
.am-field input[type="email"],
.am-field input[type="tel"],
.am-field input[type="password"],
.am-field input[type="number"],
.am-field textarea,
.am-field select {
	width: 100%;
	padding: 10px 14px;
	border: 1.5px solid var(--am-border);
	border-radius: var(--am-radius-sm);
	font-size: 14px;
	color: var(--am-text);
	background: var(--am-bg);
	transition: border-color var(--am-transition), box-shadow var(--am-transition);
	outline: none;
}

.am-field input:focus,
.am-field textarea:focus {
	border-color: var(--am-primary);
	box-shadow: 0 0 0 3px rgba(30,64,175,.12);
	background: #fff;
}

.am-field textarea {
	resize: vertical;
	min-height: 90px;
}

.am-req { color: var(--am-danger); }

.am-hint {
	font-size: 11px;
	color: var(--am-muted);
	margin: 4px 0 0;
}

/* Password toggle */
.am-input-wrap {
	position: relative;
	display: flex;
}

.am-input-wrap input {
	flex: 1;
	padding-right: 42px !important;
}

.am-toggle-pw {
	position: absolute;
	right: 0;
	top: 0;
	bottom: 0;
	width: 40px;
	background: none;
	border: none;
	cursor: pointer;
	color: var(--am-muted);
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0;
	transition: color var(--am-transition);
}

.am-toggle-pw:hover { color: var(--am-primary); }

/* Password strength bar */
.am-pw-strength {
	height: 4px;
	background: var(--am-border);
	border-radius: 99px;
	margin-top: 6px;
	overflow: hidden;
}

.am-pw-bar {
	height: 100%;
	width: 0;
	border-radius: 99px;
	transition: width .3s, background .3s;
}

/* Checkbox row */
.am-field-check {
	flex-direction: row;
	align-items: center;
}

.am-field-check label {
	text-transform: none;
	font-size: 14px;
	font-weight: 400;
	color: var(--am-text);
	cursor: pointer;
}

/* File input */
.am-file-input {
	position: absolute;
	width: 1px;
	height: 1px;
	opacity: 0;
	overflow: hidden;
	clip: rect(0,0,0,0);
}

.am-field-upload .am-btn { margin-top: 8px; }

.am-photo-wrap {
	display: flex;
	align-items: center;
	gap: 20px;
	margin-bottom: 16px;
}

.am-photo-placeholder {
	width: 80px;
	height: 80px;
	border-radius: 50%;
	background: var(--am-bg);
	border: 2px dashed var(--am-border);
	display: flex;
	align-items: center;
	justify-content: center;
	color: var(--am-muted);
}

.am-photo-placeholder .dashicons {
	font-size: 28px;
	width: 28px;
	height: 28px;
}

.am-photo-preview {
	width: 80px;
	height: 80px;
	border-radius: 50%;
	object-fit: cover;
	border: 3px solid var(--am-primary);
}

.am-current-file {
	margin-bottom: 8px;
}

/* Form section heading */
.am-section {
	border-top: 1px solid var(--am-border);
	padding-top: 24px;
	margin-top: 8px;
}

.am-section-title {
	display: flex;
	align-items: center;
	gap: 8px;
	font-size: 16px;
	font-weight: 700;
	color: var(--am-text);
	margin: 0 0 20px;
	flex-wrap: wrap;
}

.am-section-title .dashicons {
	font-size: 18px;
	width: 18px;
	height: 18px;
	color: var(--am-primary);
}

.am-kyc-status-label { margin-left: auto; font-size: 13px; }

.am-form-actions {
	display: flex;
	gap: 12px;
	align-items: center;
	padding-top: 20px;
	border-top: 1px solid var(--am-border);
	margin-top: 8px;
}

/* ========================================================================= */
/*  BUTTONS                                                                    */
/* ========================================================================= */
.am-btn {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 10px 20px;
	border-radius: var(--am-radius-sm);
	font-size: 14px;
	font-weight: 600;
	cursor: pointer;
	border: 1.5px solid transparent;
	transition: background var(--am-transition), color var(--am-transition), border-color var(--am-transition), transform var(--am-transition);
	text-decoration: none;
	line-height: 1;
}

.am-btn:active { transform: scale(.97); }

.am-btn-primary {
	background: var(--am-primary);
	color: #fff !important;
	border-color: var(--am-primary);
}
.am-btn-primary:hover { background: var(--am-primary-dark); border-color: var(--am-primary-dark); }

.am-btn-outline {
	background: transparent;
	color: var(--am-primary) !important;
	border-color: var(--am-primary);
}
.am-btn-outline:hover { background: var(--am-primary); color: #fff !important; }

.am-btn-ghost {
	background: transparent;
	color: var(--am-muted) !important;
	border-color: var(--am-border);
}
.am-btn-ghost:hover { background: var(--am-bg); }

.am-btn-full { width: 100%; justify-content: center; padding: 13px; font-size: 15px; }

.am-btn-sm { padding: 6px 14px; font-size: 13px; }

/* Spinner inside button */
.am-spinner {
	display: inline-block;
	width: 16px;
	height: 16px;
	border: 2px solid rgba(255,255,255,.4);
	border-top-color: #fff;
	border-radius: 50%;
	animation: am-spin .7s linear infinite;
}

@keyframes am-spin { to { transform: rotate(360deg); } }

.am-copy-btn {
	background: var(--am-bg);
	border: 1.5px solid var(--am-border);
	color: var(--am-muted) !important;
}
.am-copy-btn:hover { background: var(--am-primary); color: #fff !important; border-color: var(--am-primary); }

/* ========================================================================= */
/*  NOTICES                                                                    */
/* ========================================================================= */
.am-msg {
	padding: 12px 16px;
	border-radius: var(--am-radius-sm);
	margin: 16px 32px 0;
	font-size: 14px;
	font-weight: 500;
}

.am-msg.am-success { background: #d1fae5; color: #065f46; border: 1px solid #6ee7b7; }
.am-msg.am-error   { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }

.am-notice {
	padding: 12px 16px;
	border-radius: var(--am-radius-sm);
	font-size: 14px;
	font-weight: 500;
}

.am-notice-info    { background: #dbeafe; color: #1e40af; border: 1px solid #93c5fd; }
.am-notice-warning { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }

/* ========================================================================= */
/*  BADGES                                                                     */
/* ========================================================================= */
.am-badge {
	display: inline-block;
	padding: 3px 10px;
	border-radius: 999px;
	font-size: 11px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: .4px;
}

.am-badge-success { background: #d1fae5; color: #065f46; }
.am-badge-danger  { background: #fee2e2; color: #991b1b; }
.am-badge-warning { background: #fef3c7; color: #92400e; }
.am-badge-info    { background: #dbeafe; color: #1e40af; }

/* ========================================================================= */
/*  DASHBOARD                                                                  */
/* ========================================================================= */
.am-dashboard {
	padding: 0;
}

/* Welcome banner */
.am-welcome-banner {
	background: linear-gradient(135deg, var(--am-primary) 0%, var(--am-purple) 100%);
	border-radius: var(--am-radius);
	padding: 24px 28px;
	margin-bottom: 24px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	flex-wrap: wrap;
	color: #fff;
}

.am-welcome-left {
	display: flex;
	align-items: center;
	gap: 16px;
}

.am-welcome-left h2 {
	margin: 0 0 4px;
	font-size: 20px;
	font-weight: 700;
	color: #fff;
}

.am-welcome-left p {
	margin: 0;
	font-size: 14px;
	opacity: .85;
}

.am-welcome-right {
	display: flex;
	gap: 10px;
}

.am-avatar {
	width: 64px;
	height: 64px;
	border-radius: 50%;
	overflow: hidden;
	border: 3px solid rgba(255,255,255,.4);
	flex-shrink: 0;
}

.am-avatar-img {
	width: 64px;
	height: 64px;
	object-fit: cover;
	display: block;
}

.am-avatar-placeholder {
	background: rgba(255,255,255,.15);
	display: flex;
	align-items: center;
	justify-content: center;
}

.am-avatar-placeholder .dashicons {
	font-size: 30px;
	width: 30px;
	height: 30px;
	color: rgba(255,255,255,.8);
}

/* Stats grid */
.am-stats-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
	gap: 16px;
	margin-bottom: 24px;
}

.am-stat-card {
	background: var(--am-white);
	border-radius: var(--am-radius);
	padding: 20px 18px;
	display: flex;
	align-items: center;
	gap: 16px;
	box-shadow: var(--am-shadow);
	border-left: 4px solid transparent;
	transition: transform var(--am-transition);
}

.am-stat-card:hover { transform: translateY(-2px); }

.am-card-green  { border-left-color: var(--am-green); }
.am-card-blue   { border-left-color: var(--am-primary); }
.am-card-orange { border-left-color: var(--am-orange); }
.am-card-purple { border-left-color: var(--am-purple); }

.am-stat-icon .dashicons {
	font-size: 30px;
	width: 30px;
	height: 30px;
}

.am-card-green  .am-stat-icon .dashicons { color: var(--am-green); }
.am-card-blue   .am-stat-icon .dashicons { color: var(--am-primary); }
.am-card-orange .am-stat-icon .dashicons { color: var(--am-orange); }
.am-card-purple .am-stat-icon .dashicons { color: var(--am-purple); }

.am-stat-body {
	display: flex;
	flex-direction: column;
	gap: 2px;
}

.am-stat-value {
	font-size: 20px;
	font-weight: 700;
	color: var(--am-text);
}

.am-stat-label {
	font-size: 12px;
	color: var(--am-muted);
	font-weight: 500;
	text-transform: uppercase;
	letter-spacing: .4px;
}

/* Dashboard lower grid */
.am-dash-grid {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 20px;
}

@media (max-width: 768px) {
	.am-dash-grid { grid-template-columns: 1fr; }
	.am-welcome-banner { flex-direction: column; align-items: flex-start; }
}

/* ========================================================================= */
/*  PANEL (dashboard panels)                                                   */
/* ========================================================================= */
.am-panel {
	background: var(--am-white);
	border-radius: var(--am-radius);
	box-shadow: var(--am-shadow);
	overflow: hidden;
}

.am-panel-header {
	background: var(--am-bg);
	border-bottom: 1px solid var(--am-border);
	padding: 14px 20px;
}

.am-panel-header h3 {
	margin: 0;
	font-size: 15px;
	font-weight: 700;
	color: var(--am-text);
}

.am-panel-body {
	padding: 20px;
}

/* Profile completion SVG chart */
.am-completion-circle-wrap {
	display: flex;
	justify-content: center;
	margin: 8px 0;
}

.am-circle-chart {
	width: 130px;
	height: 130px;
	transform: rotate(-90deg);
}

.am-circle-bg {
	fill: none;
	stroke: var(--am-border);
	stroke-width: 3;
}

.am-circle-fill {
	fill: none;
	stroke: var(--am-primary);
	stroke-width: 3;
	stroke-linecap: round;
	transition: stroke-dasharray .6s ease;
}

.am-circle-text {
	fill: var(--am-text);
	font-size: 8px;
	font-weight: 700;
	text-anchor: middle;
	transform: rotate(90deg) translate(0, -35px);
}

/* Referral box */
.am-referral-box { margin-bottom: 4px; }
.am-referral-box label { font-size: 12px; font-weight: 600; color: var(--am-muted); text-transform: uppercase; letter-spacing: .4px; margin-bottom: 6px; display: block; }

.am-referral-code-wrap {
	display: flex;
	align-items: center;
	gap: 8px;
	background: var(--am-bg);
	border: 1px solid var(--am-border);
	border-radius: var(--am-radius-sm);
	padding: 8px 12px;
}

.am-referral-code {
	font-family: monospace;
	font-size: 16px;
	font-weight: 700;
	color: var(--am-primary);
	letter-spacing: 2px;
}

.am-referral-link {
	font-size: 12px;
	color: var(--am-muted);
	word-break: break-all;
	flex: 1;
}

.am-referral-summary {
	display: flex;
	gap: 16px;
}

.am-ref-stat {
	flex: 1;
	background: var(--am-bg);
	border-radius: var(--am-radius-sm);
	padding: 12px;
	display: flex;
	flex-direction: column;
	gap: 4px;
}

.am-ref-stat span { font-size: 12px; color: var(--am-muted); }
.am-ref-stat strong { font-size: 15px; color: var(--am-text); }

/* Progress bar (admin) */
.am-progress-bar {
	width: 80px;
	height: 6px;
	background: var(--am-border);
	border-radius: 99px;
	overflow: hidden;
	display: inline-block;
	vertical-align: middle;
	margin-right: 4px;
}
.am-progress-fill { height: 100%; background: var(--am-primary); border-radius: 99px; }

/* Admin detail table */
.am-detail-table {
	width: 100%;
	border-collapse: collapse;
}
.am-detail-table th {
	text-align: left;
	font-size: 12px;
	font-weight: 600;
	color: var(--am-muted);
	text-transform: uppercase;
	letter-spacing: .4px;
	padding: 10px 14px 10px 0;
	width: 38%;
	border-bottom: 1px solid var(--am-border);
}
.am-detail-table td {
	font-size: 14px;
	padding: 10px 0;
	border-bottom: 1px solid var(--am-border);
}
.am-detail-table tr:last-child th,
.am-detail-table tr:last-child td { border-bottom: none; }
