/**
 * Split Cost Calculator — Styles
 * "Refined Utility" design language
 *
 * Desktop trigger: rendered after booking widget (normal flow)
 * Mobile trigger: rendered inside sticky container (inherits fixed positioning)
 * Modal: rendered in wp_footer, shared by both triggers
 */

/* ==========================================================================
   1. CSS Custom Properties
   ========================================================================== */

:root {
	--hrck-sc-accent: #334155;       /* Slate 700 — trigger, tab indicator, stepper buttons */
	--hrck-sc-accent-hover: #1e293b; /* Slate 800 — hover states */
	--hrck-sc-accent-light: #f1f5f9; /* Slate 100 — hover backgrounds */
	--hrck-sc-amount: #0f172a;       /* Slate 900 — large dollar amounts */
	--hrck-sc-label: #64748b;        /* Slate 500 — sub-labels, inactive tabs */
	--hrck-sc-divider: #e2e8f0;      /* Slate 200 — divider lines */
	--hrck-sc-family-bg: #f8fafc;    /* Slate 50 — family card background */
	--hrck-sc-warning: #f59e0b;      /* Amber 500 — bedroom overflow warning */
}

/* ==========================================================================
   2. Trigger Button (.hrck-split-cost-trigger, .hrck-sc-trigger-btn)
   ========================================================================== */

/* Desktop trigger — after booking widget in normal document flow */
.hrck-split-cost-trigger--desktop {
	margin-top: 12px;
	margin-bottom: 20px;
}

/* Mobile trigger — positioned above the sticky bar, like a tab on a shelf */
.hrck-split-cost-trigger--mobile {
	position: absolute;
	bottom: 100%;
	left: 0;
	right: 0;
	z-index: 1;
}

/* Hide desktop trigger on mobile (sticky container handles it) */
@media (max-width: 959px) {
	.hrck-split-cost-trigger--desktop {
		display: none !important;
	}
}

/* Button */
.hrck-sc-trigger-btn {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	width: 100%;
	padding: 12px 20px;
	background: transparent;
	color: var(--hrck-sc-accent);
	border: 2px solid var(--hrck-sc-accent);
	border-radius: 8px;
	font-size: 14px;
	font-weight: 600;
	cursor: pointer;
	font-family: inherit;
	transition: background 0.2s, color 0.2s;
	line-height: 1.4;
	box-sizing: border-box;
}

.hrck-sc-trigger-btn:hover {
	background: rgba(51, 65, 85, 0.04);
}

.hrck-sc-trigger-btn:active {
	background: rgba(51, 65, 85, 0.08);
}

/* Icon */
.hrck-sc-trigger-icon {
	flex-shrink: 0;
}

/* Label */
.hrck-sc-trigger-label {
	flex: 1;
	text-align: left;
}

/* Chevron */
.hrck-sc-trigger-chevron {
	flex-shrink: 0;
	opacity: 0.5;
}

/* ==========================================================================
   3. Modal (.hrck-sc-modal)
   ========================================================================== */

.hrck-sc-modal {
	display: none;
	position: fixed;
	inset: 0;
	z-index: 100000;
	align-items: center;
	justify-content: center;
	padding: 20px;
	-webkit-overflow-scrolling: touch;
}

.hrck-sc-modal--open {
	display: flex;
}

/* Backdrop */
.hrck-sc-modal-backdrop {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.5);
	opacity: 0;
	transition: opacity 0.3s ease;
}

/* Lighter backdrop on desktop */
@media (min-width: 960px) {
	.hrck-sc-modal-backdrop {
		background: rgba(0, 0, 0, 0.2);
	}
}

.hrck-sc-modal--open .hrck-sc-modal-backdrop {
	opacity: 1;
}

/* Content */
.hrck-sc-modal-content {
	position: relative;
	background: #fff;
	border-radius: 12px;
	max-width: 400px;
	width: 100%;
	max-height: 85vh;
	overflow-y: auto;
	box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
	z-index: 1;
	transform: scale(0.9);
	opacity: 0;
	transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease;
}

.hrck-sc-modal--open .hrck-sc-modal-content {
	transform: scale(1);
	opacity: 1;
}

/* ==========================================================================
   4. Modal Header (.hrck-sc-modal-header)
   ========================================================================== */

.hrck-sc-modal-header {
	position: sticky;
	top: 0;
	background: #fff;
	padding: 16px 20px;
	border-bottom: 1px solid #e5e7eb;
	display: flex;
	justify-content: space-between;
	align-items: center;
	border-radius: 12px 12px 0 0;
	z-index: 10;
}

.hrck-sc-modal-title {
	font-size: 1.125rem;
	font-weight: 600;
	color: #111827;
	margin: 0;
}

.hrck-sc-modal-close {
	background: none;
	border: none;
	padding: 4px;
	cursor: pointer;
	color: #6b7280;
	border-radius: 4px;
	transition: color 0.2s, background 0.2s;
}

.hrck-sc-modal-close:hover {
	color: #111827;
	background: #f3f4f6;
}

.hrck-sc-modal-close svg {
	width: 24px;
	height: 24px;
	display: block;
}

/* ==========================================================================
   5. Tabs (.hrck-sc-tabs)
   ========================================================================== */

.hrck-sc-tabs {
	display: flex;
	position: relative;
	border-bottom: 1px solid var(--hrck-sc-divider);
	padding: 0 20px;
}

.hrck-sc-tab {
	flex: 1;
	padding: 12px 0;
	background: none;
	border: none;
	font-size: 14px;
	font-weight: 600;
	color: var(--hrck-sc-label);
	cursor: pointer;
	transition: color 0.2s;
	text-align: center;
	position: relative;
}

.hrck-sc-tab--active {
	color: var(--hrck-sc-accent);
}

/* Sliding tab indicator */
.hrck-sc-tab-indicator {
	position: absolute;
	bottom: -1px;
	left: 20px;
	width: calc(50% - 20px);
	height: 2px;
	background: var(--hrck-sc-accent);
	transition: transform 0.2s ease;
}

.hrck-sc-tab-indicator--right {
	transform: translateX(100%);
}

/* ==========================================================================
   6. Panels (.hrck-sc-panel)
   ========================================================================== */

.hrck-sc-panel {
	display: none;
	padding: 24px 20px;
}

.hrck-sc-panel--active {
	display: block;
}

.hrck-sc-panel-label {
	text-align: center;
	font-size: 15px;
	font-weight: 600;
	color: #111827;
	margin: 0 0 4px;
}

.hrck-sc-panel-sublabel {
	text-align: center;
	font-size: 13px;
	color: var(--hrck-sc-label);
	margin: 0 0 20px;
}

/* ==========================================================================
   7. Stepper (.hrck-sc-stepper)
   ========================================================================== */

.hrck-sc-stepper {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 20px;
	margin-bottom: 24px;
}

.hrck-sc-stepper-btn {
	width: 40px;
	height: 40px;
	border-radius: 50%;
	background: var(--hrck-sc-accent);
	color: #fff;
	border: none;
	font-size: 20px;
	font-weight: 500;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background 0.15s, transform 0.15s;
	line-height: 1;
	padding: 0;
}

.hrck-sc-stepper-btn:hover {
	background: var(--hrck-sc-accent-hover);
	transform: translateY(-1px);
}

.hrck-sc-stepper-btn:active {
	transform: scale(0.95);
}

.hrck-sc-stepper-btn--disabled {
	opacity: 0.3;
	cursor: default;
	pointer-events: none;
}

.hrck-sc-stepper-value {
	font-size: 32px;
	font-weight: 700;
	color: var(--hrck-sc-amount);
	min-width: 48px;
	text-align: center;
	line-height: 1;
}

/* ==========================================================================
   8. Results (.hrck-sc-results)
   ========================================================================== */

.hrck-sc-results {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 24px;
	padding: 20px 0 4px;
}

.hrck-sc-result {
	text-align: center;
}

.hrck-sc-result-amount {
	display: block;
	font-size: 28px;
	font-weight: 700;
	color: var(--hrck-sc-amount);
	letter-spacing: -0.02em;
	line-height: 1.2;
}

.hrck-sc-result-label {
	display: block;
	font-size: 12px;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	color: var(--hrck-sc-label);
	margin-top: 4px;
}

.hrck-sc-results-divider {
	width: 1px;
	height: 48px;
	background: var(--hrck-sc-divider);
	flex-shrink: 0;
}

/* Pulse animation for result updates */
.hrck-sc-pulse {
	animation: hrckScPulse 0.15s ease;
}

@keyframes hrckScPulse {
	0% { transform: scale(1); }
	50% { transform: scale(1.05); }
	100% { transform: scale(1); }
}

/* ==========================================================================
   9. Families Panel
   ========================================================================== */

/* Families header */
.hrck-sc-families-header {
	padding: 20px 0;
}

/* Families stepper — slightly tighter than people stepper */
.hrck-sc-stepper--families {
	margin-bottom: 16px;
}

/* Family card */
.hrck-sc-family-card {
	background: var(--hrck-sc-family-bg);
	border: 1px solid var(--hrck-sc-divider);
	border-radius: 10px;
	padding: 16px;
	margin-bottom: 12px;
	animation: hrckScSlideIn 0.2s ease both;
}

.hrck-sc-family-card:last-child {
	margin-bottom: 0;
}

/* Family header */
.hrck-sc-family-header {
	font-size: 13px;
	font-weight: 600;
	color: var(--hrck-sc-accent);
	margin-bottom: 12px;
	text-transform: uppercase;
	letter-spacing: 0.03em;
}

/* Family body */
.hrck-sc-family-body {
	display: flex;
	align-items: center;
	gap: 12px;
}

/* Family stepper — inline layout */
.hrck-sc-family-stepper {
	display: flex;
	align-items: center;
	gap: 8px;
}

/* Family stepper buttons — smaller than main stepper */
.hrck-sc-family-body .hrck-sc-stepper-btn {
	width: 32px;
	height: 32px;
	font-size: 16px;
}

/* Family stepper value — smaller */
.hrck-sc-family-body .hrck-sc-stepper-value {
	font-size: 20px;
	font-weight: 700;
	min-width: 32px;
	text-align: center;
}

/* Family label */
.hrck-sc-family-label {
	font-size: 13px;
	color: var(--hrck-sc-label);
	flex: 1;
}

/* Family cost */
.hrck-sc-family-cost {
	font-size: 22px;
	font-weight: 700;
	color: var(--hrck-sc-amount);
	letter-spacing: -0.02em;
}

/* Slide in animation for family cards */
@keyframes hrckScSlideIn {
	from {
		opacity: 0;
		transform: translateY(-8px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

/* Bedroom overflow warning */
.hrck-sc-bedroom-warning {
	text-align: center;
	font-size: 13px;
	color: var(--hrck-sc-warning);
	margin-top: 4px;
	padding: 0;
}

/* ==========================================================================
   10. Share Section (.hrck-sc-share-section)
   ========================================================================== */

.hrck-sc-share-section {
	border-top: 1px solid var(--hrck-sc-divider);
	padding: 0;
}

/* Toggle button */
.hrck-sc-share-toggle {
	display: flex;
	align-items: center;
	gap: 8px;
	width: 100%;
	padding: 16px 20px;
	background: none;
	border: none;
	font-size: 13px;
	font-weight: 600;
	color: var(--hrck-sc-accent);
	cursor: pointer;
	transition: background 0.2s;
}

.hrck-sc-share-toggle:hover {
	background: var(--hrck-sc-accent-light);
}

/* Chevron auto-rotates when share is open */
.hrck-sc-share-chevron {
	margin-left: auto;
	transition: transform 0.25s ease;
}

.hrck-sc-share--open .hrck-sc-share-chevron {
	transform: rotate(180deg);
}

/* Share content — collapsed by default, expands with max-height transition */
.hrck-sc-share-content {
	max-height: 0;
	overflow: hidden;
	transition: max-height 0.25s ease;
	padding: 0 20px;
}

.hrck-sc-share--open .hrck-sc-share-content {
	max-height: 400px;
	padding: 0 20px 16px;
}

/* Textarea */
.hrck-sc-share-text {
	width: 100%;
	background: var(--hrck-sc-family-bg);
	border: 1px solid var(--hrck-sc-divider);
	border-radius: 8px;
	padding: 12px;
	font-size: 13px;
	font-family: inherit;
	color: #111827;
	resize: none;
	line-height: 1.5;
	box-sizing: border-box;
}

/* Actions row */
.hrck-sc-share-actions {
	display: flex;
	gap: 8px;
	margin-top: 12px;
}

/* Copy button — outlined */
.hrck-sc-share-copy {
	flex: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	padding: 10px 16px;
	background: transparent;
	color: var(--hrck-sc-accent);
	border: 1.5px solid var(--hrck-sc-accent);
	border-radius: 8px;
	font-size: 13px;
	font-weight: 600;
	cursor: pointer;
	transition: background 0.2s;
	font-family: inherit;
}

.hrck-sc-share-copy:hover {
	background: var(--hrck-sc-accent-light);
}

/* Native share button — filled */
.hrck-sc-share-native {
	flex: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	padding: 10px 16px;
	background: var(--hrck-sc-accent);
	color: #fff;
	border: 1.5px solid var(--hrck-sc-accent);
	border-radius: 8px;
	font-size: 13px;
	font-weight: 600;
	cursor: pointer;
	transition: background 0.2s;
	font-family: inherit;
}

.hrck-sc-share-native:hover {
	background: var(--hrck-sc-accent-hover);
}

/* Feedback message (e.g. "Copied!") */
.hrck-sc-share-feedback {
	text-align: center;
	font-size: 13px;
	font-weight: 600;
	color: var(--hrck-sc-accent);
	margin-top: 8px;
	animation: hrckScFadeInOut 2s ease;
}

@keyframes hrckScFadeInOut {
	0% { opacity: 0; }
	10% { opacity: 1; }
	80% { opacity: 1; }
	100% { opacity: 0; }
}

/* ==========================================================================
   11. Mobile Responsive
   ========================================================================== */

@media (max-width: 959px) {

	/* Modal content */
	.hrck-sc-modal-content {
		max-width: 360px;
		margin: 10px;
	}

	/* Compact header */
	.hrck-sc-modal-header {
		padding: 10px 14px;
	}

	.hrck-sc-modal-title {
		font-size: 1rem;
	}

	/* Compact panels */
	.hrck-sc-panel {
		padding: 16px 14px;
	}

	/* Smaller stepper */
	.hrck-sc-stepper-btn {
		width: 36px;
		height: 36px;
	}

	.hrck-sc-stepper-value {
		font-size: 28px;
	}

	/* Smaller results */
	.hrck-sc-result-amount {
		font-size: 24px;
	}

	.hrck-sc-results {
		gap: 16px;
	}

	.hrck-sc-results-divider {
		height: 40px;
	}

	/* Smaller family card stepper */
	.hrck-sc-family-body .hrck-sc-stepper-btn {
		width: 28px;
		height: 28px;
		font-size: 14px;
	}

	/* Smaller family cost */
	.hrck-sc-family-cost {
		font-size: 18px;
	}

	/* Compact tabs */
	.hrck-sc-tabs {
		padding: 0 14px;
	}

	/* Compact share section */
	.hrck-sc-share-toggle {
		padding: 12px 14px;
	}

	.hrck-sc-share-content {
		padding: 0 14px;
	}

	.hrck-sc-share--open .hrck-sc-share-content {
		padding: 0 14px 12px;
	}
}
