:root {
    --bg-primary: #0f0e17;
    --bg-secondary: #1a1a2e;
    --bg-card: rgba(26, 26, 46, 0.8);
    --bg-card-hover: rgba(26, 26, 46, 0.95);
    --text-primary: #e8e8e8;
    --text-secondary: #a0a0b0;
    --accent-primary: #6c63ff;
    --accent-secondary: #ff6584;
    --accent-gradient: linear-gradient(135deg, #6c63ff, #ff6584);
    --success: #4ecdc4;
    --warning: #ffd93d;
    --danger: #ff6b6b;
    --border: rgba(255,255,255,0.08);
    --shadow: 0 8px 32px rgba(0,0,0,0.3);
    --radius: 14px;
    --radius-sm: 8px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="light"] {
    --bg-primary: #f5f5f7;
    --bg-secondary: #ffffff;
    --bg-card: rgba(255,255,255,0.9);
    --bg-card-hover: rgba(255,255,255,1);
    --text-primary: #1a1a2e;
    --text-secondary: #666680;
    --border: rgba(0,0,0,0.08);
    --shadow: 0 8px 32px rgba(0,0,0,0.08);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: 'Inter', sans-serif; background-color: var(--bg-primary); color: var(--text-primary); overflow-x: hidden; }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: var(--accent-primary); border-radius: var(--radius-sm); }
::selection { background: var(--accent-primary); color: #fff; }

/* Layout */
#app-container { display: none; min-height: 100vh; }
#app-container.active { display: flex; }

/* Login Screen */
#login-screen { position: fixed; inset: 0; display: none; align-items: center; justify-content: center; z-index: 9999; }
#login-screen.active { display: flex; }
.login-background { position: absolute; inset: 0; background: linear-gradient(-45deg, #0f0e17, #1a1a2e, #2d1b4e, #4a1c40); background-size: 400% 400%; animation: gradientShift 15s ease infinite; z-index: -1; }
.login-card { background: var(--bg-card); backdrop-filter: blur(20px); padding: 3rem; border-radius: var(--radius); border: 1px solid var(--border); text-align: center; box-shadow: var(--shadow); animation: slideUp 0.6s ease; }
.login-card h1 { font-size: 2.5rem; background: var(--accent-gradient); -webkit-background-clip: text; -webkit-text-fill-color: transparent; margin-bottom: 0.5rem; }
.login-card p { color: var(--text-secondary); margin-bottom: 2rem; }

/* Sidebar */
#sidebar { width: 260px; background: var(--bg-secondary); border-right: 1px solid var(--border); display: flex; flex-direction: column; padding: 1.5rem; transition: var(--transition); }
.nav-item { display: flex; align-items: center; padding: 0.8rem 1rem; color: var(--text-secondary); text-decoration: none; border-radius: var(--radius-sm); margin-bottom: 0.5rem; transition: var(--transition); cursor: pointer; }
.nav-item:hover { background: rgba(108, 99, 255, 0.1); color: var(--accent-primary); }
.nav-item.active { background: var(--accent-gradient); color: #fff; font-weight: 500; }
.nav-icon { margin-right: 1rem; font-size: 1.2rem; }
.user-profile { margin-top: auto; display: flex; align-items: center; padding-top: 1rem; border-top: 1px solid var(--border); }
.user-avatar-img { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; margin-right: 1rem; background: var(--accent-primary); }
.user-info { flex: 1; }
.user-info .name { font-weight: 600; font-size: 0.9rem; }
.user-info .logout { color: var(--danger); font-size: 0.8rem; cursor: pointer; }

/* Main Content */
#main-content { flex: 1; display: flex; flex-direction: column; height: 100vh; overflow-y: auto; }
#top-bar { position: sticky; top: 0; background: rgba(15, 14, 23, 0.8); backdrop-filter: blur(10px); padding: 1rem 2rem; display: flex; justify-content: space-between; align-items: center; z-index: 10; border-bottom: 1px solid var(--border); }
[data-theme="light"] #top-bar { background: rgba(245, 245, 247, 0.8); }
.search-container input { background: var(--bg-secondary); border: 1px solid var(--border); padding: 0.6rem 1rem; border-radius: 20px; color: var(--text-primary); width: 300px; outline: none; transition: var(--transition); }
.search-container input:focus { border-color: var(--accent-primary); box-shadow: 0 0 0 2px rgba(108,99,255,0.2); }
.top-bar-actions { display: flex; align-items: center; gap: 1rem; }
#theme-toggle { background: none; border: none; font-size: 1.2rem; cursor: pointer; color: var(--text-primary); }
#mobile-menu-btn { display: none; background: none; border: none; font-size: 1.5rem; color: var(--text-primary); cursor: pointer; }
.user-avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--accent-primary); }

/* Page Content */
#page-content { padding: 2rem; animation: fadeIn 0.4s ease; }
.page-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 2rem; }
.page-title { font-size: 1.8rem; font-weight: 700; }
.btn-primary { background: var(--accent-gradient); color: #fff; border: none; padding: 0.6rem 1.2rem; border-radius: var(--radius-sm); font-weight: 600; cursor: pointer; transition: var(--transition); box-shadow: 0 4px 15px rgba(108, 99, 255, 0.3); }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(108, 99, 255, 0.4); }
.btn-secondary { background: transparent; color: var(--text-primary); border: 1px solid var(--border); padding: 0.6rem 1.2rem; border-radius: var(--radius-sm); font-weight: 500; cursor: pointer; transition: var(--transition); }
.btn-secondary:hover { background: var(--bg-secondary); }

/* Grids & Cards */
.grid-container { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1.5rem; }
.card { background: var(--bg-card); backdrop-filter: blur(10px); border-radius: var(--radius); border: 1px solid var(--border); padding: 1.5rem; transition: var(--transition); position: relative; overflow: hidden; }
.card:hover { transform: translateY(-4px); background: var(--bg-card-hover); box-shadow: var(--shadow); border-color: rgba(108,99,255,0.3); }

/* Specific Cards */
.note-card { border-top-width: 4px; }
.media-card { display: flex; gap: 1rem; }
.media-poster { width: 80px; height: 120px; border-radius: var(--radius-sm); object-fit: cover; background: var(--bg-secondary); }
.media-info { flex: 1; display: flex; flex-direction: column; }
.media-title { font-weight: 600; font-size: 1.1rem; margin-bottom: 0.3rem; }
.media-meta { color: var(--text-secondary); font-size: 0.85rem; margin-bottom: 0.5rem; }
.badge { display: inline-block; padding: 0.2rem 0.6rem; border-radius: 20px; font-size: 0.75rem; font-weight: 600; margin-bottom: 0.5rem; align-self: flex-start; }
.badge-blue { background: rgba(78, 205, 196, 0.1); color: var(--success); }
.badge-green { background: rgba(78, 205, 196, 0.1); color: var(--success); }
.badge-yellow { background: rgba(255, 217, 61, 0.1); color: var(--warning); }
.badge-red { background: rgba(255, 107, 107, 0.1); color: var(--danger); }

/* Progress Bar */
.progress-bar { height: 6px; background: var(--bg-secondary); border-radius: 3px; overflow: hidden; margin-top: 0.5rem; }
.progress-fill { height: 100%; background: var(--accent-gradient); width: 0%; transition: width 0.3s ease; }

/* Todos */
.todo-item { display: flex; align-items: center; padding: 1rem; background: var(--bg-card); border-radius: var(--radius-sm); border: 1px solid var(--border); margin-bottom: 0.5rem; transition: var(--transition); }
.todo-item.completed .todo-title { text-decoration: line-through; color: var(--text-secondary); }
.todo-checkbox { width: 20px; height: 20px; border-radius: 4px; border: 2px solid var(--accent-primary); margin-right: 1rem; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.todo-item.completed .todo-checkbox { background: var(--accent-primary); }
.todo-checkbox::after { content: '✓'; color: #fff; font-size: 12px; display: none; }
.todo-item.completed .todo-checkbox::after { display: block; }
.todo-title { flex: 1; font-weight: 500; }
.priority-dot { width: 10px; height: 10px; border-radius: 50%; margin-left: 1rem; }
.priority-high { background: var(--danger); }
.priority-medium { background: var(--warning); }
.priority-low { background: var(--success); }

/* Modals */
#modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.6); backdrop-filter: blur(5px); z-index: 100; display: none; align-items: center; justify-content: center; opacity: 0; transition: opacity 0.3s ease; }
#modal-overlay.active { display: flex; opacity: 1; }
.modal { background: var(--bg-primary); width: 90%; max-width: 500px; border-radius: var(--radius); border: 1px solid var(--border); box-shadow: var(--shadow); transform: translateY(20px); transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1); }
#modal-overlay.active .modal { transform: translateY(0); }
.modal-header { padding: 1.5rem; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.modal-body { padding: 1.5rem; }
.modal-footer { padding: 1.5rem; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 1rem; }
.close-modal { background: none; border: none; color: var(--text-secondary); font-size: 1.5rem; cursor: pointer; }
.form-group { margin-bottom: 1.2rem; }
.form-group label { display: block; margin-bottom: 0.5rem; font-size: 0.9rem; color: var(--text-secondary); }
.form-control { width: 100%; background: var(--bg-secondary); border: 1px solid var(--border); padding: 0.8rem; border-radius: var(--radius-sm); color: var(--text-primary); outline: none; transition: var(--transition); }
.form-control:focus { border-color: var(--accent-primary); }
textarea.form-control { resize: vertical; min-height: 100px; }

/* Toasts */
#toast-container { position: fixed; bottom: 20px; right: 20px; z-index: 1000; display: flex; flex-direction: column; gap: 10px; }
.toast { background: var(--bg-card); backdrop-filter: blur(10px); border: 1px solid var(--border); padding: 1rem 1.5rem; border-radius: var(--radius-sm); box-shadow: var(--shadow); color: var(--text-primary); animation: slideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1); position: relative; overflow: hidden; min-width: 250px; }
.toast-success { border-left: 4px solid var(--success); }
.toast-error { border-left: 4px solid var(--danger); }
.toast-info { border-left: 4px solid var(--accent-primary); }
.toast-progress { position: absolute; bottom: 0; left: 0; height: 3px; background: rgba(255,255,255,0.2); width: 100%; transition: width linear; }

/* Animations */
@keyframes gradientShift { 0% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } 100% { background-position: 0% 50%; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(30px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideIn { from { opacity: 0; transform: translateX(100%); } to { opacity: 1; transform: translateX(0); } }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(108, 99, 255, 0.4); } 70% { box-shadow: 0 0 0 10px rgba(108, 99, 255, 0); } 100% { box-shadow: 0 0 0 0 rgba(108, 99, 255, 0); } }
.skeleton { background: linear-gradient(90deg, var(--bg-secondary) 25%, var(--bg-card) 50%, var(--bg-secondary) 75%); background-size: 200% 100%; animation: shimmer 1.5s infinite; border-radius: var(--radius-sm); }
@keyframes shimmer { 0% { background-position: -200% 0; } 100% { background-position: 200% 0; } }

/* Filters */
.filter-tabs { display: flex; gap: 1rem; margin-bottom: 1.5rem; overflow-x: auto; padding-bottom: 0.5rem; }
.filter-tab { background: transparent; border: 1px solid var(--border); color: var(--text-secondary); padding: 0.5rem 1rem; border-radius: 20px; cursor: pointer; transition: var(--transition); white-space: nowrap; }
.filter-tab:hover { border-color: var(--accent-primary); color: var(--text-primary); }
.filter-tab.active { background: var(--accent-primary); color: #fff; border-color: var(--accent-primary); }

/* Empty State */
.empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 4rem 2rem; text-align: center; color: var(--text-secondary); }
.empty-state-icon { font-size: 4rem; margin-bottom: 1rem; opacity: 0.5; }

/* Responsive */
@media (max-width: 768px) {
    #sidebar { position: fixed; transform: translateX(-100%); z-index: 50; height: 100vh; }
    #sidebar.active { transform: translateX(0); }
    #mobile-menu-btn { display: block; }
    .search-container input { width: 150px; }
}
@media (max-width: 480px) {
    .grid-container { grid-template-columns: 1fr; }
    .search-container { display: none; }
}
