/* General Reset and Layout */
:root {
    --primary: #3498db;
    --primary-hover: #2980b9;
    --success: #27ae60;
    --success-hover: #219150;
    --danger: #ef4444;
    --bg-main: #f4f7f6;
    --text-main: #2d3748;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    display: flex;
    margin: 0;
    background-color: var(--bg-main);
    color: var(--text-main);
}

/* Sidebar Styling */
.history-container {
    position: relative;
}

.home-link {
    display: none;
}

/* Diary Two-Column Layout */
.diary-container {
    display: flex;
    gap: 30px;
    align-items: flex-start;
    position: relative;
}

.diary-sidebar {
    width: 60px;
    flex-shrink: 0;
    position: sticky;
    right: 0;
    top: 20px;
}

.diary-content {
    flex-grow: 1;
    min-width: 0; /* Prevents flex children from pushing width */
}

.diary-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.sidebar-nav h2 {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #94a3b8;
    margin-bottom: 15px;
}

.year-section h3 {
    color: #475569;
    font-size: 0.9rem;
    margin-bottom: 8px;
    cursor: pointer;
    font-weight: 600;
}

.year-section ul { display: none; }
.year-section.active ul { display: block; }

.sidebar-nav ul {
    list-style: none;
    padding: 0 0 0 10px;
    margin: 5px 0 15px 0;
    border-left: 2px solid #f1f5f9;
}

.sidebar-nav ul li {
    margin-bottom: 4px;
}

.sidebar-nav ul li a {
    color: #64748b;
    text-decoration: none;
    display: block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.85rem;
    transition: all 0.2s;
}

.sidebar-nav ul li a:hover {
    background: #f1f5f9;
    color: #3498db;
}

/* Main Content Area */
.main-content {
    margin: 0 auto;
    padding: 20px 40px;
    width: 100%;
    min-height: 100vh;
    max-width: 800px;
    box-sizing: border-box;
}

.top-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.nav-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-toggle {
    font-size: 24px;
    cursor: pointer;
    color: #2c3e50;
    padding: 5px;
}

.nav-logo {
    margin: 0;
    font-size: 2rem;
    color: #2c3e50;
}

/* User Menu & Dropdown */
.menu-container {
    position: relative;
    display: flex;
    align-items: center;
}

.menu-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    color: #2c3e50;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: all 0.2s;
}

.menu-btn.active {
    color: #3498db;
}

.menu-btn:hover {
    background: #f1f5f9;
}

.menu-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    width: 220px;
    background: white;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
    z-index: 2000;
    display: none;
    flex-direction: column;
    padding: 12px;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
    margin-top: 8px;
}

.menu-dropdown.active {
    display: flex;
}

.menu-profile {
    background: #f8fafc;
    padding: 10px;
    border-radius: 8px;
    margin-bottom: 12px;
    font-size: 0.8rem;
    color: #64748b;
    word-break: break-all;
}

.menu-item {
    width: 100%;
    text-align: left;
    padding: 12px;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 0.95rem;
    border-radius: 6px;
    transition: background 0.2s;
    color: #4a5568;
}

.menu-item:hover {
    background: #f1f5f9;
}

.menu-item.danger {
    color: #e74c3c;
}

/* Form Styling */
.entry-form {
    background: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
}

.form-group { margin-bottom: 20px; }
.form-group label { display: block; margin-bottom: 8px; font-weight: 600; }
.form-control, .entry-form input, .entry-form textarea, .auth-box input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 1rem;
    background-color: #f8fafc;
    transition: all 0.2s ease-in-out;
    box-sizing: border-box;
    color: #2d3748;
}

.form-control:focus, .entry-form input:focus, .entry-form textarea:focus, .auth-box input:focus {
    outline: none;
    border-color: #3498db;
    background-color: #ffffff;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.15);
}

.btn-save {
    background: #27ae60;
    color: white;
    border: none;
    padding: 12px 25px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
    transition: background 0.3s;
}

.btn-save:hover { background: #219150; }

/* Flash Messages */
.alert { padding: 15px; margin-bottom: 20px; border-radius: 6px; }
.alert-success { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }

/* Auth / Login Page Styling */
.auth-page {
    background: #2c3e50;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100vh;
}

.auth-container {
    background: white;
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.auth-container h2 {
    color: #2c3e50;
    margin-bottom: 10px;
}

.auth-container p {
    color: #7f8c8d;
    margin-bottom: 30px;
    font-size: 0.95rem;
}

.btn-primary { 
    background: #3498db; 
    color: white; 
    border: none; 
    padding: 12px; 
    border-radius: 6px; 
    width: 100%; 
    cursor: pointer; 
    font-size: 1rem;
    font-weight: 600;
    transition: background 0.3s;
}
.btn-primary:hover { background: #2980b9; }
.btn-primary:disabled { background: #bdc3c7; cursor: not-allowed; }

.error-text { 
    color: #e74c3c; 
    margin-top: 15px; 
    font-size: 0.9rem; 
    font-weight: 600;
    min-height: 1.2em;
}
.logout-link { color: #3498db; }

/* Modern Upload Button */
.upload-container {
    margin-bottom: 20px;
}

.custom-upload {
    display: block;
    padding: 20px;
    background: #f8f9fa;
    border: 2px dashed #cbd5e0;
    border-radius: 8px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.custom-upload:hover {
    background: #edf2f7;
    border-color: #3498db;
}

.custom-upload input[type="file"] {
    display: none;
}

.auth-toggle {
    margin-top: 25px;
    font-size: 0.9rem;
    color: #7f8c8d;
}
.auth-toggle a { color: #3498db; text-decoration: none; font-weight: bold; margin-left: 5px; }
.auth-toggle a:hover { text-decoration: underline; }

/* Daily Entry Styling */
.daily-entry {
    background: white;
    margin-bottom: 24px;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    position: relative;
    border: 1px solid #f1f5f9;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.daily-entry:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

.date-header {
    display: inline-block;
    background: #f1f5f9;
    padding: 4px 12px;
    border-radius: 6px;
    color: #64748b;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.025em;
    margin-bottom: 20px;
    cursor: pointer;
    user-select: none;
}

.entry-body p {
    line-height: 1.7;
    font-size: 0.9 rem;
    white-space: pre-wrap; /* Preserves line breaks from your textarea */
    color: #334155;
    margin: 0;
}

.entry-image {
    margin-top: 24px;
}

.entry-image img {
    max-width: 100%;
    height: auto;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* Top Nav Icon Styles */
.nav-action-icons {
    display: flex;
    gap: 15px;
    align-items: center;
}

.nav-action-icons button {
    background: none;
    border: none;
    font-size: 0.72rem;
    cursor: pointer;
    padding: 5px;
    transition: all 0.2s;
    color: #94a3b8;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-action-icons button:hover {
    color: #3498db;
    transform: translateY(-1px);
}

.nav-action-icons button.active {
    color: #3498db;
}

/* Month View Header Adjustments */
.view-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 30px;
}

.add-new-btn-header {
    background: #27ae60;
    color: white;
    border: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    font-size: 14.4px;
    cursor: pointer;
}

.diary-delete-btn {
    position: absolute !important;
    top: 20px;
    right: 20px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.daily-entry:hover .diary-delete-btn {
    opacity: 1;
}
.add-new-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    background: #27ae60;
    color: white;
    border: none;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    cursor: pointer;
    font-size: 12px;
}

.notepad-editor {
    width: 100%;
    min-height: 200px;
    padding: 15px;
    border: 1px solid #e2e8f0;
    border-top-left-radius: 0;
    border-top-right-radius: 0;
    border-bottom-left-radius: 8px;
    border-bottom-right-radius: 8px;
    font-size: 1.05rem;
    background-color: #f8fafc;
    color: #2d3748;
    overflow-y: auto;
    outline: none;
}

.notepad-editor:focus {
    background-color: #fff;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.15);
}

[contenteditable]:empty:before {
    content: attr(data-placeholder);
    color: #cbd5e0;
}

.editor-toolbar {
    display: flex;
    gap: 8px;
    background: #ffffff;
    padding: 10px;
    border-radius: 8px 8px 0 0;
    border: 1px solid #e2e8f0;
    border-bottom: none;
    box-shadow: inset 0 -1px 0 #f1f5f9;
}

.editor-toolbar button {
    background: transparent;
    border: none;
    border-radius: 4px;
    padding: 6px 12px;
    cursor: pointer;
    color: #4a5568;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 35px;
}

.editor-toolbar button:hover {
    background: #edf2f7;
    color: #3498db;
}

.form-actions-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 20px;
    gap: 15px;
}

.upload-label-inline {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    padding: 10px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    color: #64748b;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.upload-label-inline:hover {
    background: #f1f5f9;
    border-color: #cbd5e0;
    color: #334155;
}

.action-buttons {
    display: flex;
    gap: 12px;
}

.btn-save, .btn-cancel {
    padding: 10px 24px;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
}

.btn-cancel {
    background-color: #94a3b8;
    color: white;
}

.btn-cancel:hover {
    background-color: #64748b;
}

/* Minimalist Bible Tracker Styles */
.bible-container { padding: 0; }
.bible-progress-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 25px; }
.progress-bar-container { flex-grow: 1; height: 10px; background: #e2e8f0; border-radius: 5px; margin-right: 20px; overflow: hidden; }
.progress-bar-fill { height: 100%; background: #3498db; width: 0%; transition: width 0.5s ease; }
#bible-progress-text { font-size: 0.9rem; color: #64748b; white-space: nowrap; }

.bible-tabs { border-bottom: 1px solid #e2e8f0; margin-bottom: 20px; }
.bible-tabs .tab-btn { background: none; border: none; padding: 10px 15px; cursor: pointer; color: #94a3b8; font-weight: 600; }
.bible-tabs .tab-btn.active { color: #2c3e50; border-bottom: 2px solid #3498db; }

.tab-content { display: none; }
.tab-content.active { display: block; }

.books-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 15px; align-items: start; }
.psalms-grid { 
    display: grid; 
    grid-template-columns: repeat(auto-fill, minmax(35px, 1fr)); 
    gap: 8px; 
    justify-items: center;
    padding: 15px;
    background: white;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

.book { border: 1px solid #e2e8f0; border-radius: 8px; overflow: hidden; background: white; }
.bible-book-header { padding: 10px; background: #f8fafc; cursor: pointer; display: flex; justify-content: space-between; align-items: center; }
.bible-book-header.in-progress { border-left: 4px solid #f1c40f; }
.bible-book-header.finished { border-left: 4px solid #27ae60; }
.bible-book-header.collapsed + .chapters { display: none; }

.chapters { display: flex; flex-wrap: wrap; gap: 4px; padding: 10px; border-top: 1px solid #e2e8f0; }
.bible-chapter { width: 30px; height: 30px; display: flex; align-items: center; justify-content: center; font-size: 0.75rem; border: 1px solid #edf2f7; border-radius: 4px; cursor: pointer; background: white; }
.bible-chapter:hover { background: #edf2f7; }
.bible-chapter.read { background: #3498db; color: white; border-color: #3498db; }

.reading-log-container { background: white; border-radius: 12px; padding: 20px; border: 1px solid #e2e8f0; }
.log-columns { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin-bottom: 30px; }
.log-column h4 { margin-top: 0; color: #475569; font-size: 0.9rem; border-bottom: 1px solid #f1f5f9; padding-bottom: 5px; }
.log-entry { font-size: 0.85rem; padding: 5px 0; display: flex; justify-content: space-between; color: #64748b; }
#l-ot, #l-ps, #l-nt {
    max-height: 300px;
    overflow-y: auto;
    padding-right: 8px;
}
/* Minimalist scrollbar for reading logs */
#l-ot::-webkit-scrollbar, #l-ps::-webkit-scrollbar, #l-nt::-webkit-scrollbar {
    width: 4px;
}
#l-ot::-webkit-scrollbar-thumb, #l-ps::-webkit-scrollbar-thumb, #l-nt::-webkit-scrollbar-thumb {
    background: #cbd5e0;
    border-radius: 4px;
}
.log-actions { border-top: 1px solid #f1f5f9; padding-top: 20px; display: flex; gap: 15px; }

.btn-subtle { background: #f1f5f9; border: none; padding: 8px 15px; border-radius: 6px; cursor: pointer; color: #475569; }
.btn-danger-subtle { background: #fff5f5; border: none; padding: 8px 15px; border-radius: 6px; cursor: pointer; color: #e53e3e; }

.cheer-bubble { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: #27ae60; color: white; padding: 10px 20px; border-radius: 20px; z-index: 2000; display: none; box-shadow: 0 4px 10px rgba(0,0,0,0.1); }

/* To-Do Specific Styles */
.todo-container {
    background: white;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    border: 1px solid #e2e8f0;
}

#task-table th, #task-table td {
    padding: 4px 8px;
    vertical-align: middle;
}

#task-table tr:hover {
    background-color: #f8fafc;
}

.task-input {
    width: 100%;
    border: none;
    background: transparent;
    padding: 4px;
}

.task-input:focus {
    outline: none;
    background: #f1f5f9;
    border-radius: 4px;
}

.subtask-dots {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

.subtask-dot {
    width: 6px;
    height: 6px;
    min-width: 3px;
    border-radius: 50%;
    background: #3b82f6;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.subtask-dot.completed {
    background: #94a3b8;
}

.subtask-wrapper {
    display: flex;
    align-items: center;
    background: transparent;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    max-width: 9.6px;
    overflow: hidden;
    white-space: nowrap;
    border: 1px solid transparent;
}

.subtask-wrapper:hover, .subtask-wrapper.editing {
    max-width: 300px;
    border-color: transparent;
}

.subtask-label {
    font-size: 0.9rem;
    margin-left: 6px;
    color: #475569;
    font-weight: 500;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s ease;
    text-decoration: none !important;
}

.subtask-wrapper:hover .subtask-label, .subtask-wrapper.editing .subtask-label {
    opacity: 1;
}

.subtask-label.completed {
    color: #94a3b8;
}

/* To-Do Tabs Styling */
.todo-tabs {
    display: flex;
    background: #edf2f7;
    padding: 2px;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
    width: fit-content;
}

.todo-tab {
    padding: 5px 20px;
    border: none;
    background: transparent;
    color: #64748b;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s;
}

.todo-tab:hover:not(.active) {
    color: #475569;
    background: rgba(255,255,255,0.5);
}

.todo-tab.active {
    background: white;
    color: #2563eb;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.reminder-days-input {
    width: 40px;
    border: none;
    background: #f8fafc;
    font-size: 0.7rem;
    color: #3b82f6;
    text-align: center;
    border-radius: 4px;
    padding: 2px;
}

.restore-btn {
    color: #94a3b8;
    opacity: 0.7;
}

.restore-btn:hover {
    color: z#44ef52;
}

.icon-btn {
    background: none;
    border: none;
    color: #cbd5e1;
    cursor: pointer;
    transition: color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px;
}

.icon-btn svg {
    width: 15px;
    height: 15px;
}

.icon-btn.delete-btn {
    position: static; /* Prevents inheriting absolute positioning from diary delete-btn */
}

.delete-btn:hover {
    color: #ef4444;
}

.subtask-badge {
    flex-shrink: 0;
    font-size: 0.7rem;
    background: #f1f5f9;
    color: #64748b;
    padding: 2px 6px;
    border-radius: 10px;
    margin-left: 8px;
}

.icon-btn {
    background: none;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.icon-btn:hover {
    color: #3498db;
    transform: scale(1.1);
}

.diary-view-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

#diary-toggle-btn {
    border: 1px solid #e2e8f0;
    padding: 6px;
    border-radius: 6px;
    background: white;
    position: relative;
    z-index: 10;
}

/* Control the icon size within the toggle button to prevent jumping */
#diary-toggle-btn svg {
    width: 18px;
    height: 18px;
    stroke-width: 2.5px;
}

.add-task-footer {
    display: flex;
    justify-content: center;
    margin-top: 15px;
    position: relative;
    padding-bottom: 20px;
}

.add-task-footer::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: #e2e8f0;
    z-index: 0;
}

.add-task-ipynb-btn {
    position: relative;
    z-index: 1;
    background: white;
    border: 1px solid #e2e8f0;
    color: #64748b;
    padding: 6px 16px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
}

.add-task-ipynb-btn:hover {
    transform: translateY(4px);
    color: #3b82f6;
    border-color: #3b82f6;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

/* New styles for inline editing and display */
.task-name-container {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: nowrap;
}

.task-text-display {
    flex: 1;
    min-width: 80px;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: background-color 0.2s;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 600;
    color: #334155;
}

.task-text-display:hover {
    background-color: #f1f5f9;
}

.category-display, .due-date-display {
    background-color: #f1f5f9;
}

.inline-edit-input {
    width: 100%;
    border: 1px solid #cbd5e1;
    background: #f8fafc;
    padding: 4px;
    font-size: 0.95rem;
    color: #334155;
    border-radius: 4px;
}

.inline-edit-input:focus {
    outline: none;
    border-color: #3498db;
    background: #ffffff;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

.reminder-days-input.inline-edit-input {
    width: 50px;
    text-align: center;
    font-size: 0.85rem;
    color: #5544ef;
}

/* input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
} */

/* Hide the default browser calendar icon on date inputs */
input[type="date"]::-webkit-calendar-picker-indicator {
    display: none !important;
}

/* Ensure date inputs have enough width for yyyy-mm-dd and signal they are clickable */
input[type="date"] {
    min-width: 80px;
    cursor: pointer;
}

/* Blinking animation for the reminder bell when a task is overdue for attention */
@keyframes bell-blink {
    0% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.2; transform: scale(1.3); }
    100% { opacity: 1; transform: scale(1); }
}

.reminder-bell-icon {
    color: #f59e0b !important; /* Warning Amber/Orange */
    animation: bell-blink 1s ease-in-out infinite;
}

#month-display-name {
    margin-bottom: 0;
    font-size: 1.25rem;
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(2px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3000;
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 16px;
    width: 90%;
    max-width: 420px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}
