/**
 * My Subscriptions - Modern UI
 * Matches the reference design with Plan, ID, Start date, End date, Status, Billing info, Actions
 */

.cbran-my-subscriptions {
	font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Ubuntu, Cantarell, 'Helvetica Neue', sans-serif;
	font-size: 14px;
	line-height: 1.5;
	color: #334155;
	-webkit-font-smoothing: antialiased;
}

.cbran-subscriptions-container {
	background: #fff;
	border-radius: 8px;
	border: 1px solid #e2e8f0;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
	overflow: hidden;
}

/* Header */
.cbran-subscriptions-header {
	padding: 1.25rem 1.5rem;
	border-bottom: 1px solid #e2e8f0;
	background: #f8fafc;
}

.cbran-subscriptions-header-content {
	display: flex;
	align-items: center;
}

.cbran-subscriptions-title {
	margin: 0;
	font-size: 1.25rem;
	font-weight: 700;
	color: #0f172a;
	letter-spacing: -0.02em;
}

/* Body & Table */
.cbran-subscriptions-body {
	padding: 0;
}

.cbran-subscriptions-table {
	display: flex;
	flex-direction: column;
}

/* Table header - grid layout */
.cbran-subscriptions-table-header {
	display: grid;
	gap: 1rem;
	padding: 0.875rem 1.5rem;
	background: #f8fafc;
	border-bottom: 1px solid #e2e8f0;
	font-size: 0.75rem;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	color: #64748b;
}

.cbran-subscriptions-table-header-item label {
	margin: 0;
	cursor: default;
}

/* Table rows */
.cbran-subscriptions-row {
	border-bottom: 1px solid #f1f5f9;
	transition: background 0.15s;
}

.cbran-subscriptions-row:hover {
	background: #f8fafc;
}

.cbran-subscriptions-row:last-child {
	border-bottom: none;
}

.cbran-subscriptions-row-item {
	display: grid;
	gap: 1rem;
	padding: 1rem 1.5rem;
	align-items: center;
}

.cbran-subscriptions-row-cell {
	font-size: 0.875rem;
	color: #334155;
}

.cbran-subscriptions-plan-name {
	font-weight: 600;
	color: #0f172a;
}

/* Status badges */
.cbran-subscriptions-status-wrap {
	padding: 0 4px;
}

.cbran-subscriptions-status {
	display: inline-block;
	padding: 0.25rem 0.625rem;
	font-size: 0.75rem;
	font-weight: 600;
	border-radius: 4px;
	text-transform: capitalize;
}

.cbran-subscriptions-status--active {
	background: #dcfce7;
	color: #166534;
}

.cbran-subscriptions-status--trial {
	background: #f3e8ff;
	color: #6b21a8;
}

.cbran-subscriptions-status--pending {
	background: #fef3c7;
	color: #b45309;
}

.cbran-subscriptions-status--overdue,
.cbran-subscriptions-status--past-due {
	background: #ffedd5;
	color: #c2410c;
}

.cbran-subscriptions-status--cancelled,
.cbran-subscriptions-status--expired {
	background: #f1f5f9;
	color: #475569;
}

.cbran-subscriptions-status--pause,
.cbran-subscriptions-status--suspended {
	background: #fef3c7;
	color: #b45309;
}

.cbran-subscriptions-status--pending-authorization,
.cbran-subscriptions-status--failed {
	background: #fee2e2;
	color: #991b1b;
}

.cbran-subscriptions-status--pending-cancellation {
	background: #e0e7ff;
	color: #3730a3;
}

/* Buttons */
.cbran-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 0.375rem;
	padding: 0.375rem 0.75rem;
	font-size: 0.8125rem;
	font-weight: 600;
	border-radius: 6px;
	text-decoration: none;
	border: 1px solid #e2e8f0;
	background: #fff;
	color: #545f7e;
	cursor: pointer;
	transition: all 0.2s;
}

.cbran-btn:hover {
	background: #f8fafc;
	border-color: #cbd5e1;
	color: #334155;
}

.cbran-btn--primary {
	background: #1152d4;
	border-color: #1152d4;
	color: #fff;
}

.cbran-btn--primary:hover {
	background: #0f47b8;
	border-color: #0f47b8;
	color: #fff;
}

.cbran-btn--secondary {
	background: #fff;
}

.cbran-btn-icon {
	width: 16px;
	height: 16px;
	flex-shrink: 0;
}

.cbran-btn--update .cbran-btn-icon {
	width: 14px;
	height: 14px;
}

/* Details action — primary theme button inside My Account list */
.woocommerce-account .cbran-my-subscriptions .cbran-subscriptions-details-btn,
.woocommerce-account .cbran-my-subscriptions .cbran-subscriptions-pay-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 0.375rem;
	margin: 0;
	padding: 0.75rem 1.25rem;
	border: 0;
	border-radius: var(--btn-accented-brd-radius, 4px);
	color: var(--btn-accented-color, #fff);
	box-shadow: var(--btn-accented-box-shadow, none);
	background-color: var(--btn-accented-bgcolor, var(--woocommerce, #96588a));
	text-transform: var(--btn-accented-transform, var(--btn-transform, uppercase));
	font-weight: var(--btn-accented-font-weight, var(--btn-font-weight, 600));
	font-family: var(--btn-accented-font-family, var(--btn-font-family, inherit));
	font-style: var(--btn-accented-font-style, var(--btn-font-style, unset));
	font-size: inherit;
	line-height: 1.2;
	text-decoration: none;
	white-space: nowrap;
	cursor: pointer;
	transition: color 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
}

.woocommerce-account .cbran-my-subscriptions .cbran-subscriptions-details-btn:hover,
.woocommerce-account .cbran-my-subscriptions .cbran-subscriptions-pay-btn:hover {
	color: var(--btn-accented-color-hover, var(--btn-accented-color, #fff));
	box-shadow: var(--btn-accented-box-shadow-hover, var(--btn-accented-box-shadow, none));
	background-color: var(--btn-accented-bgcolor-hover, var(--btn-accented-bgcolor, var(--woocommerce, #96588a)));
}

.woocommerce-account .cbran-my-subscriptions .cbran-subscriptions-details-btn:active,
.woocommerce-account .cbran-my-subscriptions .cbran-subscriptions-pay-btn:active {
	box-shadow: var(--btn-accented-box-shadow-active, var(--btn-accented-box-shadow, none));
	bottom: var(--btn-accented-bottom-active, 0);
}

.woocommerce-account .cbran-my-subscriptions .cbran-subscriptions-details-btn__icon {
	width: 0.95em;
	height: 0.95em;
	flex-shrink: 0;
}

/* Muted placeholder */
.cbran-subscriptions-muted {
	color: #94a3b8;
	font-size: 0.875rem;
}

/* Empty state */
.cbran-subscriptions-empty {
	padding: 2.5rem 1.5rem;
	text-align: center;
	background: #f8fafc;
	border-radius: 8px;
	margin: 1.5rem;
}

.cbran-subscriptions-empty p {
	margin: 0 0 1rem 0;
	font-size: 1rem;
	color: #64748b;
}

.cbran-subscriptions-row-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
	align-items: center;
}

.cbran-subscriptions-row-cell--actions .cbran-btn,
.cbran-subscriptions-row-cell--billing .cbran-btn {
	white-space: nowrap;
}

.cbran-subscription-overlay {
	position: fixed;
	inset: 0;
	z-index: 100000;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 1.5rem;
	font-family: inherit;
	font-size: inherit;
	line-height: inherit;
	color: inherit;
	-webkit-font-smoothing: inherit;
}

.cbran-subscription-overlay[hidden] {
	display: none !important;
}

body.cbran-subscription-overlay-open {
	overflow: hidden;
}

.cbran-subscription-overlay__backdrop {
	position: absolute;
	inset: 0;
	background: rgba(15, 23, 42, 0.55);
}

.cbran-subscription-overlay__dialog {
	position: relative;
	z-index: 1;
	width: min(920px, 100%);
	max-height: calc(100vh - 3rem);
	display: flex;
	flex-direction: column;
	overflow: hidden;
	font: inherit;
	color: inherit;
	line-height: inherit;
	background: var(--wc-form-color-background, var(--wp--preset--color--background, #fff));
	border: 1px solid color-mix(in srgb, currentColor 12%, transparent);
	border-radius: 4px;
	box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
}

.cbran-subscription-overlay__header,
.cbran-subscription-overlay__footer {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
	padding: 1rem 1.25rem;
	font: inherit;
	color: inherit;
	background: transparent;
	border-bottom: 1px solid color-mix(in srgb, currentColor 12%, transparent);
}

.cbran-subscription-overlay__footer {
	border-bottom: 0;
	border-top: 1px solid color-mix(in srgb, currentColor 12%, transparent);
	justify-content: flex-end;
}

.cbran-subscription-overlay__title {
	margin: 0;
	font: inherit;
	font-size: 1.125em;
	font-weight: 600;
	color: inherit;
}

.cbran-subscription-overlay__close {
	border: 0;
	background: transparent;
	font: inherit;
	font-size: 1.5em;
	line-height: 1;
	color: inherit;
	opacity: 0.65;
	cursor: pointer;
}

.cbran-subscription-overlay__close:hover {
	opacity: 1;
}

.cbran-subscription-overlay__body {
	position: relative;
	padding: 1rem 1.25rem;
	overflow: auto;
	font: inherit;
	color: inherit;
}

.cbran-subscription-overlay__loading {
	padding: 2rem;
	text-align: center;
	font: inherit;
	color: inherit;
	opacity: 0.75;
}

/* Modal content: layout only — typography, buttons and inputs come from the theme */
.cbran-subscription-overlay__content,
.cbran-subscription-overlay__panel {
	line-height: inherit;
}

.cbran-subscription-overlay__panel {
	width: 100%;
}

/* Theme bridge: use WooCommerce / WoodMart CSS variables inside the overlay */
.woocommerce-account .cbran-subscription-overlay .cbran-subscription-overlay__panel :is(button, a).button,
.woocommerce-account .cbran-subscription-overlay .cbran-subscription-overlay__panel a.cbran-subscriptions-pay-btn,
.woocommerce-account .cbran-subscription-overlay .cbran-subscription-overlay__panel a.CbranSubs-change-payment,
.woocommerce-account .cbran-subscription-overlay .cbran-subscription-overlay__footer :is(button, a).button {
	border: 0;
	border-radius: var(--btn-accented-brd-radius, 4px);
	color: var(--btn-accented-color, #fff);
	box-shadow: var(--btn-accented-box-shadow, none);
	background-color: var(--btn-accented-bgcolor, var(--woocommerce, #96588a));
	text-transform: var(--btn-accented-transform, var(--btn-transform, uppercase));
	font-weight: var(--btn-accented-font-weight, var(--btn-font-weight, 600));
	font-family: var(--btn-accented-font-family, var(--btn-font-family, inherit));
	font-style: var(--btn-accented-font-style, var(--btn-font-style, unset));
	text-decoration: none;
	cursor: pointer;
}

.woocommerce-account .cbran-subscription-overlay .cbran-subscription-overlay__panel :is(button, a).button:hover,
.woocommerce-account .cbran-subscription-overlay .cbran-subscription-overlay__panel a.cbran-subscriptions-pay-btn:hover,
.woocommerce-account .cbran-subscription-overlay .cbran-subscription-overlay__panel a.CbranSubs-change-payment:hover,
.woocommerce-account .cbran-subscription-overlay .cbran-subscription-overlay__footer :is(button, a).button:hover {
	color: var(--btn-accented-color-hover, var(--btn-accented-color, #fff));
	box-shadow: var(--btn-accented-box-shadow-hover, var(--btn-accented-box-shadow, none));
	background-color: var(--btn-accented-bgcolor-hover, var(--btn-accented-bgcolor, var(--woocommerce, #96588a)));
}

.woocommerce-account .cbran-subscription-overlay .cbran-subscription-overlay__panel :is(button, a).button:active,
.woocommerce-account .cbran-subscription-overlay .cbran-subscription-overlay__panel a.cbran-subscriptions-pay-btn:active,
.woocommerce-account .cbran-subscription-overlay .cbran-subscription-overlay__panel a.CbranSubs-change-payment:active,
.woocommerce-account .cbran-subscription-overlay .cbran-subscription-overlay__footer :is(button, a).button:active {
	box-shadow: var(--btn-accented-box-shadow-active, var(--btn-accented-box-shadow, none));
	bottom: var(--btn-accented-bottom-active, 0);
}

.woocommerce-account .cbran-subscription-overlay .woocommerce-Input,
.woocommerce-account .cbran-subscription-overlay .input-text {
	font: inherit;
	color: inherit;
	background-color: var(--wd-form-bg, var(--wc-form-color-background, #fff));
	border: var(--wd-form-brd-width, 2px) var(--wd-form-brd-style, solid) var(--wd-form-brd-color, rgba(0, 0, 0, 0.1));
	border-radius: var(--wd-form-brd-radius, 5px);
}

.woocommerce-account .cbran-subscription-overlay .cbran-subs-payment-method-panel {
	padding: 0.875rem 0;
	border: 0;
	border-top: 1px solid color-mix(in srgb, currentColor 10%, transparent);
	border-bottom: 1px solid color-mix(in srgb, currentColor 10%, transparent);
	border-radius: 0;
	background: transparent;
}

.woocommerce-account .cbran-subscription-overlay .cbran-subs-payment-method-panel__label {
	font: inherit;
	font-size: 0.85em;
	font-weight: 600;
	color: inherit;
	opacity: 0.75;
	text-transform: uppercase;
	letter-spacing: 0.02em;
}

.woocommerce-account .cbran-subscription-overlay .cbran-subs-payment-method-panel__value {
	font: inherit;
	font-weight: 500;
	color: inherit;
}

.woocommerce-account .cbran-subscription-overlay .subscription_activity_logs .cbransubs_alert_box {
	font: inherit;
	font-size: inherit;
	border-radius: 0;
}

.woocommerce-account .cbran-subscription-overlay .subscription_activity_logs .cbransubs_alert_box.notice {
	background: var(--wd-info-bg, #f0f8ff);
	border: 1px solid var(--wd-info-color, #1e85be);
	color: inherit;
}

.woocommerce-account .cbran-subscription-overlay .subscription_activity_logs .cbransubs_alert_box._success {
	background: var(--wd-success-bg, #f0f9eb);
	border: 1px solid var(--wd-success-color, #7ad03a);
	color: inherit;
}

.woocommerce-account .cbran-subscription-overlay .subscription_activity_logs .cbransubs_alert_box.warning {
	background: var(--wd-warning-bg, #fff8e5);
	border: 1px solid var(--wd-warning-color, #ffba00);
	color: inherit;
}

.woocommerce-account .cbran-subscription-overlay .subscription_activity_logs .cbransubs_alert_box.error {
	background: var(--wd-danger-bg, #fef0f0);
	border: 1px solid var(--wd-danger-color, #a00);
	color: inherit;
}

.cbran-subscription-overlay__panel .cbran-subs-myaccount-detail {
	width: 100%;
	border-collapse: collapse;
	margin: 0;
	background: transparent;
	border: 0;
	border-radius: 0;
}

.cbran-subscription-overlay__panel .cbran-subs-myaccount-detail tr {
	border-bottom: 1px solid color-mix(in srgb, currentColor 10%, transparent);
}

.cbran-subscription-overlay__panel .cbran-subs-myaccount-detail tr:last-child {
	border-bottom: 0;
}

.cbran-subscription-overlay__panel .cbran-subs-myaccount-detail td {
	padding: 0.65rem 0;
	vertical-align: top;
}

.cbran-subscription-overlay__panel .cbran-subs-myaccount-detail td:nth-child(2) {
	width: 1rem;
	padding-left: 0;
	padding-right: 0.5rem;
	opacity: 0.65;
}

.cbran-subscription-overlay__panel .cbran-subs-myaccount-detail .button,
.cbran-subscription-overlay__panel .cbran-subs-myaccount-detail input.button,
.cbran-subscription-overlay__panel .cbran-subs-myaccount-detail a.button,
.cbran-subscription-overlay__panel .cbran-subs-myaccount-detail button {
	margin: 0.25rem 0.5rem 0.25rem 0;
}

.cbran-subscription-overlay__panel .cbran-subs-myaccount-detail .cbran-subs-date-input,
.cbran-subscription-overlay__panel .cbran-subs-myaccount-detail #subscription-cancel-selector,
.cbran-subscription-overlay__panel .cbran-subs-myaccount-detail #subscription_qty {
	max-width: 100%;
	margin: 0.25rem 0.5rem 0.25rem 0;
}

.cbran-subscription-overlay__panel .subscription_activity_logs .cbransubs_alert_box {
	margin: 0.75rem 0;
	padding: 1em 1.5em;
}

.cbran-subscription-overlay__panel #prevent-more-subscription-notes {
	display: inline-block;
	margin-top: 0.5rem;
	text-decoration: underline;
	cursor: pointer;
}

.cbran-subscription-overlay__footer .button {
	margin: 0;
}

.cbran-my-account-list-preview__frame {
	margin-top: 0.75rem;
	padding: 1rem;
	background: #f8fafc;
	border: 1px solid #e2e8f0;
	border-radius: 12px;
}

.cbran-my-account-list-preview__mock .cbran-subscriptions-container {
	box-shadow: none;
}

.cbran-my-account-list-preview__overlay-note {
	margin-top: 0.75rem;
	padding: 0.75rem 1rem;
	border-radius: 8px;
	background: #eff6ff;
	color: #1d4ed8;
	font-size: 0.8125rem;
}

/* Pagination */
.cbran-subscriptions-pagination {
	display: flex;
	gap: 0.75rem;
	justify-content: center;
	padding: 1.25rem 1.5rem;
	border-top: 1px solid #e2e8f0;
	background: #f8fafc;
}

/* Responsive - stack on tablet */
@media (max-width: 1024px) {
	.cbran-subscriptions-table-header,
	.cbran-subscriptions-row-item {
		grid-template-columns: 1fr 1fr 1fr;
		gap: 0.75rem;
		padding: 0.75rem 1rem;
	}
}

/* Responsive - card layout on mobile */
@media (max-width: 640px) {
	.cbran-subscriptions-table-header {
		display: none;
	}

	.cbran-subscriptions-row-item {
		display: flex;
		flex-direction: column;
		gap: 0.5rem;
		padding: 1rem;
		border-bottom: 1px solid #e2e8f0;
	}

	.cbran-subscriptions-row-cell {
		display: flex;
		align-items: center;
		gap: 0.5rem;
	}

	.cbran-subscriptions-row-cell[data-label]::before {
		content: attr(data-label);
		font-size: 0.6875rem;
		font-weight: 600;
		text-transform: uppercase;
		color: #94a3b8;
		min-width: 90px;
	}

	.cbran-subscriptions-pagination {
		flex-direction: column;
	}
}
