/* DYNAMIC LIGHT/DARK MODE TOKENS */
@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700;800&display=swap');

:root {
  /* Dark mode (default) - Soft, deep, mystical */
  --bg-color: #0f172a;
  --text-color: #f8fafc;
  --accent-color: #8b5cf6;
  --accent-hover: #7c3aed;
  --accent-glow: rgba(139, 92, 246, 0.4);
  --sidebar-bg: rgba(30, 41, 59, 0.6);
  --border-color: rgba(255, 255, 255, 0.08);
  --card-bg: rgba(30, 41, 59, 0.7);
  --input-bg: transparent;
  --danger-color: #fb7185;
  --success-color: #34d399;
  --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.4);
}

[data-theme="light"] {
  /* Light mode - Cute, pastel, cloudy */
  --bg-color: #f0fdfa; /* Very soft teal tint */
  --text-color: #334155;
  --accent-color: #f472b6; /* Cute pink accent */
  --accent-hover: #db2777;
  --accent-glow: rgba(244, 114, 182, 0.4);
  --sidebar-bg: rgba(255, 255, 255, 0.6);
  --border-color: rgba(148, 163, 184, 0.2);
  --card-bg: rgba(255, 255, 255, 0.8);
  --danger-color: #f43f5e;
  --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

body, html { 
    background-color: var(--bg-color); 
    background-image: radial-gradient(circle at top left, var(--accent-glow) 0%, transparent 40%),
                      radial-gradient(circle at bottom right, rgba(52, 211, 153, 0.1) 0%, transparent 40%);
    color: var(--text-color); 
    margin: 0; 
    font-family: 'Nunito', -apple-system, sans-serif; 
    height: 100%; 
    transition: background-color 0.4s ease, color 0.4s ease;
}

.quietnotes-app { display: flex; height: 100vh; overflow: hidden; width: 100%; }

/* Glassmorphism Sidebar */
.sidebar { 
    width: 300px; 
    background-color: var(--sidebar-bg); 
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-right: 1px solid var(--border-color); 
    display: flex; 
    flex-direction: column; 
    transition: all 0.3s ease; 
}

.main-content { 
    flex: 1; 
    padding: 2.5rem 4rem; 
    display: flex; 
    flex-direction: column; 
    overflow-y: auto; 
    position: relative; 
}

/* Typography */
h1 { margin: 0; font-size: 2rem; font-weight: 800; color: var(--text-color); letter-spacing: -0.5px;}
h2 { margin: 0 0 1rem 0; font-size: 1.3rem; font-weight: 600; color: #888; }
h3 { margin: 0; font-size: 1.1rem; font-weight: 700; color: var(--text-color); }
h4 { font-weight: 700; }

/* Cute & Bouncy Buttons */
button { 
    background-color: var(--accent-color); 
    color: white; 
    border: none; 
    padding: 0.8rem 1.5rem; 
    border-radius: 100px; /* Pill shape */
    cursor: pointer; 
    font-size: 0.95rem; 
    font-weight: 700; 
    transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1); /* Bouncy transition */
    display: flex; 
    align-items: center; 
    gap: 8px; 
    box-shadow: var(--shadow-sm);
}
button:hover { 
    background-color: var(--accent-hover);
    transform: translateY(-3px) scale(1.02); 
    box-shadow: var(--shadow-md), 0 0 15px var(--accent-glow);
}
button:active { transform: translateY(1px); }

.btn-secondary { 
    background-color: var(--card-bg); 
    color: var(--text-color); 
    border: 1px solid var(--border-color); 
    box-shadow: none;
    backdrop-filter: blur(5px);
}
.btn-secondary:hover {
    background-color: var(--card-bg);
    border-color: var(--accent-color);
    box-shadow: 0 5px 15px rgba(0,0,0,0.05);
}

/* Inputs & Form Elements */
input, select, textarea {
    font-family: 'Nunito', sans-serif;
    transition: all 0.3s ease;
}
input:focus, select:focus {
    box-shadow: 0 0 0 3px var(--accent-glow);
}

/* Document List Items */
nav > div {
    border-radius: 16px;
    margin: 8px 15px;
    transition: all 0.2s ease;
}
nav > div:hover {
    background: var(--card-bg) !important;
    transform: translateX(5px);
}

/* Checklists */
.checklist-item { 
    display: flex; 
    align-items: center; 
    padding: 14px 18px; 
    margin-bottom: 12px; 
    background: var(--card-bg); 
    border-radius: 12px; 
    border: 1px solid var(--border-color); 
    cursor: pointer; 
    transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: var(--shadow-sm);
}
.checklist-item:hover { 
    border-color: var(--accent-color); 
    transform: scale(1.01);
}
.checklist-item input { 
    margin-right: 15px; 
    transform: scale(1.4); 
    cursor: pointer;
    accent-color: var(--accent-color);
}
.checklist-item.checked { 
    opacity: 0.5; 
    text-decoration: line-through; 
    background: transparent;
    box-shadow: none;
}

/* Search Modal / Modals */
.search-overlay { 
    position: fixed; inset: 0; 
    background: rgba(0,0,0,0.4); 
    backdrop-filter: blur(8px); 
    display: flex; justify-content: center; align-items: flex-start;
    padding-top: 15vh; z-index: 1000; 
    animation: fadeIn 0.3s ease;
}
.search-modal { 
    background: var(--bg-color); 
    width: 600px; max-width: 90%; 
    border-radius: 24px; 
    box-shadow: 0 25px 50px -12px rgba(0,0,0,0.5), 0 0 0 1px var(--border-color); 
    padding: 30px; 
    display: flex; flex-direction: column; 
    max-height: 80vh;
    animation: slideUp 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.search-input { 
    width: 100%; padding: 20px 24px; font-size: 1.5rem; 
    border-radius: 16px; border: 2px solid var(--border-color); 
    background: var(--card-bg); color: var(--text-color); 
    outline: none; margin-bottom: 20px; box-sizing: border-box;
    font-weight: 600;
}
.search-input:focus { border-color: var(--accent-color); box-shadow: 0 0 20px var(--accent-glow);}
.search-result { padding: 18px; border-bottom: 1px solid var(--border-color); cursor: pointer; border-radius: 12px; transition: all 0.2s;}
.search-result:hover { background: var(--accent-color); color: white; border-color: transparent;}
.search-result:hover * { color: white !important; }

/* Tags & Badges */
.tag-badge { 
    background: var(--accent-glow); 
    color: var(--accent-color); 
    padding: 6px 12px; 
    border-radius: 100px; 
    font-size: 0.75rem; 
    font-weight: 800; 
    border: 1px solid var(--accent-color); 
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
[data-theme="light"] .tag-badge { background: rgba(244, 114, 182, 0.15); color: var(--accent-color); border: 1px solid var(--accent-color); }

/* Custom Scrollbars */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent-color); }

/* Animations */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(20px) scale(0.95); } to { opacity: 1; transform: translateY(0) scale(1); } }

/* Rich Text Editor Styling */
.rich-text-editor {
    min-height: 400px;
    padding: 20px !important;
    border-radius: 16px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.05);
    transition: all 0.3s ease;
}
.rich-text-editor:focus {
    border-color: var(--accent-color);
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.05), 0 0 0 3px var(--accent-glow);
}
.rich-text-editor:empty:before {
    content: "Start typing here...";
    color: #999;
    pointer-events: none;
    display: block;
}
.rich-text-editor ul, .rich-text-editor ol { margin-left: 20px; padding-left: 10px; }
.rich-text-editor img { max-width: 100%; border-radius: 12px; margin: 15px 0; box-shadow: var(--shadow-md); }

/* Title Input */
.note-title-input {
    font-family: 'Nunito', sans-serif !important;
    letter-spacing: -1px;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
  .quietnotes-app { flex-direction: column; }
  .sidebar { width: 100%; height: 280px; flex-shrink: 0; border-right: none; border-bottom: 1px solid var(--border-color); }
  .main-content { padding: 1.5rem 1.2rem; }
  .note-body-flex { flex-direction: column !important; gap: 20px !important; }
  .note-header { flex-direction: column; align-items: flex-start !important; }
  .note-title-input { width: 100% !important; font-size: 2rem !important; }
  .search-modal { max-width: 95%; width: 100%; padding: 20px; }
  .toolbar-buttons button { flex: 1; justify-content: center; font-size: 0.85rem; padding: 0.6rem; }
}
