:root {
    --bg-body: #faf8f5;
    --bg-paper: #ffffff;
    --text-main: #333333;
    --text-muted: #888888;
    --border: #e0dcd3;
    --primary: #5c6ac4;
    --primary-hover: #4b58b0;
    --warning: #e76f51;
    --secondary: #9ca3af;
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    --radius: 8px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Pretendard', sans-serif;
}

body {
    background-color: var(--bg-body);
    color: var(--text-main);
    line-height: 1.5;
}

/* Navigation */
.top-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    background: var(--bg-paper);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 1px 3px rgba(0,0,0,0.02);
}

.nav-logo { font-size: 1.5rem; font-weight: 700; }
.nav-logo span { color: var(--primary); }

.nav-links { display: flex; gap: 1rem; }
.nav-btn {
    background: none; border: none; font-size: 1rem; font-weight: 600;
    padding: 0.5rem 1rem; cursor: pointer; color: var(--text-muted);
    border-radius: var(--radius); transition: all 0.2s;
}
.nav-btn:hover { background: #f0f0f0; }
.nav-btn.active { color: var(--primary); background: #eef0fa; }

/* Page Toggle */
.page-content { display: none; padding: 2rem; max-width: 1200px; margin: 0 auto; }
.page-content.active { display: block; animation: fadeIn 0.3s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* ================================= */
/* Planner Layout (EdrawMax Style)   */
/* ================================= */
.planner-layout {
    display: grid;
    grid-template-columns: 1fr 350px;
    gap: 2rem;
}
@media (max-width: 900px) {
    .planner-layout { grid-template-columns: 1fr; }
}

.section-header { margin-bottom: 1rem; display: flex; justify-content: space-between; align-items: baseline; }
.section-header h2 { font-size: 1.5rem; font-weight: 700; }
.subtitle { color: var(--text-muted); font-size: 0.9rem; }

/* Timetable */
.timetable-section { background: var(--bg-paper); padding: 1.5rem; border-radius: var(--radius); border: 1px solid var(--border); box-shadow: var(--shadow); }
.time-grid-container {
    display: flex; flex-direction: column;
    border-top: 1px solid var(--border);
    border-left: 1px solid var(--border);
}

.time-row {
    display: flex; height: 40px; border-bottom: 1px solid var(--border);
}
.time-label {
    width: 60px; display: flex; justify-content: center; align-items: center;
    font-size: 0.8rem; color: var(--text-muted); background: #f9f9f9;
    border-right: 1px solid var(--border); font-weight: 500;
}
.time-slot {
    flex: 1; border-right: 1px dashed var(--border); cursor: pointer;
    transition: background 0.2s;
}
.time-slot:last-child { border-right: none; }
.time-slot:hover { background: #f0f0f0; }

/* Sidebar Boxes */
.sidebar-section { display: flex; flex-direction: column; gap: 1.5rem; }
.box { background: var(--bg-paper); padding: 1.5rem; border-radius: var(--radius); border: 1px solid var(--border); box-shadow: var(--shadow); }
.box h2 { font-size: 1.1rem; margin-bottom: 1rem; border-bottom: 2px solid var(--border); padding-bottom: 0.5rem; }

/* Buttons & Inputs */
input[type="text"], select {
    padding: 0.5rem; border: 1px solid var(--border); border-radius: 4px; outline: none; flex: 1; font-size: 0.9rem;
}
.btn { padding: 0.5rem 1rem; border: none; border-radius: 4px; font-weight: 600; cursor: pointer; }
.btn.primary { background: var(--primary); color: white; }
.btn.warning { background: var(--warning); color: white; }
.btn.secondary { background: var(--secondary); color: white; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* Color Palette Picker */
.add-subject { display: flex; flex-direction: column; gap: 0.5rem; margin-bottom: 1rem; }
.color-palette { display: flex; gap: 0.5rem; }
.color-btn { width: 24px; height: 24px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; transition: transform 0.2s; }
.color-btn:hover { transform: scale(1.1); }
.color-btn.active { border-color: var(--text-main); transform: scale(1.1); box-shadow: 0 0 0 2px white inset; }

.subject-list { list-style: none; }
.subject-item { display: flex; justify-content: space-between; padding: 0.5rem 0; border-bottom: 1px dashed var(--border); }
.subject-info { display: flex; align-items: center; gap: 0.5rem; font-weight: 500; }
.color-dot { width: 12px; height: 12px; border-radius: 50%; }
.del-btn { background: none; border: none; color: var(--warning); cursor: pointer; font-size: 1.2rem; }

/* To-Do */
.add-todo { display: flex; flex-direction: column; gap: 0.5rem; margin-bottom: 1rem; }
.todo-list { list-style: none; max-height: 250px; overflow-y: auto; }
.todo-item { display: flex; align-items: center; gap: 0.5rem; padding: 0.5rem 0; border-bottom: 1px dashed var(--border); }
.todo-item.completed .todo-text { text-decoration: line-through; color: var(--text-muted); }
.todo-text { flex: 1; font-size: 0.95rem; }
.todo-subject-badge { font-size: 0.7rem; padding: 0.2rem 0.4rem; border-radius: 4px; background: #eee; font-weight: 600; }

/* Timer */
.timer-display { font-size: 3rem; font-weight: 700; text-align: center; color: var(--primary); margin: 1rem 0; letter-spacing: -1px; }
.timer-controls { display: flex; justify-content: center; gap: 0.5rem; }
.timer-save-area { margin-top: 1rem; display: flex; flex-direction: column; gap: 0.5rem; }

/* Stats Page */
.stats-layout { background: var(--bg-paper); padding: 2rem; border-radius: var(--radius); border: 1px solid var(--border); box-shadow: var(--shadow); }
.stats-overview { display: flex; gap: 1rem; margin-bottom: 2rem; }
.stat-card { flex: 1; padding: 1.5rem; background: #f9f9f9; border-radius: var(--radius); text-align: center; border: 1px solid var(--border); }
.stat-label { display: block; font-size: 0.9rem; color: var(--text-muted); margin-bottom: 0.5rem; }
.stat-value { font-size: 2rem; font-weight: 700; color: var(--primary); }

.charts-wrapper { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; }
.chart-box { padding: 1.5rem; border: 1px solid var(--border); border-radius: var(--radius); }
.chart-box h3 { margin-bottom: 1.5rem; font-size: 1.1rem; }

.pie-chart { width: 150px; height: 150px; border-radius: 50%; margin: 0 auto 1.5rem; background: #eee; }
.chart-legend { list-style: none; font-size: 0.9rem; }
.chart-legend li { display: flex; justify-content: space-between; margin-bottom: 0.5rem; }

.bar-chart { display: flex; align-items: flex-end; gap: 1rem; height: 150px; border-bottom: 1px solid var(--border); border-left: 1px solid var(--border); padding-left: 10px; }
.bar { flex: 1; min-width: 30px; border-radius: 4px 4px 0 0; position: relative; transition: height 0.5s; }
.bar::after { content: attr(data-label); position: absolute; bottom: -25px; left: 50%; transform: translateX(-50%); font-size: 0.8rem; white-space: nowrap; color: var(--text-muted); }
.bar::before { content: attr(data-time); position: absolute; top: -20px; left: 50%; transform: translateX(-50%); font-size: 0.8rem; font-weight: bold; }

/* Drag Selection State */
.time-slot.selected {
    background: rgba(92, 106, 196, 0.2);
    box-shadow: inset 0 0 0 2px var(--primary);
}

/* Small Subject Color Popup */
.subject-popup {
    position: absolute;
    display: none;
    flex-direction: column;
    gap: 0.8rem;
    background: var(--bg-paper);
    padding: 1rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: 0 10px 25px rgba(0,0,0,0.15);
    z-index: 1000;
    min-width: 150px;
}
.popup-title { font-size: 0.85rem; font-weight: 600; color: var(--text-muted); text-align: center; }
.popup-colors {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
}
.popup-color-dot {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid transparent;
    transition: transform 0.2s;
}
.popup-color-dot:hover {
    transform: scale(1.15);
    border-color: var(--text-main);
}
.popup-actions {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px dashed var(--border);
}
.btn.small { padding: 0.3rem 0.6rem; font-size: 0.8rem; border-radius: 4px; }

