:root {
    /* Color Palette */
    --primary: #4F46E5;
    --primary-hover: #4338CA;
    --primary-light: #EEF2FF;
    --background: #F8FAFC;
    --surface: #FFFFFF;
    --surface-glass: rgba(255, 255, 255, 0.85);
    --border: #E2E8F0;
    --text-main: #0F172A;
    --text-muted: #64748B;
    
    /* Status Colors */
    --intensive: #E11D48; /* 집중 */
    --intensive-bg: #FFE4E6;
    --daily: #D97706; /* 일상 */
    --daily-bg: #FEF3C7;
    --loose: #059669; /* 느슨한 */
    --loose-bg: #D1FAE5;
    
    --success: #10B981;
    --warning: #F59E0B;
    --danger: #EF4444;

    /* Shadows & Transitions */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    
    --sidebar-width: 260px;
}

[data-theme="dark"] {
    --primary: #6366F1;
    --primary-hover: #818CF8;
    --primary-light: rgba(99, 102, 241, 0.1);
    --background: #0F172A;
    --surface: #1E293B;
    --surface-glass: rgba(30, 41, 59, 0.85);
    --border: #334155;
    --text-main: #F8FAFC;
    --text-muted: #94A3B8;
    
    --intensive-bg: rgba(225, 29, 72, 0.2);
    --daily-bg: rgba(217, 119, 6, 0.2);
    --loose-bg: rgba(5, 150, 105, 0.2);
    
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Outfit', 'Noto Sans KR', sans-serif;
}

body {
    background-color: var(--background);
    color: var(--text-main);
    display: flex;
    height: 100vh;
    overflow: hidden;
    transition: var(--transition);
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* Typography */
h1, h2, h3, h4, h5, h6 { font-weight: 600; color: var(--text-main); }
a { text-decoration: none; color: inherit; }
button { cursor: pointer; border: none; outline: none; font-family: inherit; }
input, select, textarea { font-family: inherit; }

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: 10;
    transition: var(--transition);
}

.sidebar-header {
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--border);
}

.sidebar-header i { font-size: 24px; color: var(--primary); }
.sidebar-header h2 { font-size: 1.25rem; font-weight: 700; letter-spacing: -0.02em; }

.nav-links {
    flex: 1;
    padding: 24px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow-y: auto;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 12px;
    color: var(--text-muted);
    font-weight: 500;
    transition: var(--transition);
}

.nav-link:hover {
    background: var(--primary-light);
    color: var(--primary);
    transform: translateX(4px);
}

.nav-link.active {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

.nav-link i { font-size: 1.1rem; width: 24px; text-align: center; }

.sidebar-footer {
    padding: 24px;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.user-info { display: flex; align-items: center; gap: 12px; }
.avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--primary-light); color: var(--primary); display: flex; align-items: center; justify-content: center; font-weight: 700; }
.user-details h4 { font-size: 0.9rem; }
.user-details p { font-size: 0.8rem; color: var(--text-muted); }

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.topbar {
    height: 72px;
    background: var(--surface-glass);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    z-index: 5;
}

.search-bar {
    display: flex;
    align-items: center;
    background: var(--background);
    padding: 8px 16px;
    border-radius: 24px;
    width: 300px;
    border: 1px solid var(--border);
}
.search-bar i { color: var(--text-muted); margin-right: 8px; }
.search-bar input { border: none; background: transparent; color: var(--text-main); width: 100%; outline: none; }

.topbar-actions { display: flex; align-items: center; gap: 16px; }
.icon-btn { width: 40px; height: 40px; border-radius: 50%; background: transparent; color: var(--text-muted); display: flex; align-items: center; justify-content: center; transition: var(--transition); font-size: 1.1rem; }
.icon-btn:hover { background: var(--background); color: var(--primary); }

.content-area {
    flex: 1;
    padding: 32px;
    overflow-y: auto;
    position: relative;
}

/* Page Transitions */
.page { display: none; animation: fadeIn 0.4s ease forwards; }
.page.active { display: block; }

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Utilities */
.glass-card {
    background: var(--surface);
    border-radius: 16px;
    padding: 24px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border);
    transition: var(--transition);
}
.glass-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); }

.badge { padding: 4px 10px; border-radius: 12px; font-size: 0.75rem; font-weight: 600; display: inline-block; }
.badge.intensive { background: var(--intensive-bg); color: var(--intensive); }
.badge.daily { background: var(--daily-bg); color: var(--daily); }
.badge.loose { background: var(--loose-bg); color: var(--loose); }

.btn { padding: 10px 20px; border-radius: 8px; font-weight: 600; display: inline-flex; align-items: center; gap: 8px; transition: var(--transition); }
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-hover); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3); }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text-main); }
.btn-outline:hover { background: var(--background); border-color: var(--text-muted); }

/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 24px;
}

.stat-card {
    grid-column: span 3;
    display: flex;
    align-items: center;
    gap: 16px;
}
.stat-icon { width: 56px; height: 56px; border-radius: 16px; display: flex; align-items: center; justify-content: center; font-size: 1.5rem; }
.stat-icon.primary { background: var(--primary-light); color: var(--primary); }
.stat-icon.danger { background: var(--intensive-bg); color: var(--intensive); }
.stat-icon.warning { background: var(--daily-bg); color: var(--daily); }
.stat-icon.success { background: var(--loose-bg); color: var(--loose); }
.stat-info h3 { font-size: 1.8rem; line-height: 1; margin-bottom: 4px; }
.stat-info p { color: var(--text-muted); font-size: 0.9rem; }

@media (max-width: 1200px) { .stat-card { grid-column: span 6; } }

.main-panel { grid-column: span 8; }
.side-panel { grid-column: span 4; display: flex; flex-direction: column; gap: 24px; }
@media (max-width: 1024px) { .main-panel, .side-panel { grid-column: span 12; } }

/* Headers inside cards */
.card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.card-header h3 { font-size: 1.1rem; }

/* Lists */
.task-list, .activity-list { list-style: none; display: flex; flex-direction: column; gap: 12px; }
.task-item { display: flex; align-items: flex-start; gap: 12px; padding: 12px; border-radius: 12px; background: var(--background); transition: var(--transition); border: 1px solid transparent; }
.task-item:hover { border-color: var(--border); }
.task-item.completed { opacity: 0.6; }
.task-item.completed .task-content h4 { text-decoration: line-through; }
.task-checkbox { margin-top: 4px; cursor: pointer; width: 18px; height: 18px; accent-color: var(--primary); }
.task-content h4 { font-size: 0.95rem; margin-bottom: 4px; }
.task-content p { font-size: 0.8rem; color: var(--text-muted); display: flex; align-items: center; gap: 4px; }

/* Client Table */
.table-container { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 16px; text-align: left; border-bottom: 1px solid var(--border); }
th { color: var(--text-muted); font-weight: 500; font-size: 0.9rem; text-transform: uppercase; letter-spacing: 0.05em; }
tbody tr { transition: var(--transition); }
tbody tr:hover { background: var(--background); cursor: pointer; }
.client-name-cell { display: flex; align-items: center; gap: 12px; font-weight: 600; }
.client-avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--primary-light); color: var(--primary); display: flex; align-items: center; justify-content: center; font-size: 0.8rem; }

/* AI SOAP Studio */
.soap-container { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; height: calc(100vh - 200px); }
@media (max-width: 1024px) { .soap-container { grid-template-columns: 1fr; height: auto; } }
.soap-input, .soap-output { display: flex; flex-direction: column; }
.input-area { flex: 1; resize: none; border: 1px solid var(--border); border-radius: 12px; padding: 16px; background: var(--background); color: var(--text-main); font-size: 1rem; line-height: 1.6; outline: none; transition: var(--transition); margin-bottom: 16px; }
.input-area:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }
.soap-result-box { flex: 1; border: 1px solid var(--border); border-radius: 12px; padding: 20px; background: var(--background); overflow-y: auto; }
.soap-section { margin-bottom: 16px; }
.soap-section h4 { color: var(--primary); margin-bottom: 8px; font-size: 0.9rem; text-transform: uppercase; letter-spacing: 0.05em; }
.soap-section p { font-size: 0.95rem; line-height: 1.5; }

/* Modals */
.modal-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.5); backdrop-filter: blur(4px); display: flex; align-items: center; justify-content: center; z-index: 100; opacity: 0; pointer-events: none; transition: var(--transition); }
.modal-overlay.active { opacity: 1; pointer-events: all; }
.modal-content { background: var(--surface); border-radius: 20px; width: 100%; max-width: 600px; max-height: 90vh; overflow-y: auto; padding: 32px; transform: translateY(20px); transition: var(--transition); box-shadow: var(--shadow-lg); }
.modal-overlay.active .modal-content { transform: translateY(0); }
.form-group { margin-bottom: 20px; }
.form-group label { display: block; margin-bottom: 8px; font-weight: 500; font-size: 0.9rem; }
.form-control { width: 100%; padding: 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--background); color: var(--text-main); font-size: 0.95rem; outline: none; transition: var(--transition); }
.form-control:focus { border-color: var(--primary); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* Animations */
.ai-processing { display: flex; align-items: center; gap: 12px; color: var(--primary); font-weight: 600; margin-top: 16px; }
.spinner { width: 24px; height: 24px; border: 3px solid var(--primary-light); border-top-color: var(--primary); border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Profile View */
.profile-header { display: flex; align-items: center; gap: 24px; margin-bottom: 32px; }
.profile-avatar { width: 80px; height: 80px; border-radius: 50%; background: var(--primary-light); color: var(--primary); font-size: 2rem; display: flex; align-items: center; justify-content: center; font-weight: 700; }
.profile-info h2 { font-size: 1.8rem; margin-bottom: 8px; }
.profile-tags { display: flex; gap: 8px; margin-top: 8px; }
.timeline { border-left: 2px solid var(--border); padding-left: 24px; margin-top: 24px; display: flex; flex-direction: column; gap: 24px; }
.timeline-item { position: relative; }
.timeline-item::before { content: ''; position: absolute; left: -31px; top: 0; width: 12px; height: 12px; border-radius: 50%; background: var(--primary); border: 3px solid var(--surface); }
.timeline-date { font-size: 0.8rem; color: var(--text-muted); margin-bottom: 4px; }
.timeline-content { background: var(--background); padding: 16px; border-radius: 12px; border: 1px solid var(--border); }
