@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+SC:wght@400;500;700&display=swap');

:root {
    --font-family: 'Noto Sans SC', sans-serif;
    --bg-main: #f5f7fa;
    --bg-card: #ffffff;
    --text-primary: #212529;
    --text-secondary: #6c757d;
    --accent: #20c997; /* Teal */
    --accent-light: #e8f9f4;
    --danger: #dc3545;
    --border-color: #e9ecef;
    --input-bg: #f8f9fa;
    --shadow: 0 8px 24px rgba(0, 0, 0, 0.05);
    --line-height: 1.7;
    --letter-spacing: 0.5px;
}

/* Base Styles */
body { font-family: var(--font-family); margin: 0; background-color: var(--bg-main); color: var(--text-primary); line-height: var(--line-height); letter-spacing: var(--letter-spacing); }
* { transition: all 0.15s ease-out; }

.app-container { max-width: 1200px; margin: 5vh auto; padding: 0 30px; }
.app-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px; padding: 0 10px; }
.app-header h1 { font-size: 28px; margin: 0; font-weight: 700; color: var(--accent); }
#date-display { color: var(--text-primary); font-size: 20px; font-weight: 500; margin-left: 10px; }

.content-grid { display: grid; grid-template-columns: 1fr 380px; gap: 30px; align-items: start; }
.card { background-color: var(--bg-card); padding: 30px; border-radius: 16px; box-shadow: var(--shadow); border: 1px solid var(--border-color); }
#view-container { min-height: 500px; display: flex; flex-direction: column; }

/* Buttons & Inputs */
.action-btn { background: #fff; border: 1px solid var(--border-color); color: var(--text-primary); padding: 8px 16px; border-radius: 8px; cursor: pointer; font-weight: 500; }
.action-btn:hover { background: var(--input-bg); }

/* Timer View */
.timer-view { text-align: center; margin: auto 0; padding: 50px 0; }
.current-habit-title { font-size: 28px; font-weight: 500; margin-top: 0; color: var(--text-secondary); }
.timer-display { font-size: 110px; font-weight: 700; margin: 25px 0; font-family: system-ui, -apple-system; line-height: 1; color: var(--text-primary); }
.progress-bar { width: 80%; max-width: 400px; height: 16px; background-color: var(--input-bg); border-radius: 8px; margin: 0 auto 40px; overflow: hidden; }
.progress-bar-inner { width: 0%; height: 100%; background-color: var(--accent); border-radius: 8px; transition: none; /* Turn off transition for smooth timer update */ }
.stop-btn { background-color: transparent; color: var(--danger); padding: 10px 25px; border-radius: 8px; border: 1px solid var(--danger); cursor: pointer; font-weight: 500; margin-top: 20px; }
.stop-btn:hover { background-color: rgba(220, 53, 69, 0.05); }

/* Habits List View */
.habits-today-view { display: flex; flex-direction: column; height: 100%; }
.habits-today-view h2 { margin-top: 0; padding-bottom: 15px; border-bottom: 1px solid var(--border-color); font-weight: 700; font-size: 24px; }
.habits-list { list-style: none; padding: 0; margin: 0; flex-grow: 1; }
.habit-item { display: flex; align-items: center; padding: 18px 10px; border-bottom: 1px solid var(--border-color); gap: 15px; }
.habit-item:last-child { border-bottom: none; }
.habit-info { flex-grow: 1; }
.habit-name { font-weight: 500; font-size: 18px; }
.habit-duration { color: var(--text-secondary); font-size: 14px; }
.start-habit-btn { background-color: var(--accent); color: #fff; border: none; padding: 12px 20px; border-radius: 8px; cursor: pointer; font-weight: 500; white-space: nowrap; }
.start-habit-btn:hover { background-color: #1aa67e; }
.completed-icon { width: 40px; height: 40px; display: flex; justify-content: center; align-items: center; background-color: var(--accent-light); border-radius: 50%; flex-shrink: 0; }
.completed-icon svg { width: 20px; height: 20px; color: var(--accent); stroke-width: 3; }
.habit-item.completed { background-color: var(--input-bg); }
.habit-item.completed .habit-name { text-decoration: line-through; color: var(--text-secondary); }

/* Sidebar (Right) */
.sidebar-panel { padding: 20px 25px; }
.panel-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.panel-header h2 { font-size: 20px; margin: 0; font-weight: 700; }

.add-habit-section { padding-bottom: 20px; margin-bottom: 20px; border-bottom: 1px solid var(--border-color); }
.sidebar-panel h3 { font-size: 16px; margin: 0 0 15px; font-weight: 500; color: var(--text-secondary); }

#add-habit-form { display: flex; align-items: center; gap: 8px; }
#add-habit-form input { padding: 10px 12px; border: 1px solid var(--border-color); border-radius: 8px; background-color: var(--input-bg); font-size: 14px; box-sizing: border-box; height: 44px; }
#add-habit-form input#habit-name-input { flex-grow: 1; }
#add-habit-form input#habit-duration-input { width: 80px; text-align: center; }
#add-habit-form button { background: var(--accent); color: #fff; border: none; border-radius: 8px; width: 44px; height: 44px; font-size: 24px; cursor: pointer; font-weight: 500; flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
#add-habit-form button:hover { background: #1aa67e; }

#manage-habits-list { list-style: none; padding: 0; margin: 0; max-height: 40vh; overflow-y: auto; }
.manage-habit-item { display: flex; justify-content: space-between; align-items: center; padding: 12px 5px; border-bottom: 1px solid var(--border-color); font-size: 15px; }
.manage-habit-item:last-child { border-bottom: none; }
.delete-habit-btn { background: none; border: none; cursor: pointer; color: var(--danger); opacity: 0.6; font-weight: 700; font-size: 18px; line-height: 1; margin-left: 10px; }
.manage-habit-item:hover .delete-habit-btn { opacity: 1; }

.header-actions { display: flex; gap: 8px; }
.header-actions button { width: 36px; height: 36px; display: flex; justify-content: center; align-items: center; padding: 0; background: #fff; border: 1px solid var(--border-color); border-radius: 8px; color: var(--text-secondary); cursor: pointer; }
.header-actions button:hover { background: var(--input-bg); }
.header-actions button svg { width: 18px; height: 18px; stroke-width: 2.5; }

/* Responsive */
@media (max-width: 900px) {
    .content-grid { grid-template-columns: 1fr; }
    .app-container { padding: 0 20px; }
    .sidebar-panel { margin-top: 20px; }
}

/* Footer */
.license-footer { position: fixed; bottom: 10px; left: 50%; transform: translateX(-50%); font-size: 12px; color: #ced4da; }
.license-footer a { color: inherit; text-decoration: none; }
.license-footer a:hover { color: var(--text-secondary); }