:root {
    --primary-color: #4F46E5;
    --primary-hover: #4338CA;
    --bg-color: #F8FAFC;
    --text-main: #0F172A;
    --text-muted: #64748B;
    --border-color: #E2E8F0;
    --card-bg: #FFFFFF;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    min-height: 100dvh;
    padding: 0.75rem;
    overflow-x: hidden;
}

/* 전체 컨테이너 카드 디자인 */
.container {
    background: var(--card-bg); 
    width: 100%; 
    max-width: 900px;
    min-height: 88vh;
    max-height: 96vh;
    overflow-y: auto;
    border-radius: 24px; 
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.06);
    border: 1px solid rgba(226, 232, 240, 0.8);
    padding: 1.75rem; 
    margin: auto;
    display: flex;
    flex-direction: column;
    animation: fadeIn 0.35s ease-out;
}

@media (max-width: 768px) {
    .container {
        padding: 1rem;
        max-width: 100%;
        min-height: 94vh;
        border-radius: 16px;
        margin: 0;
    }
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

h2 { text-align: center; margin-bottom: 0.25rem; font-weight: 700; font-size: 1.4rem; letter-spacing: -0.02em; }
p.subtitle { text-align: center; color: var(--text-muted); margin-bottom: 1.25rem; font-size: 0.9rem; }
.divider { margin: 1.25rem 0; border: 0; border-top: 1px solid var(--border-color); }

.input-group { margin-bottom: 1.1rem; }
.input-group label { display: block; margin-bottom: 0.4rem; font-size: 0.9rem; font-weight: 600; color: #334155; }

input {
    width: 100%; 
    padding: 0.8rem 1rem; 
    border: 1px solid var(--border-color);
    border-radius: 12px; 
    font-size: 1rem; 
    transition: all 0.2s; 
    font-family: inherit;
    background-color: #F8FAFC;
    color: var(--text-main);
    appearance: none;
    -webkit-appearance: none;
}

input:focus { 
    outline: none; 
    background-color: #ffffff;
    border-color: var(--primary-color); 
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.1); 
}

input[type="time"]::-webkit-calendar-picker-indicator {
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.2s;
}
input[type="time"]::-webkit-calendar-picker-indicator:hover {
    opacity: 1;
}

.color-picker {
    display: flex;
    gap: 10px;
    margin-top: 0.5rem;
    justify-content: center;
}
.color-chip {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid transparent;
    outline: none;
    transition: transform 0.2s, box-shadow 0.2s;
    padding: 0;
    position: relative;
}
.color-chip:hover {
    transform: scale(1.08);
}
.color-chip.selected {
    transform: scale(1.12);
    box-shadow: 0 0 0 3px white, 0 0 0 6px var(--primary-color);
}
.color-chip.selected::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 1.1rem;
    font-weight: 900;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}

button.btn-main {
    width: 100%; padding: 0.9rem; background-color: var(--primary-color);
    color: white; border: none; border-radius: 12px; font-size: 1rem;
    font-weight: 600; cursor: pointer; transition: background-color 0.2s, transform 0.1s; margin-top: 0.5rem;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.25);
}
button.btn-main:hover { background-color: var(--primary-hover); }
button.btn-main:active { transform: scale(0.98); }

button.btn-danger {
    width: 100%; padding: 0.9rem; background-color: #EF4444;
    color: white; border: none; border-radius: 12px; font-size: 1rem;
    font-weight: 600; cursor: pointer; transition: background-color 0.2s;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.25);
}
button.btn-danger:hover { background-color: #DC2626; }

/* 캘린더 상단 네비게이션 */
.calendar-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.25rem; }
.calendar-header button { padding: 0.5rem 0.9rem; background-color: #F1F5F9; color: var(--text-main); border: none; border-radius: 10px; cursor: pointer; font-size: 0.9rem; font-weight: 600; transition: background-color 0.2s; }
.calendar-header button:hover { background-color: #E2E8F0; }

.weekdays { display: grid; grid-template-columns: repeat(7, 1fr); text-align: center; font-weight: 700; font-size: 0.85rem; color: var(--text-muted); margin-bottom: 0.5rem; }
.days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; flex-grow: 1; }

/* 모바일 세로 늘어짐 방지 및 균형 잡힌 날짜 칸 디자인 */
.day { 
    min-height: 85px; 
    max-height: 115px;
    border: 1px solid var(--border-color); 
    border-radius: 10px; 
    padding: 3px; 
    cursor: pointer; 
    display: flex; 
    flex-direction: column; 
    transition: all 0.2s; 
    overflow: hidden; 
    background-color: #ffffff;
}
@media (max-width: 768px) {
    .day { min-height: 68px; max-height: 95px; padding: 2px; }
}
.day:hover { border-color: var(--primary-color); background-color: #FAFAFA; }
.day.empty { border: none; cursor: default; background: transparent; }
.day.empty:hover { border-color: transparent; background: transparent; }

.day.today { 
    border: 2px solid var(--primary-color); 
    background-color: #F8FAFC; 
}

.day-num { font-size: 0.8rem; font-weight: 600; margin-bottom: 3px; color: var(--text-muted); text-align: right; padding-right: 3px; }
.day.today .day-num { color: var(--primary-color); font-weight: 800; }

.event {
    font-size: 0.7rem; 
    padding: 2px 5px; 
    border-radius: 6px;
    margin-bottom: 2px; 
    overflow: hidden; 
    text-overflow: ellipsis; 
    white-space: nowrap; 
    font-weight: 700;
    background-color: #FFFFFF;
    border-width: 1.5px;
    border-style: solid;
    box-shadow: 0 1px 2px rgba(0,0,0,0.02);
}
@media (max-width: 768px) {
    .event { font-size: 0.62rem; padding: 1px 3px; }
}

/* 모달 팝업 디자인 */
.modal-overlay {
    display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background-color: rgba(15, 23, 42, 0.6); backdrop-filter: blur(4px);
    z-index: 999; justify-content: center; align-items: center;
    padding: 1rem;
}
.modal-overlay.active { display: flex; animation: fadeIn 0.2s ease-out; }

.confirm-overlay { z-index: 1000; }
.confirm-content { max-width: 340px; padding: 1.75rem; }

.modal-content {
    background-color: white; width: 100%; max-width: 440px; padding: 1.75rem; border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.15); max-height: 88vh; overflow-y: auto;
    animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

.event-list { display: flex; flex-direction: column; gap: 0.6rem; max-height: 280px; overflow-y: auto; padding-right: 2px; }

.event-item {
    display: flex; justify-content: space-between; align-items: center;
    background-color: #F8FAFC; padding: 0.75rem 0.9rem; border-radius: 12px; border: 1px solid #E2E8F0;
    transition: transform 0.1s;
}
.event-item:hover { border-color: #CBD5E1; }

.event-info { flex-grow: 1; padding-right: 10px; }
.event-time { font-weight: 700; color: #475569; font-size: 0.85rem; margin-right: 6px; }

.event-name { 
    font-weight: 700; 
    font-size: 0.85rem; 
    padding: 2px 7px; 
    border-radius: 6px; 
    border-width: 1.5px;
    border-style: solid;
    display: inline-block;
}

.event-desc { font-size: 0.82rem; color: #64748B; margin-top: 5px; word-break: break-all; font-weight: 500; }
.no-events { text-align: center; color: var(--text-muted); font-size: 0.9rem; padding: 1.2rem 0; }

.event-actions { display: flex; gap: 6px; align-items: center; }

.btn-icon { 
    background: #FFFFFF; border: 1px solid #CBD5E1; border-radius: 8px; 
    font-size: 1.1rem; cursor: pointer; 
    width: 36px; height: 36px;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
    transition: all 0.2s;
}
.btn-icon:hover { transform: scale(1.06); background-color: #F1F5F9; }
.btn-edit { color: #3B82F6; border-color: #BFDBFE; background-color: #EFF6FF; }
.btn-delete { color: #EF4444; border-color: #FECACA; background-color: #FEF2F2; font-weight: bold; } 

.modal-buttons { display: flex; gap: 8px; margin-top: 1.25rem; }
.btn-cancel { width: 100%; padding: 0.85rem; background-color: #F1F5F9; color: #475569; border: none; border-radius: 10px; font-size: 0.95rem; font-weight: 600; cursor: pointer; transition: background-color 0.2s; }
.btn-cancel:hover { background-color: #E2E8F0; }

.recent-rooms-list {
    display: flex; flex-wrap: wrap; gap: 6px; justify-content: center;
}
.recent-room-chip {
    background-color: #EEF2FF; color: var(--primary-color);
    border: 1px solid #C7D2FE; border-radius: 999px;
    padding: 0.45rem 0.9rem; font-size: 0.85rem; font-weight: 600;
    cursor: pointer; transition: all 0.2s;
}
.recent-room-chip:hover {
    background-color: var(--primary-color); color: white;
    transform: translateY(-1px);
    box-shadow: 0 3px 6px rgba(79, 70, 229, 0.2);
}