/* WPLM Admin Styles */

.wplm-wrap h1 {
	margin-bottom: 16px;
}

/* Summary cards */
.wplm-cards {
	display: flex;
	gap: 16px;
	margin-bottom: 24px;
	flex-wrap: wrap;
}

.wplm-card {
	background: #fff;
	border: 1px solid #dcdcde;
	border-radius: 4px;
	padding: 20px 24px;
	min-width: 140px;
	display: flex;
	flex-direction: column;
	align-items: center;
}

.wplm-card__num {
	font-size: 32px;
	font-weight: 700;
	color: #1d2327;
	line-height: 1;
}

.wplm-card__label {
	font-size: 12px;
	color: #646970;
	margin-top: 6px;
	text-align: center;
}

/* Quick actions */
.wplm-quick-actions {
	margin-bottom: 20px;
	display: flex;
	gap: 8px;
}

/* Form box (new item inline form) */
.wplm-form-box {
	background: #fff;
	border: 1px solid #dcdcde;
	border-radius: 4px;
	padding: 20px 24px;
	margin-bottom: 20px;
}

.wplm-form-box h2 {
	margin-top: 0;
}

/* Status badges */
.wplm-badge {
	display: inline-block;
	padding: 2px 8px;
	border-radius: 12px;
	font-size: 11px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.5px;
}

.wplm-badge--active    { background: #d1fae5; color: #065f46; }
.wplm-badge--expired   { background: #fee2e2; color: #991b1b; }
.wplm-badge--suspended { background: #fef3c7; color: #92400e; }
.wplm-badge--cancelled { background: #f3f4f6; color: #374151; }
.wplm-badge--invalid   { background: #fee2e2; color: #991b1b; }

/* Row actions */
.wplm-row-actions {
	display: flex;
	gap: 4px;
	flex-wrap: wrap;
}

/* Generated key display */
.wplm-key-result {
	background: #f0fdf4;
	border: 1px solid #86efac;
	border-radius: 4px;
	padding: 16px 20px;
	margin-top: 16px;
}

.wplm-key-result code {
	font-size: 20px;
	letter-spacing: 2px;
	display: inline-block;
	margin-right: 12px;
	padding: 8px 12px;
	background: #fff;
	border: 1px solid #d1fae5;
	border-radius: 4px;
}

/* Modal overlay */
.wplm-modal {
	position: fixed;
	inset: 0;
	background: rgba(0,0,0,0.5);
	z-index: 100000;
	display: flex;
	align-items: center;
	justify-content: center;
}

.wplm-modal__inner {
	background: #fff;
	border-radius: 6px;
	padding: 28px 32px;
	min-width: 420px;
	max-width: 560px;
	width: 100%;
	position: relative;
}

.wplm-modal__inner h2 {
	margin-top: 0;
}

/* Portal (frontend) */
.wplm-portal {
	max-width: 800px;
}

.wplm-portal h2 {
	margin-bottom: 8px;
}

.wplm-portal-table {
	width: 100%;
	border-collapse: collapse;
	margin-top: 16px;
}

.wplm-portal-table th,
.wplm-portal-table td {
	padding: 10px 14px;
	text-align: left;
	border-bottom: 1px solid #e5e7eb;
}

.wplm-portal-table th {
	background: #f9fafb;
	font-weight: 600;
	font-size: 12px;
	text-transform: uppercase;
	letter-spacing: 0.5px;
	color: #6b7280;
}

.wplm-portal input[type="email"] {
	padding: 8px 12px;
	border: 1px solid #d1d5db;
	border-radius: 4px;
	font-size: 15px;
	width: 280px;
}

.wplm-portal-notice {
	background: #f0fdf4;
	border: 1px solid #86efac;
	border-radius: 4px;
	padding: 10px 14px;
	margin-bottom: 16px;
}

.wplm-portal-notice--error {
	background: #fef2f2;
	border-color: #fca5a5;
}

.wplm-portal-tabs__nav {
	display: flex;
	gap: 4px;
	border-bottom: 1px solid #e5e7eb;
	margin-bottom: 20px;
}

.wplm-portal-tab-btn {
	background: none;
	border: none;
	padding: 10px 16px;
	font-size: 14px;
	color: #6b7280;
	cursor: pointer;
	border-bottom: 2px solid transparent;
}

.wplm-portal-tab-btn:hover {
	color: #1d2327;
}

.wplm-portal-tab-btn.is-active {
	color: #1d2327;
	font-weight: 600;
	border-bottom-color: #2563eb;
}

.wplm-portal-account__form {
	margin-bottom: 18px;
}

.wplm-portal-account__form > * {
	margin-bottom: 14px;
}

.wplm-portal-account__form > *:last-child {
	margin-bottom: 0;
}

.wplm-portal-account__form label {
	display: block;
	font-weight: 600;
	font-size: 13px;
	margin-bottom: 6px;
}

.wplm-portal-account__form .description {
	margin: 6px 0 0 0;
}

.wplm-portal-account__form input[type="text"],
.wplm-portal-account__form input[type="email"],
.wplm-portal-account__form select,
.wplm-portal-account__form textarea {
	display: block;
	width: 100%;
	padding: 11px 14px;
	border: 1px solid #334155;
	border-radius: 6px;
	font-size: 14px;
	font-family: inherit;
	color: #f8fafc;
	background-color: #1e293b;
	box-sizing: border-box;
	transition: border-color 0.15s, box-shadow 0.15s;
}

.wplm-portal-account__form textarea {
	min-height: 140px;
	resize: vertical;
}

.wplm-portal-account__form select {
	appearance: none;
	-webkit-appearance: none;
	-moz-appearance: none;
	background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%2394a3b8'%3E%3Cpath fill-rule='evenodd' d='M5.23 7.21a.75.75 0 0 1 1.06.02L10 11.168l3.71-3.938a.75.75 0 1 1 1.08 1.04l-4.25 4.5a.75.75 0 0 1-1.08 0l-4.25-4.5a.75.75 0 0 1 .02-1.06z' clip-rule='evenodd'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 14px center;
	background-size: 16px;
	padding-right: 40px;
	cursor: pointer;
}

.wplm-portal-account__form select option {
	background-color: #1e293b;
	color: #f8fafc;
}

.wplm-portal-account__form input::placeholder,
.wplm-portal-account__form textarea::placeholder {
	color: #64748b;
}

.wplm-portal-account__form input:focus,
.wplm-portal-account__form select:focus,
.wplm-portal-account__form textarea:focus {
	border-color: #3b82f6;
	outline: none;
	box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.25);
}

/* Support tickets */
.wplm-ticket-thread {
	margin: 20px 0;
}

.wplm-ticket-message {
	border: 1px solid #334155;
	border-radius: 6px;
	padding: 12px 16px;
	margin-bottom: 12px;
	color: #f8fafc;
}

.wplm-ticket-message--admin {
	background: #1e3a5f;
	border-color: #2563eb;
}

.wplm-ticket-message--customer {
	background: #1e293b;
}

.wplm-ticket-message__meta {
	display: flex;
	justify-content: space-between;
	font-size: 12px;
	color: #94a3b8;
	margin-bottom: 6px;
}

.wplm-ticket-message__body p {
	margin: 0 0 8px 0;
	color: #f8fafc;
}

.wplm-ticket-message__body p:last-child {
	margin-bottom: 0;
}

.wplm-portal-license {
	border: 1px solid #e5e7eb;
	border-radius: 6px;
	padding: 16px 20px;
	margin-bottom: 20px;
}

.wplm-portal-license h3 {
	margin: 0 0 6px 0;
}

.wplm-portal-license__actions {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 10px;
	margin: 14px 0;
}

/* A <form> is block-level by default and breaks the flex row even with
   display:flex on the parent. display:contents removes the form's own box
   so only its visible button participates in the flex layout (hidden
   inputs stay display:none regardless). The multi-field upgrade form is
   excluded — it needs to stay grouped as one unit, not scatter its label/
   select/button as separate flex items. */
.wplm-portal-license__actions > form:not(.wplm-portal-upgrade-form) {
	display: contents;
}

.wplm-portal-license__btn {
	display: inline-flex;
	align-items: center;
	white-space: nowrap;
	padding: 9px 16px;
	border: 1px solid #334155;
	border-radius: 6px;
	background: #1e293b;
	color: #f8fafc;
	font-size: 13px;
	font-weight: 600;
	line-height: 1.4;
	text-decoration: none;
	cursor: pointer;
	transition: background 0.15s ease, border-color 0.15s ease;
}

.wplm-portal-license__btn:hover {
	background: #334155;
	color: #f8fafc;
	text-decoration: none;
}

a.wplm-portal-license__btn--primary,
a.wplm-portal-license__btn--primary:link,
a.wplm-portal-license__btn--primary:visited {
	background: #2563eb;
	border-color: #2563eb;
	color: #fff !important;
}

a.wplm-portal-license__btn--primary:hover {
	background: #1d4ed8;
	border-color: #1d4ed8;
	color: #fff !important;
}

.wplm-portal-upgrade-form {
	display: flex;
	align-items: center;
	gap: 8px;
	margin: 0;
	/* Always wraps onto its own full-width line within the actions row,
	   rather than competing for space with the simple buttons above. */
	flex: 1 1 100%;
}

.wplm-portal-upgrade-form label {
	font-size: 13px;
	font-weight: 600;
	white-space: nowrap;
	margin: 0;
}

.wplm-portal-upgrade-form select {
	flex: 1;
	min-width: 0;
	max-width: 420px;
	padding: 8px 36px 8px 12px;
	border: 1px solid #334155;
	border-radius: 6px;
	font-size: 13px;
	font-family: inherit;
	color: #f8fafc;
	background-color: #1e293b;
	appearance: none;
	-webkit-appearance: none;
	-moz-appearance: none;
	background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%2394a3b8'%3E%3Cpath fill-rule='evenodd' d='M5.23 7.21a.75.75 0 0 1 1.06.02L10 11.168l3.71-3.938a.75.75 0 1 1 1.08 1.04l-4.25 4.5a.75.75 0 0 1-1.08 0l-4.25-4.5a.75.75 0 0 1 .02-1.06z' clip-rule='evenodd'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 10px center;
	background-size: 14px;
	cursor: pointer;
	text-overflow: ellipsis;
}

.wplm-portal-upgrade-form select option {
	background-color: #1e293b;
	color: #f8fafc;
}

.wplm-portal-upgrade-form .wplm-portal-license__btn {
	flex-shrink: 0;
}

/* Buy form (frontend self-checkout) */
.wplm-buy {
	max-width: 420px;
	background: #fff;
	border: 1px solid #dcdcde;
	border-radius: 4px;
	padding: 24px 28px;
}

.wplm-buy h3 {
	margin-top: 0;
	margin-bottom: 4px;
}

.wplm-buy__price {
	font-size: 28px;
	font-weight: 700;
	color: #1d2327;
	margin: 0 0 12px 0;
}

.wplm-buy__desc {
	color: #646970;
	font-size: 13px;
	margin-bottom: 16px;
}

.wplm-buy__form input[type="text"],
.wplm-buy__form input[type="email"] {
	width: 100%;
	padding: 8px 12px;
	border: 1px solid #d1d5db;
	border-radius: 4px;
	font-size: 14px;
	box-sizing: border-box;
}

.wplm-buy__submit {
	width: 100%;
	text-align: center;
}
