/* ============================
   디자인 시스템 토큰
   ============================ */
:root {
	/* 색상 팔레트 - Deeper & Modern Dark */
	--bg-primary: #020205;
	--bg-secondary: rgba(13, 13, 20, 0.7);
	--bg-card: rgba(18, 18, 28, 0.6);
	--bg-elevated: rgba(255, 255, 255, 0.08);
	--bg-hover: rgba(255, 255, 255, 0.12);

	--text-primary: #ffffff;
	--text-secondary: rgba(255, 255, 255, 0.7);
	--text-muted: rgba(255, 255, 255, 0.45);

	--border: rgba(255, 255, 255, 0.1);
	--border-light: rgba(255, 255, 255, 0.15);
	--accent-glow: rgba(124, 77, 255, 0.3);

	--glass-blur: blur(20px);
	--glass-bg: rgba(255, 255, 255, 0.03);
	--glass-border: 1px solid rgba(255, 255, 255, 0.1);

	/* 과목 색상 - Vibrant & Refined */
	--course-1: #9d7cff;
	--course-1-bg: rgba(157, 124, 255, 0.12);
	--course-1-border: rgba(157, 124, 255, 0.3);

	--course-2: #26e6c8;
	--course-2-bg: rgba(38, 230, 200, 0.12);
	--course-2-border: rgba(38, 230, 200, 0.3);

	--course-3: #ff7b9c;
	--course-3-bg: rgba(255, 123, 156, 0.12);
	--course-3-border: rgba(255, 123, 156, 0.3);

	--course-4: #ffcc33;
	--course-4-bg: rgba(255, 204, 51, 0.12);
	--course-4-border: rgba(255, 204, 51, 0.3);

	--course-5: #33b5ff;
	--course-5-bg: rgba(51, 181, 255, 0.12);
	--course-5-border: rgba(51, 181, 255, 0.3);

	--course-6: #ff8e5a;
	--course-6-bg: rgba(255, 142, 90, 0.12);
	--course-6-border: rgba(255, 142, 90, 0.3);

	--course-7: #df99f0;
	--course-7-bg: rgba(223, 153, 240, 0.12);
	--course-7-border: rgba(223, 153, 240, 0.3);

	--course-8: #90d694;
	--course-8-bg: rgba(144, 214, 148, 0.12);
	--course-8-border: rgba(144, 214, 148, 0.3);

	--course-9: #ff9eba;
	--course-9-bg: rgba(255, 158, 186, 0.12);
	--course-9-border: rgba(255, 158, 186, 0.3);

	/* 타이포그래피 */
	--font-sans:
		"Inter", "Noto Sans KR", -apple-system, BlinkMacSystemFont, sans-serif;

	/* 간격 축소 */
	--space-xs: 3px;
	--space-sm: 6px;
	--space-md: 10px;
	--space-lg: 14px;
	--space-xl: 20px;
	--space-2xl: 28px;

	/* 모서리 */
	--radius-sm: 8px;
	--radius-md: 12px;
	--radius-lg: 18px;
	--radius-xl: 24px;

	/* 시간표 크기 축소 */
	--cell-height: 52px;
	--time-col-width: 38px;
	--day-col-min-width: 58px;

	/* 그림자 */
	--shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.2);
	--shadow-md: 0 8px 24px rgba(0, 0, 0, 0.3);
	--shadow-glow: 0 0 20px var(--accent-glow);
}

/* ============================
   리셋 & 베이스
   ============================ */
*,
*::before,
*::after {
	margin: 0;
	padding: 0;
	box-sizing: border-box;
}

html {
	font-size: 14px;
	-webkit-text-size-adjust: 100%;
}

body {
	font-family: var(--font-sans);
	background: var(--bg-primary);
	color: var(--text-primary);
	min-height: 100dvh;
	overflow-x: hidden;
	-webkit-font-smoothing: antialiased;
	position: relative;
}

/* ============================
   글래스 배경 요소
   ============================ */
.bg-blobs {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	z-index: -1;
	overflow: hidden;
	background: radial-gradient(circle at 50% 50%, #0a0a1a 0%, #020205 100%);
}

.blob {
	position: absolute;
	border-radius: 50%;
	filter: blur(60px); /* 블러를 조금 줄여 경계를 약간 더 선명하게 */
	opacity: 0.5; /* 투명도를 살짝 높임 */
	animation: float 12s infinite alternate cubic-bezier(0.45, 0, 0.55, 1);
}

.blob-1 {
	width: 400px;
	height: 400px;
	background: var(--course-1);
	top: -100px;
	left: -100px;
	animation-duration: 15s;
}

.blob-2 {
	width: 350px;
	height: 350px;
	background: var(--course-5);
	bottom: 10%;
	right: -50px;
	animation-duration: 18s;
	animation-delay: -5s;
}

.blob-3 {
	width: 300px;
	height: 300px;
	background: var(--course-3);
	top: 30%;
	left: 40%;
	animation-duration: 12s;
	animation-delay: -2s;
}

.blob-4 {
	width: 250px;
	height: 250px;
	background: var(--course-2);
	bottom: -50px;
	left: 10%;
	animation-duration: 16s;
	animation-delay: -10s;
}

@keyframes float {
	0% { transform: translate(0, 0) scale(1); }
	33% { transform: translate(100px, -120px) scale(1.2); }
	66% { transform: translate(-80px, 60px) scale(0.8); }
	100% { transform: translate(0, 0) scale(1); }
}

/* ============================
   헤더
   ============================ */
.header {
	position: sticky;
	top: 0;
	z-index: 100;
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: var(--space-md) var(--space-xl) var(--space-md);
	background: rgba(10, 10, 15, 0.4);
	backdrop-filter: var(--glass-blur);
	-webkit-backdrop-filter: var(--glass-blur);
	border-bottom: 1px solid var(--border);
}

.header-title {
	font-size: 1.3rem;
	font-weight: 900;
	letter-spacing: -0.03em;
	background: linear-gradient(135deg, #ffffff 0%, #aab0b8 100%);
	-webkit-background-clip: text;
	-webkit-text-fill-color: transparent;
	background-clip: text;
}

.header-subtitle {
	font-size: 0.8rem;
	color: var(--text-secondary);
	margin-top: 4px;
	font-weight: 600;
	opacity: 0.8;
}

.view-toggle-btn {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	background: var(--bg-elevated);
	border: 1px solid var(--border-light);
	border-radius: var(--radius-md);
	color: var(--text-primary);
	cursor: pointer;
	transition: all 0.25s cubic-bezier(0.23, 1, 0.32, 1);
	box-shadow: var(--shadow-sm);
}

.view-toggle-btn:active {
	transform: scale(0.94);
	background: var(--bg-hover);
}

/* ============================
   오늘의 수업 배너
   ============================ */
.today-banner {
	margin: var(--space-md) var(--space-md) var(--space-sm);
	padding: var(--space-lg);
	background: var(--bg-card);
	backdrop-filter: var(--glass-blur);
	-webkit-backdrop-filter: var(--glass-blur);
	border-radius: var(--radius-xl);
	border: var(--glass-border);
	box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
	transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 접혔을 때의 컴팩트 스타일 */
.today-banner.collapsed {
	padding: var(--space-md) var(--space-xl);
	margin-bottom: var(--space-xs);
	background: var(--bg-secondary);
	box-shadow: var(--shadow-sm);
}

.today-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--space-md);
	flex-wrap: nowrap; /* 레이아웃이 줄바꿈되지 않도록 강제 */
}

/* 접혔을 때 네비게이션 숨김 */
.today-banner.collapsed .today-nav {
	display: none !important;
}

.today-banner:not(.collapsed) .today-header {
    margin-bottom: var(--space-lg);
}

.today-label {
	display: flex;
	align-items: center;
	gap: var(--space-sm);
	font-weight: 800;
	font-size: 0.9rem;
	color: var(--text-primary);
	letter-spacing: -0.01em;
}

.today-controls {
	display: flex;
	align-items: center;
	gap: var(--space-sm);
}

.today-nav {
	display: flex;
	align-items: center;
	background: var(--bg-elevated);
	border-radius: 24px;
	padding: 3px;
	border: 1px solid var(--border-light);
}

.nav-btn {
	width: 32px;
	height: 32px;
	display: flex;
	align-items: center;
	justify-content: center;
	background: transparent;
	border: none;
	color: var(--text-secondary);
	cursor: pointer;
	border-radius: 50%;
	transition: all 0.2s ease;
}

.nav-btn:active {
	background: var(--bg-hover);
	color: var(--text-primary);
}

.fold-btn {
	width: 36px;
	height: 36px;
	display: flex;
	align-items: center;
	justify-content: center;
	background: var(--bg-elevated);
	border: 1px solid var(--border-light);
	border-radius: 50%;
	color: var(--text-secondary);
	cursor: pointer;
	transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.fold-btn.active #foldIcon {
	transform: rotate(180deg);
}

.today-dot {
	width: 10px;
	height: 10px;
	background: #00e676;
	border-radius: 50%;
	animation: pulse-dot 2s ease-in-out infinite;
    box-shadow: 0 0 10px rgba(0, 230, 118, 0.4);
}

@keyframes pulse-dot {
	0%, 100% { opacity: 1; transform: scale(1); }
	50% { opacity: 0.8; transform: scale(1.1); box-shadow: 0 0 15px rgba(0, 230, 118, 0.6); }
}

.today-classes {
	display: flex;
	flex-direction: column;
	gap: var(--space-md);
	max-height: 800px;
	overflow: hidden;
	transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
	opacity: 1;
}

.today-classes.collapsed {
	max-height: 0;
	margin-top: 0;
	opacity: 0;
	pointer-events: none;
}

.today-class-item {
	display: flex;
	align-items: center;
	gap: var(--space-lg);
	padding: var(--space-lg) var(--space-xl);
	border-radius: var(--radius-md);
	cursor: pointer;
	transition: all 0.3s cubic-bezier(0.23, 1, 0.32, 1);
    border: 1px solid transparent;
}

.today-class-item:active {
	transform: scale(0.97);
    filter: brightness(1.1);
}

.today-class-time {
	font-size: 0.8rem;
	font-weight: 700;
	color: var(--text-secondary);
	min-width: 96px;
	font-variant-numeric: tabular-nums;
    letter-spacing: 0.02em;
}

.today-class-name {
	font-size: 0.95rem;
	font-weight: 700;
	flex: 1;
}

.today-class-dot {
	width: 8px;
	height: 8px;
	border-radius: 50%;
	flex-shrink: 0;
}

.today-empty {
	text-align: center;
	padding: var(--space-2xl) var(--space-xl);
	color: var(--text-muted);
	font-size: 0.9rem;
    font-weight: 500;
}

.today-empty-icon {
	font-size: 2.5rem;
	margin-bottom: var(--space-md);
    display: block;
}

/* ============================
   시간표 그리드
   ============================ */
.timetable-container {
	margin: var(--space-md) var(--space-md) var(--space-2xl);
	border-radius: var(--radius-lg);
	overflow: hidden;
	border: var(--glass-border);
	background: var(--bg-card);
	backdrop-filter: var(--glass-blur);
	-webkit-backdrop-filter: var(--glass-blur);
	box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

.timetable-scroll {
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
}

.timetable {
	width: 100%;
	border-collapse: collapse;
	table-layout: fixed;
	min-width: 360px;
}

.timetable thead th {
	position: sticky;
	top: 0;
	z-index: 10;
	padding: var(--space-xs) var(--space-xs);
	font-size: 0.85rem;
	font-weight: 800;
	color: var(--text-secondary);
	text-align: center;
	background: var(--bg-elevated);
	border-bottom: 1px solid var(--border);
	text-transform: uppercase;
	letter-spacing: 0.08em;
}

.timetable thead th.today-col {
	color: var(--course-5);
	position: relative;
    background: var(--bg-hover);
}

.timetable thead th.today-col::after {
	content: "";
	position: absolute;
	bottom: 0;
	left: 0;
	right: 0;
	height: 3px;
	background: var(--course-5);
    box-shadow: 0 0 10px var(--course-5);
}

.timetable tbody tr {
	border-bottom: 1px solid var(--border);
}

.timetable tbody td {
	position: relative;
	height: var(--cell-height);
	vertical-align: top;
	padding: 0;
}

.timetable tbody td:first-child {
	text-align: center;
	font-size: 0.75rem;
	font-weight: 700;
	color: var(--text-muted);
	padding-top: var(--space-md);
	font-variant-numeric: tabular-nums;
	border-right: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.01);
}

.timetable tbody td.today-col-cell {
	background: rgba(51, 181, 255, 0.02);
}

/* 시간표 블록 */
.course-block {
	position: absolute;
	top: 3px;
	left: 3px;
	right: 3px;
	border-radius: var(--radius-md);
	padding: var(--space-sm);
	padding-right:0;
	cursor: pointer;
	overflow: hidden;
	transition: all 0.3s cubic-bezier(0.23, 1, 0.32, 1);
	border: 1px solid rgba(255, 255, 255, 0.15);
	display: flex;
	flex-direction: column;
	justify-content: flex-start;
	z-index: 5;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
	backdrop-filter: blur(8px);
	-webkit-backdrop-filter: blur(8px);
}

.course-block:active {
	transform: scale(0.95);
	filter: brightness(1.2);
    z-index: 10;
}

.course-block .course-name {
	font-size: 0.75rem;
	font-weight: 800;
	line-height: 1.25;
	display: -webkit-box;
	line-clamp: 2;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
    letter-spacing: -0.01em;
}

.course-block .course-room {
	font-size: 0.65rem;
	opacity: 0.8;
	margin-top: 4px;
	font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ============================
   리스트 뷰
   ============================ */
.list-container {
	padding: var(--space-md) var(--space-xl) var(--space-2xl);
}

.list-day-group {
	margin-bottom: var(--space-2xl);
}

.list-day-header {
	display: flex;
	align-items: center;
	gap: var(--space-md);
	padding: var(--space-md) 0;
	font-size: 1rem;
	font-weight: 900;
	color: var(--text-primary);
	text-transform: uppercase;
	letter-spacing: 0.1em;
}

.list-day-header::after {
	content: "";
	flex: 1;
	height: 1px;
	background: linear-gradient(90deg, var(--border) 0%, transparent 100%);
}

.list-card {
	display: flex;
	gap: var(--space-lg);
	padding: var(--space-xl);
	margin-bottom: var(--space-md);
	background: var(--bg-card);
	backdrop-filter: var(--glass-blur);
	-webkit-backdrop-filter: var(--glass-blur);
	border-radius: var(--radius-lg);
	border: var(--glass-border);
	cursor: pointer;
	transition: all 0.4s cubic-bezier(0.23, 1, 0.32, 1);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.list-card:active {
	transform: scale(0.97) translateY(2px);
	background: var(--bg-elevated);
    box-shadow: none;
}

.list-card-indicator {
	width: 5px;
	border-radius: 5px;
	flex-shrink: 0;
}

.list-card-content {
	flex: 1;
}

.list-card-name {
	font-size: 1.1rem;
	font-weight: 800;
	margin-bottom: var(--space-sm);
    letter-spacing: -0.02em;
}

.list-card-meta {
	display: flex;
	flex-wrap: wrap;
	gap: var(--space-sm) var(--space-xl);
	font-size: 0.85rem;
	color: var(--text-secondary);
    font-weight: 600;
}

.list-card-meta-item {
	display: flex;
	align-items: center;
	gap: 6px;
}

/* ============================
   모달
   ============================ */
.modal-overlay {
	position: fixed;
	inset: 0;
	z-index: 1000;
	background: rgba(0, 0, 0, 0.75);
	backdrop-filter: blur(12px);
	-webkit-backdrop-filter: blur(12px);
	display: flex;
	align-items: flex-end;
	justify-content: center;
	opacity: 0;
	pointer-events: none;
	transition: opacity 0.4s ease;
}

.modal-overlay.active {
	opacity: 1;
	pointer-events: auto;
}

.modal {
	width: 100%;
	max-width: 500px;
	max-height: 85dvh;
	background: rgba(15, 15, 25, 0.7);
	backdrop-filter: var(--glass-blur);
	-webkit-backdrop-filter: var(--glass-blur);
	border-radius: var(--radius-xl) var(--radius-xl) 0 0;
	padding: var(--space-2xl);
	transform: translateY(100%);
	transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
	overflow-y: auto;
    position: relative;
    border-top: 1px solid var(--border-light);
	box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.5);
    touch-action: none; /* 드래그 구현을 위해 터치 액션 제어 */
}

.modal.dragging {
    transition: none;
}

.modal-overlay.active .modal {
	transform: translateY(0);
}

.modal-close {
	position: absolute;
	top: var(--space-lg);
	right: var(--space-lg);
	width: 36px;
	height: 36px;
	display: flex;
	align-items: center;
	justify-content: center;
	background: var(--bg-elevated);
	border: 1px solid var(--border-light);
	border-radius: 50%;
	color: var(--text-primary);
	font-size: 1.4rem;
	cursor: pointer;
	transition: all 0.3s ease;
}

.modal-close:active {
	background: var(--bg-hover);
    transform: scale(0.9);
}

.modal-handle {
	width: 50px;
	height: 6px;
	background: rgba(255, 255, 255, 0.2);
	border-radius: 10px;
	margin: -10px auto var(--space-2xl);
    cursor: grab;
    transition: background 0.3s ease;
}

.modal-handle:active {
    cursor: grabbing;
    background: rgba(255, 255, 255, 0.4);
}

.modal-course-emoji {
	font-size: 1.4rem;
	margin-right: var(--space-sm);
	vertical-align: middle;
}

.modal-course-name {
	font-size: 1.5rem;
	font-weight: 900;
	margin-bottom: var(--space-md);
	letter-spacing: -0.03em;
	display: flex;
	align-items: center;
	flex-wrap: wrap;
    line-height: 1.2;
}

.modal-course-type {
	display: inline-block;
	padding: 5px 14px;
	border-radius: 30px;
	font-size: 0.75rem;
	font-weight: 800;
	margin-bottom: var(--space-2xl);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.modal-info-list {
	list-style: none;
	display: flex;
	flex-direction: column;
	gap: var(--space-lg);
}

.modal-info-item {
	display: flex;
	align-items: flex-start;
	gap: var(--space-xl);
	padding: var(--space-lg);
	background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
	border-radius: var(--radius-md);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.modal-info-icon {
	font-size: 1.2rem;
	width: 28px;
	text-align: center;
	flex-shrink: 0;
	line-height: 1.5;
}

.modal-info-label {
	font-size: 0.7rem;
	color: var(--text-muted);
	font-weight: 800;
	text-transform: uppercase;
	letter-spacing: 0.1em;
    margin-bottom: 2px;
}

.modal-info-value {
	font-size: 0.95rem;
	font-weight: 700;
	margin-top: 4px;
    line-height: 1.5;
    color: var(--text-primary);
}

/* ============================
   애니메이션
   ============================ */
@keyframes fadeInUp {
	from {
		opacity: 0;
		transform: translateY(16px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

.animate-in {
	animation: fadeInUp 0.5s cubic-bezier(0.23, 1, 0.32, 1) forwards;
}

/* ============================
   반응형
   ============================ */
@media (min-width: 480px) {
	:root {
		--cell-height: 52px;
		--time-col-width: 60px;
	}

	.header {
		padding: var(--space-md) var(--space-2xl) var(--space-md);
	}

	.timetable-container {
		margin: var(--space-md) var(--space-2xl) var(--space-2xl);
	}

	.course-block .course-name {
		font-size: 0.85rem;
	}
}

@media (min-width: 768px) {
	:root {
		--cell-height: 80px;
		--day-col-min-width: 120px;
	}

	.modal {
		border-radius: var(--radius-xl);
		margin-bottom: env(safe-area-inset-bottom, 0);
	}

	.modal-overlay {
		align-items: center;
	}

	.modal-overlay.active .modal {
		transform: translateY(0);
	}

	.modal {
		transform: translateY(32px);
        border: 1px solid var(--border-light);
	}
}

/* safe area (노치 기기) */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
	.list-container,
	.timetable-container {
		padding-bottom: calc(var(--space-2xl) + env(safe-area-inset-bottom));
	}
}
