:root {
	--bg: #0b0f1a;
	--card: #161e2e;
	--accent: #38bdf8;
	--text: #f1f5f9;
	--text-dim: #94a3b8;
	--morning: #fbbf24;
	--evening: #818cf8;
}

* {
	box-sizing: border-box;
	margin: 0;
	padding: 0;
	font-family: "Segoe UI", sans-serif;
}
body {
	background: var(--bg);
	color: var(--text);
	padding: 20px 10px;
	display: flex;
	justify-content: center;
	min-height: 100vh;
}
.app-container {
	width: 100%;
	max-width: 500px;
	display: flex;
	flex-direction: column;
	gap: 25px;
}

/* Header & Stats */
header {
	position: relative;
}

.month-nav {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-bottom: 10px;
	gap: 15px;
}
.month-nav h2 {
	font-size: 1.3rem;
	text-transform: capitalize;
}
.month-nav button {
	background: var(--card);
	border: none;
	color: white;
	width: 40px;
	height: 40px;
	border-radius: 12px;
	cursor: pointer;
}

.month-nav .menu-btn {
	margin-left: auto;
}

.export-menu {
	display: none;
	position: absolute;
	top: 45px;
	right: 0;
	background: var(--card);
	border-radius: 12px;
	box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
	border: 1px solid rgba(255, 255, 255, 0.1);
	z-index: 200;
	overflow: hidden;
	min-width: 180px;
}

.export-menu.active {
	display: flex;
	flex-direction: column;
}

.export-section {
	display: flex;
	flex-direction: column;
	gap: 0;
}

.export-label {
	font-size: 0.75rem;
	color: var(--text-dim);
	text-transform: uppercase;
	padding: 8px 20px 4px 20px;
	letter-spacing: 0.5px;
}

.export-sublabel {
	font-size: 0.7rem;
	color: #cbd5e1;
	text-transform: uppercase;
	padding: 6px 20px 4px 20px;
	letter-spacing: 0.4px;
}

.export-main-menu {
	display: flex;
	flex-direction: column;
	gap: 0;
}

.export-submenu {
	display: none;
	flex-direction: column;
	gap: 0;
}

.menu-item {
	background: none;
	border: none;
	color: white;
	padding: 14px 20px;
	text-align: left;
	cursor: pointer;
	font-size: 1rem;
	font-weight: 500;
	transition: 0.2s;
	border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.menu-item:hover {
	background: rgba(255, 255, 255, 0.08);
}

.menu-item:last-child {
	border-bottom: none;
}

.back-btn {
	background: rgba(255, 255, 255, 0.05);
	border: none;
	color: var(--text-dim);
	padding: 12px 20px;
	text-align: left;
	cursor: pointer;
	font-size: 0.9rem;
	transition: 0.2s;
	margin-bottom: 8px;
	border-radius: 8px;
	margin: 8px 12px 8px 12px;
}

.back-btn:hover {
	background: rgba(255, 255, 255, 0.1);
}

.export-menu button {
	background: none;
	border: none;
	color: white;
	padding: 12px 20px;
	text-align: left;
	cursor: pointer;
	font-size: 0.95rem;
	transition: 0.2s;
}

.export-menu button.btn-danger {
	color: #ff6b6b;
}

.export-menu button.btn-danger:hover {
	background: rgba(255, 107, 107, 0.1);
}

.export-menu button.btn-secondary {
	color: var(--text-dim);
	font-size: 0.85rem;
}

.export-menu button.btn-secondary:hover {
	background: rgba(255, 255, 255, 0.05);
	color: var(--text);
}

.export-menu button .btn-hint {
	display: block;
	font-size: 0.65rem;
	color: var(--text-dim);
	margin-top: 2px;
	font-weight: normal;
	opacity: 0.7;
}

.export-menu button:hover {
	background: rgba(255, 255, 255, 0.05);
}

.export-menu button:active {
	background: rgba(255, 255, 255, 0.1);
}

.stats-grid {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 12px;
}
.stat-card {
	background: var(--card);
	padding: 15px 5px;
	border-radius: 18px;
	text-align: center;
	border: 1px solid rgba(255, 255, 255, 0.03);
}
.stat-card.highlight {
	border-color: rgba(56, 189, 248, 0.3);
}
.stat-card .label {
	display: block;
	font-size: 0.65rem;
	color: var(--text-dim);
	text-transform: uppercase;
	margin-bottom: 5px;
}
.stat-card .value {
	font-size: 1.2rem;
	font-weight: 800;
}
#stat-total {
	color: var(--accent);
}

/* Calendar */
.calendar-card {
	background: var(--card);
	padding: 20px;
	border-radius: 24px;
	box-shadow: 0 15px 30px rgba(0, 0, 0, 0.4);
}
.weekdays {
	display: grid;
	grid-template-columns: repeat(7, 1fr);
	text-align: center;
	color: var(--text-dim);
	font-size: 0.75rem;
	margin-bottom: 15px;
}
.calendar-grid {
	display: grid;
	grid-template-columns: repeat(7, 1fr);
	gap: 10px;
}

.calendar-day {
	aspect-ratio: 1/1;
	background: rgba(255, 255, 255, 0.02);
	border-radius: 12px;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 0.9rem;
	position: relative;
	cursor: pointer;
}
.calendar-day.today {
	outline: 2px solid #22c55e;
	background: rgba(34, 197, 94, 0.05);
}
.calendar-day.has-data {
	background: rgba(255, 255, 255, 0.08);
}

.day-mark {
	width: 6px;
	height: 6px;
	border-radius: 50%;
	position: absolute;
	bottom: 6px;
}
.mark-1 {
	background: var(--morning);
	box-shadow: 0 0 8px var(--morning);
}
.mark-2 {
	background: var(--evening);
	box-shadow: 0 0 8px var(--evening);
}
.mark-off {
	background: #64748b;
	box-shadow: 0 0 6px #64748b;
}

/* FAB */
.fab {
	position: fixed;
	bottom: 30px;
	right: 30px;
	width: 60px;
	height: 60px;
	border-radius: 20px;
	background: var(--accent);
	border: none;
	font-size: 28px;
	box-shadow: 0 8px 20px rgba(56, 189, 248, 0.4);
	cursor: pointer;
}

/* Modal Bottom Sheet */
.modal {
	display: none;
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, 0.8);
	z-index: 100;
	align-items: flex-end;
	backdrop-filter: blur(4px);
	cursor: pointer;
}
.modal.active {
	display: flex;
}
.modal-content {
	background: var(--bg);
	width: 100%;
	padding: 30px 20px;
	border-radius: 30px 30px 0 0;
	border-top: 1px solid rgba(255, 255, 255, 0.1);
	cursor: default;
	animation: slideUp 0.3s ease-out;
}
@keyframes slideUp {
	from {
		transform: translateY(100%);
	}
	to {
		transform: translateY(0);
	}
}

.modal-handle {
	width: 40px;
	height: 4px;
	background: #334155;
	border-radius: 2px;
	margin: -10px auto 20px;
}
.form-group {
	margin-bottom: 20px;
}
.form-group label {
	display: block;
	margin-bottom: 8px;
	color: var(--text-dim);
	font-size: 0.85rem;
}
.form-group select,
.form-group input {
	width: 100%;
	padding: 14px;
	background: var(--card);
	border: 1px solid rgba(255, 255, 255, 0.1);
	border-radius: 14px;
	color: white;
	font-size: 1rem;
	outline: none;
	box-sizing: border-box;
}
.form-group select {
	appearance: none;
	-webkit-appearance: none;
	-moz-appearance: none;

	width: 100%;
	padding: 14px;
	padding-right: 45px;
	background-color: var(--card);
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%2338bdf8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 15px center;
	background-size: 18px;

	color: white;
	font-size: 1rem;
	cursor: pointer;

	border-radius: 14px;
	border: 1px solid rgba(255, 255, 255, 0.1);

	-webkit-border-radius: 14px;
	box-sizing: border-box;
}

/* ФОКУС: те саме місце, де з'являється негарна рамка */
.form-group select:focus {
	outline: none !important; /* Прибираємо стандартний контур */
	border-color: var(--accent); /* Робимо наш бордюр кольоровим */
	box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.15); /* М'яке закруглене світіння замість квадрата */
}

/* Стилізація списку, що випадає (працює лише в Chrome на Windows) */
.form-group select option {
	background-color: #1e293b;
	color: white;
	padding: 12px 8px;
	margin: 4px 0;
	line-height: 1.8;
	border-radius: 8px;
	outline: none;
	border: none;
}

.form-group select option:checked {
	background: linear-gradient(var(--accent), var(--accent));
	background-color: var(--accent);
	color: #000;
	outline: none;
}

.form-group select option:focus {
	outline: none;
	border: none;
}

.ot-container {
	display: flex;
	flex-direction: column;
	gap: 10px;
}
/* Стиль для чіпсів залишається той самий, вони просто стануть ширшими */
.chips {
	display: flex;
	gap: 12px; /* Трохи збільшив відступ для зручності */
	margin-top: 5px;
}

.chips button {
	flex: 1;
	padding: 14px; /* Зробив їх вищими, щоб легше було тиснути */
	background: #1e293b;
	border: 1px solid #38bdf844;
	border-radius: 12px;
	color: var(--accent);
	font-weight: bold;
	font-size: 1.1rem;
}
.chips button:active {
	background: var(--accent);
	color: black;
}

.modal-btns {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 12px;
	margin-top: 10px;
}
.btn-save {
	background: var(--accent);
	color: black;
	font-weight: bold;
	border: none;
	padding: 16px;
	border-radius: 14px;
	cursor: pointer;
}
.btn-cancel {
	background: #1f2937;
	color: white;
	border: none;
	padding: 16px;
	border-radius: 14px;
	cursor: pointer;
}

/* Приховуємо стрілки інпуту */
input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
	-webkit-appearance: none;
	margin: 0;
}
/* Стиль для назв днів тижня (шапка) */
.weekdays div:nth-child(6),
.weekdays div:nth-child(7) {
	color: var(--accent-danger, #ef4444); /* Червонуватий колір для Сб та Нд */
	opacity: 0.8;
}

/* Стиль для самих клітинок вихідних */
.calendar-grid div:nth-child(7n+6), /* Суботи */
.calendar-grid div:nth-child(7n)   /* Неділі */ {
	background: rgba(239, 68, 68, 0.05); /* Легкий червоний фон */
}

/* Якщо на вихідних немає даних, зробимо цифри тьмянішими */
.calendar-grid div:nth-child(7n + 6):not(.has-data):not(.today),
.calendar-grid div:nth-child(7n):not(.has-data):not(.today) {
	color: var(--text-dim);
	opacity: 0.6;
}

/* Якщо ти працював у вихідний (є дані), виділимо його сильніше */
.calendar-grid div:nth-child(7n + 6).has-data,
.calendar-grid div:nth-child(7n).has-data {
	background: rgba(56, 189, 248, 0.1); /* Блакитний відтінок, якщо є робота */
	border: 1px dashed rgba(56, 189, 248, 0.3);
}
/* Дні попереднього та наступного місяців */
.calendar-day.neighbor-month {
	opacity: 0.2; /* Робимо їх прозорими */
	pointer-events: none; /* Щоб не можна було клікнути */
	background: transparent; /* Прибираємо фон */
}

/* Вихідні дні (субота та неділя) */
.calendar-grid div:nth-child(7n + 6),
.calendar-grid div:nth-child(7n) {
	color: #ef4444; /* Робимо текст червонуватим */
}

/* Якщо це вихідний, але він сусіднього місяця — повертаємо прозорість */
.calendar-day.neighbor-month:nth-child(7n + 6),
.calendar-day.neighbor-month:nth-child(7n) {
	opacity: 0.1;
}
/* Мітка для вихідного дня */
.day-mark.mark-off {
	background: #475569; /* Стриманий сірий колір */
	width: 5px;
	height: 5px;
	box-shadow: 0 0 5px rgba(255, 255, 255, 0.1);
}

/* Додатково: можна трохи змінити фон клітинки, якщо це обраний вихідний */
.calendar-day.has-data:has(.mark-off) {
	background: rgba(255, 255, 255, 0.03);
}

/* ═══════════════════════════════════════ */
/* МОБІЛЬНА АДАПТАЦІЯ (@media queries) */
/* ═══════════════════════════════════════ */

@media (max-width: 768px) {
	body {
		padding: 15px 8px;
	}

	.app-container {
		gap: 20px;
	}

	/* Header */
	.month-nav {
		gap: 8px;
		margin-bottom: 15px;
	}

	.month-nav h2 {
		font-size: 1.1rem;
		flex: 1;
		text-align: center;
	}

	.month-nav button {
		width: 44px;
		height: 44px;
		font-size: 1.2rem;
	}

	/* Stats */
	.stat-card {
		padding: 12px 8px;
		border-radius: 14px;
	}

	.stat-card .label {
		font-size: 0.6rem;
	}

	.stat-card .value {
		font-size: 1.1rem;
	}

	/* Calendar */
	.calendar-card {
		padding: 16px;
		border-radius: 20px;
	}

	.weekdays {
		font-size: 0.7rem;
		margin-bottom: 12px;
		gap: 4px;
	}

	.calendar-grid {
		gap: 8px;
	}

	.calendar-day {
		font-size: 0.85rem;
		border-radius: 10px;
	}

	/* FAB Button */
	.fab {
		width: 56px;
		height: 56px;
		font-size: 20px;
		bottom: 25px;
		right: 20px;
		box-shadow: 0 4px 12px rgba(56, 189, 248, 0.3);
	}

	/* Modal */
	.modal-content {
		padding: 25px 18px;
		border-radius: 28px 28px 0 0;
		max-height: 85vh;
		overflow-y: auto;
	}

	.modal-handle {
		margin-bottom: 15px;
	}

	.form-group {
		margin-bottom: 16px;
	}

	.form-group label {
		font-size: 0.8rem;
		margin-bottom: 8px;
	}

	.form-group select,
	.form-group input {
		padding: 12px;
		font-size: 1rem;
		border-radius: 12px;
	}

	.form-group select {
		padding-right: 40px;
		background-size: 16px;
	}

	.chips button {
		padding: 10px;
		font-size: 0.9rem;
		border-radius: 8px;
	}

	.modal-btns {
		gap: 12px;
		margin-top: 20px;
	}

	.btn-save,
	.btn-cancel {
		padding: 14px;
		font-size: 0.95rem;
		border-radius: 10px;
		min-height: 48px;
	}

	/* Export Menu */
	.export-menu {
		min-width: 160px;
	}

	.export-menu button {
		padding: 12px 16px;
		font-size: 0.9rem;
	}
}

@media (max-width: 480px) {
	body {
		padding: 12px 6px;
	}

	.app-container {
		gap: 15px;
		max-width: 100%;
	}

	.month-nav {
		gap: 6px;
	}

	.month-nav h2 {
		font-size: 1rem;
	}

	.month-nav button {
		width: 40px;
		height: 40px;
		font-size: 1rem;
		padding: 0;
	}

	.stats-grid {
		grid-template-columns: repeat(3, 1fr);
		gap: 10px;
	}

	.stat-card {
		padding: 10px 6px;
	}

	.stat-card .label {
		font-size: 0.55rem;
	}

	.stat-card .value {
		font-size: 1rem;
	}

	.calendar-card {
		padding: 12px;
		border-radius: 18px;
	}

	.weekdays {
		font-size: 0.65rem;
		margin-bottom: 10px;
		gap: 3px;
	}

	.calendar-day {
		font-size: 0.8rem;
		border-radius: 8px;
	}

	.day-mark {
		width: 4px;
		height: 4px;
		bottom: 4px;
	}

	.fab {
		width: 52px;
		height: 52px;
		font-size: 18px;
		bottom: 20px;
		right: 16px;
	}

	.modal-content {
		padding: 20px 16px;
	}

	.form-group input,
	.form-group select {
		padding: 11px;
		font-size: 16px;
	}

	.btn-save,
	.btn-cancel {
		padding: 12px;
		font-size: 0.9rem;
	}
}

/* ═══════════════════════════════════════ */
/* МОДАЛЬНЕ ВІКНО ВИБОРУ ГРАФІКА */
/* ═══════════════════════════════════════ */

.schedule-modal {
	align-items: center;
	justify-content: center;
	padding: 20px;
}

.schedule-modal .schedule-content {
	border-radius: 24px;
	max-width: 400px;
	animation: scaleIn 0.3s ease-out;
}

@keyframes scaleIn {
	from {
		transform: scale(0.9);
		opacity: 0;
	}
	to {
		transform: scale(1);
		opacity: 1;
	}
}

.schedule-header {
	text-align: center;
	margin-bottom: 25px;
}

.schedule-header h2 {
	font-size: 1.5rem;
	margin-bottom: 8px;
}

.schedule-header p {
	color: var(--text-dim);
	font-size: 0.9rem;
}

.schedule-options {
	display: flex;
	flex-direction: column;
	gap: 12px;
}

.schedule-option {
	display: flex;
	align-items: center;
	gap: 16px;
	padding: 18px;
	background: var(--card);
	border: 2px solid transparent;
	border-radius: 16px;
	cursor: pointer;
	transition: all 0.2s;
	text-align: left;
	color: var(--text);
}

.schedule-option:hover {
	border-color: var(--accent);
	background: rgba(56, 189, 248, 0.05);
}

.schedule-option:active {
	transform: scale(0.98);
}

.schedule-option.disabled {
	opacity: 0.4;
	cursor: not-allowed;
	pointer-events: none;
}

.option-icon {
	font-size: 2rem;
	width: 50px;
	height: 50px;
	background: rgba(255, 255, 255, 0.05);
	border-radius: 12px;
	display: flex;
	align-items: center;
	justify-content: center;
}

.option-info {
	flex: 1;
}

.option-title {
	font-weight: 600;
	font-size: 1rem;
	margin-bottom: 4px;
}

.option-desc {
	font-size: 0.8rem;
	color: var(--text-dim);
}

@media (max-width: 480px) {
	.schedule-modal {
		padding: 15px;
	}

	.schedule-modal .schedule-content {
		padding: 20px 16px;
	}

	.schedule-option {
		padding: 14px;
		gap: 12px;
	}

	.option-icon {
		width: 44px;
		height: 44px;
		font-size: 1.6rem;
	}

	.option-title {
		font-size: 0.95rem;
	}

	.option-desc {
		font-size: 0.75rem;
	}
}
