/*
 * Frontend styles for Our Special Calendar
 * Modern, restaurant-themed design with green accents.
 * Playfair Display + Lato for an elegant, menu-like aesthetic.
 */

/* ── Google Font import ────────────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@600;700&family=Lato:wght@400;700&display=swap');

/* ── Variables ─────────────────────────────────────────────────────────────── */
.osc-calendar-wrapper {
	--osc-open:        #4caf50;
	--osc-holiday:     #f44336;
	--osc-event:       #2196f3;
	--osc-custom:      #ff9800;
	--osc-green:       #2d8c4e;
	--osc-green-lt:    #edf7f0;
	--osc-green-dk:    #1a5c32;
	--osc-border:      #2d8c4e;
	--osc-bg:          #ffffff;
	--osc-today:       #fff8e1;
	--osc-today-bdr:   #ffc107;
	--osc-text:        #1a2e22;
	--osc-text-light:  #5a7565;
	--osc-shadow:      0 4px 24px rgba(45,140,78,.12);
	--osc-radius:      14px;
	--osc-cell-bg:     transparent;
}

/* ── Wrapper ────────────────────────────────────────────────────────────────── */
.osc-calendar-wrapper {
	font-family: 'Lato', sans-serif;
	max-width: 720px;
	margin: 0 auto;
	color: var(--osc-text);
}

/* ── Title ──────────────────────────────────────────────────────────────────── */
.osc-cal-title {
	font-family: 'Playfair Display', Georgia, serif;
	font-size: clamp(20px, 4vw, 28px);
	font-weight: 700;
	color: var(--osc-green-dk);
	text-align: center;
	margin: 0 0 18px;
	letter-spacing: .5px;
	position: relative;
}

.osc-cal-title::after {
	content: '';
	display: block;
	width: 60px;
	height: 3px;
	background: linear-gradient(90deg, var(--osc-green), #81c784);
	border-radius: 2px;
	margin: 8px auto 0;
}

/* ── Navigation bar ─────────────────────────────────────────────────────────── */
.osc-nav-bar {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 18px;
	margin-bottom: 18px;
}

.osc-nav-btn {
	background: #fff;
	border: 2px solid var(--osc-border);
	color: var(--osc-green);
	width: 40px;
	height: 40px;
	border-radius: 50%;
	font-size: 20px;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background .2s, transform .15s;
	flex-shrink: 0;
}

.osc-nav-btn:hover {
	background: var(--osc-green-lt);
	transform: scale(1.08);
}

.osc-nav-btn:focus-visible {
	outline: 3px solid var(--osc-border);
	outline-offset: 2px;
}

.osc-nav-label {
	font-family: 'Playfair Display', serif;
	font-size: clamp(16px, 3vw, 20px);
	font-weight: 700;
	color: var(--osc-green-dk);
	min-width: 180px;
	text-align: center;
}

/* ── Table wrapper ──────────────────────────────────────────────────────────── */
.osc-table-wrapper {
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
	border-radius: var(--osc-radius);
	box-shadow: var(--osc-shadow);
	border: 2.5px solid var(--osc-border);
}

/* ── Calendar table ─────────────────────────────────────────────────────────── */
.osc-calendar-table {
	width: 100%;
	border-collapse: collapse;
	background: var(--osc-bg);
	table-layout: fixed;
}

/* ── Header row ─────────────────────────────────────────────────────────────── */
.osc-calendar-table thead th {
	background: linear-gradient(135deg, var(--osc-green-dk), var(--osc-green));
	color: #fff;
	font-family: 'Lato', sans-serif;
	font-size: 11px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 1px;
	padding: 12px 6px;
	text-align: center;
	border: none;
}

.osc-calendar-table thead th:first-child {
	border-radius: calc(var(--osc-radius) - 2px) 0 0 0;
}

.osc-calendar-table thead th:last-child {
	border-radius: 0 calc(var(--osc-radius) - 2px) 0 0;
}

/* ── Day cells ──────────────────────────────────────────────────────────────── */
.osc-calendar-table td {
	border: 1px solid #ddeee4;
	padding: 0;
	vertical-align: top;
	min-height: 68px;
	height: 68px;
	position: relative;
	transition: transform .18s cubic-bezier(.4,0,.2,1),
	            box-shadow .18s cubic-bezier(.4,0,.2,1);
}

.osc-td-empty {
	background: #f7faf8;
}

/* ── Typed day cells – colour fills entire cell ──────────────────────────────── */
.osc-td-day {
	background-color: var(--osc-cell-bg, transparent);
	cursor: default;
}

.osc-td-day.osc-type-open    { --osc-cell-bg: var(--osc-open); }
.osc-td-day.osc-type-holiday { --osc-cell-bg: var(--osc-holiday); }
.osc-td-day.osc-type-event   { --osc-cell-bg: var(--osc-event); }
.osc-td-day.osc-type-custom  { --osc-cell-bg: var(--osc-custom); }

/* Typed cells get white text */
.osc-td-day.osc-type-open .osc-day-num,
.osc-td-day.osc-type-holiday .osc-day-num,
.osc-td-day.osc-type-event .osc-day-num,
.osc-td-day.osc-type-custom .osc-day-num {
	color: #fff;
	text-shadow: 0 1px 3px rgba(0,0,0,.25);
}

.osc-td-day.osc-type-open .osc-day-label,
.osc-td-day.osc-type-holiday .osc-day-label,
.osc-td-day.osc-type-event .osc-day-label,
.osc-td-day.osc-type-custom .osc-day-label {
	color: rgba(255,255,255,.92);
}

/* ── Today highlight ─────────────────────────────────────────────────────────── */
.osc-td-day.osc-today {
	background-color: var(--osc-today);
	box-shadow: inset 0 0 0 2.5px var(--osc-today-bdr);
}

.osc-td-day.osc-today:not([class*="osc-type-"]) .osc-day-num {
	color: #b8860b;
}

/* typed today: keep cell bg, add inner glow */
.osc-td-day.osc-today.osc-type-open,
.osc-td-day.osc-today.osc-type-holiday,
.osc-td-day.osc-today.osc-type-event,
.osc-td-day.osc-today.osc-type-custom {
	box-shadow: inset 0 0 0 2.5px #fff, inset 0 0 0 4px var(--osc-today-bdr);
}

/* ── Hover effect ────────────────────────────────────────────────────────────── */
.osc-td-day:hover {
	transform: scale(1.05);
	box-shadow: 0 6px 20px rgba(0,0,0,.15);
	z-index: 5;
}

.osc-td-day:not([class*="osc-type-"]):hover {
	background: var(--osc-green-lt);
}

/* ── Cell inner ──────────────────────────────────────────────────────────────── */
.osc-cell-inner {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	justify-content: flex-start;
	padding: 6px 8px;
	height: 100%;
	min-height: 68px;
	box-sizing: border-box;
}

.osc-day-num {
	font-family: 'Lato', sans-serif;
	font-size: 16px;
	font-weight: 700;
	color: var(--osc-text);
	line-height: 1;
}

.osc-day-label {
	font-size: 9px;
	font-weight: 700;
	color: var(--osc-text-light);
	margin-top: 4px;
	text-transform: uppercase;
	letter-spacing: .4px;
	line-height: 1.3;
	max-width: 100%;
	overflow: hidden;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
}

/* ── Tooltip ─────────────────────────────────────────────────────────────────── */
.osc-tooltip {
	display: none;
	position: absolute;
	bottom: calc(100% + 8px);
	left: 50%;
	transform: translateX(-50%);
	background: rgba(26, 46, 34, .95);
	color: #fff;
	padding: 6px 12px;
	border-radius: 6px;
	font-size: 12px;
	font-weight: 600;
	white-space: nowrap;
	z-index: 100;
	pointer-events: none;
	backdrop-filter: blur(4px);
	box-shadow: 0 4px 12px rgba(0,0,0,.25);
	max-width: 160px;
	white-space: normal;
	text-align: center;
}

.osc-tooltip::after {
	content: '';
	position: absolute;
	top: 100%;
	left: 50%;
	transform: translateX(-50%);
	border: 5px solid transparent;
	border-top-color: rgba(26,46,34,.95);
}

/* Show tooltip on hover for day cells that have a label */
.osc-td-day[data-label]:not([data-label=""]):hover .osc-tooltip {
	display: block;
	animation: osc-tooltip-in .15s ease-out forwards;
}

@keyframes osc-tooltip-in {
	from { opacity: 0; transform: translateX(-50%) translateY(4px); }
	to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ── Legend ──────────────────────────────────────────────────────────────────── */
.osc-legend {
	display: flex;
	flex-wrap: wrap;
	gap: 12px 20px;
	justify-content: center;
	margin-top: 16px;
	padding: 12px 16px;
	background: var(--osc-green-lt);
	border-radius: 8px;
	border: 1px solid #c8e6c9;
}

.osc-legend-item {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	font-size: 12px;
	font-weight: 700;
	color: var(--osc-text-light);
	text-transform: uppercase;
	letter-spacing: .5px;
}

.osc-legend-dot {
	width: 14px;
	height: 14px;
	border-radius: 4px;
	flex-shrink: 0;
	box-shadow: 0 1px 3px rgba(0,0,0,.15);
}

/* ── Loading overlay (AJAX) ──────────────────────────────────────────────────── */
.osc-calendar-wrapper.osc-loading {
	pointer-events: none;
}

.osc-calendar-wrapper.osc-loading .osc-table-wrapper {
	opacity: .5;
	transition: opacity .2s;
}

/* ── Responsive ──────────────────────────────────────────────────────────────── */
@media (max-width: 540px) {
	.osc-calendar-table thead th {
		font-size: 9px;
		padding: 10px 2px;
		letter-spacing: .3px;
	}

	.osc-calendar-table td {
		height: 52px;
		min-height: 52px;
	}

	.osc-cell-inner {
		min-height: 52px;
		padding: 4px;
	}

	.osc-day-num  { font-size: 13px; }
	.osc-day-label { display: none; }

	.osc-nav-label { font-size: 15px; min-width: 140px; }
	.osc-nav-btn   { width: 34px; height: 34px; font-size: 16px; }
}

@media (max-width: 380px) {
	.osc-calendar-table thead th:nth-child(1),
	.osc-calendar-table thead th:nth-child(7) {
		font-size: 8px;
	}
}
