/* ===================================================
   Digital Diary - Modern RTL Theme & Responsive Styles
   =================================================== */

:root {
    --font-family: 'Rubik', system-ui, -apple-system, sans-serif;
    
    /* Light Theme Palette */
    --bg-primary: #f8fafc;
    --bg-surface: #ffffff;
    --bg-sidebar: #ffffff;
    --border-color: #e2e8f0;
    --border-hover: #cbd5e1;
    
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --primary-light: #e0e7ff;
    --primary-text: #4338ca;
    
    --accent-red: #ef4444;
    --accent-green: #10b981;
    --accent-amber: #f59e0b;
    --accent-purple: #8b5cf6;
    
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
    
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 18px;
    --radius-full: 9999px;
    
    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Dark Theme Palette */
body.dark-mode {
    --bg-primary: #0f172a;
    --bg-surface: #1e293b;
    --bg-sidebar: #192231;
    --border-color: #334155;
    --border-hover: #475569;
    
    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --text-muted: #64748b;
    
    --primary: #818cf8;
    --primary-hover: #6366f1;
    --primary-light: #1e1b4b;
    --primary-text: #c7d2fe;
    
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.3);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.3);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.3);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.4);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-family);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.6;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Base Layout */
.app-container {
    display: flex;
    min-height: 100vh;
    width: 100%;
}

/* Sidebar */
.sidebar {
    width: 280px;
    background-color: var(--bg-sidebar);
    border-left: 1px solid var(--border-color);
    padding: 24px 18px;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    height: 100vh;
    z-index: 20;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 32px;
    padding: 0 8px;
}

.brand-icon {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, var(--primary), #a855f7);
    color: #ffffff;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    box-shadow: var(--shadow-md);
}

.brand-text h1 {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-primary);
}

.brand-text span {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    background: transparent;
    border: none;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    text-align: right;
    transition: var(--transition);
}

.nav-item i {
    font-size: 1.1rem;
    width: 22px;
}

.nav-item:hover {
    background-color: var(--primary-light);
    color: var(--primary);
}

.nav-item.active {
    background-color: var(--primary);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.35);
}

.streak-widget {
    background: linear-gradient(135deg, rgba(249, 115, 22, 0.1), rgba(239, 68, 68, 0.1));
    border: 1px solid rgba(249, 115, 22, 0.2);
    border-radius: var(--radius-md);
    padding: 14px;
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

.streak-icon {
    font-size: 1.8rem;
}

.streak-count {
    font-size: 1.1rem;
    font-weight: 700;
    color: #f97316;
}

.streak-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.sidebar-footer {
    display: flex;
    gap: 10px;
    padding-top: 14px;
    border-top: 1px solid var(--border-color);
}

.theme-btn {
    flex: 1;
    height: 40px;
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 1rem;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.theme-btn:hover {
    background-color: var(--primary-light);
    color: var(--primary);
    border-color: var(--primary);
}

/* Main Content Area */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    padding: 24px 32px;
    max-width: 1350px;
    margin: 0 auto;
    width: 100%;
}

/* Header Bar */
.top-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 28px;
}

.header-search {
    position: relative;
    flex: 1;
    max-width: 480px;
}

.header-search i {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.header-search input {
    width: 100%;
    height: 44px;
    padding: 10px 44px 10px 16px;
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-full);
    font-family: inherit;
    font-size: 0.95rem;
    color: var(--text-primary);
    outline: none;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}

.header-search input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 600;
    border-radius: var(--radius-md);
    cursor: pointer;
    border: none;
    transition: var(--transition);
    text-decoration: none;
}

.btn-primary {
    background-color: var(--primary);
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.25);
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.35);
}

.btn-outline {
    background-color: var(--bg-surface);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-outline:hover {
    background-color: var(--primary-light);
    color: var(--primary);
    border-color: var(--primary);
}

.btn-danger {
    background-color: var(--accent-red);
    color: #ffffff;
}

.btn-danger:hover {
    background-color: #dc2626;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.85rem;
}

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: var(--radius-sm);
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

.btn-block {
    width: 100%;
}

.btn-close {
    background: transparent;
    border: none;
    font-size: 1.3rem;
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition);
    padding: 4px;
}

.btn-close:hover {
    color: var(--accent-red);
}

/* Tabs */
.tab-content {
    display: none;
    animation: fadeIn 0.25s ease-out;
}

.tab-content.active {
    display: block;
}

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

/* Filters Bar */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    background-color: var(--bg-surface);
    padding: 14px 20px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    margin-bottom: 24px;
    align-items: center;
    box-shadow: var(--shadow-sm);
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.filter-group select {
    padding: 6px 12px;
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.88rem;
    color: var(--text-primary);
    outline: none;
    cursor: pointer;
}

/* Entries Grid & Cards */
.entries-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
}

.entry-card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: var(--transition);
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    position: relative;
}

.entry-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
    border-color: var(--border-hover);
}

.entry-card-img {
    width: 100%;
    height: 170px;
    object-fit: cover;
    border-bottom: 1px solid var(--border-color);
}

.entry-card-body {
    padding: 20px;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.entry-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.entry-mood-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    font-size: 0.8rem;
    font-weight: 500;
    background-color: var(--primary-light);
    color: var(--primary-text);
}

.entry-card-date {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.entry-card-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 10px;
    line-height: 1.4;
}

.entry-card-snippet {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.5;
    flex: 1;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 16px;
}

.entry-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
    font-size: 0.8rem;
}

.entry-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.tag-pill {
    background-color: var(--bg-primary);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
}

/* Empty States */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    background-color: var(--bg-surface);
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-lg);
}

.empty-state i {
    font-size: 3.5rem;
    color: var(--text-muted);
    margin-bottom: 16px;
}

.empty-state h3 {
    font-size: 1.3rem;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.empty-state p {
    color: var(--text-secondary);
    margin-bottom: 20px;
}

/* Calendar View */
.calendar-container {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 24px;
}

.calendar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.calendar-header h2 {
    font-size: 1.4rem;
    font-weight: 700;
}

.calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    text-align: center;
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.9rem;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 10px;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 8px;
}

.calendar-day {
    min-height: 90px;
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 8px;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    position: relative;
}

.calendar-day:hover {
    border-color: var(--primary);
    background-color: var(--primary-light);
}

.calendar-day.other-month {
    opacity: 0.35;
}

.calendar-day.today {
    border: 2px solid var(--primary);
    background-color: rgba(99, 102, 241, 0.05);
}

.calendar-day.selected {
    outline: 2px solid var(--primary);
    background-color: var(--primary-light);
}

.day-number {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 4px;
}

.day-indicators {
    display: flex;
    flex-direction: column;
    gap: 3px;
    margin-top: auto;
}

.day-entry-badge {
    font-size: 0.7rem;
    padding: 2px 4px;
    border-radius: 4px;
    background-color: var(--primary);
    color: #ffffff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.day-tasks-badge {
    font-size: 0.7rem;
    padding: 2px 4px;
    border-radius: 4px;
    background-color: var(--accent-green);
    color: #ffffff;
}

.selected-day-details {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow-sm);
}

.details-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}

.day-events-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.placeholder-text {
    color: var(--text-muted);
    font-size: 0.95rem;
}

/* Tasks Tab */
.tasks-wrapper {
    max-width: 850px;
    margin: 0 auto;
}

.tasks-card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 28px;
    box-shadow: var(--shadow-sm);
}

.tasks-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 16px;
}

.task-progress-wrap {
    min-width: 200px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.progress-bar {
    width: 100%;
    height: 8px;
    background-color: var(--bg-primary);
    border-radius: var(--radius-full);
    overflow: hidden;
    margin-top: 6px;
    border: 1px solid var(--border-color);
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--accent-green));
    border-radius: var(--radius-full);
    transition: width 0.3s ease;
}

.add-task-form {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.add-task-form input[type="text"] {
    flex: 2;
    min-width: 200px;
    height: 44px;
    padding: 8px 14px;
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 0.95rem;
    color: var(--text-primary);
}

.add-task-form input[type="date"],
.add-task-form select {
    height: 44px;
    padding: 8px 12px;
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 0.9rem;
    color: var(--text-primary);
}

.tasks-filters {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 10px;
}

.filter-btn {
    background: transparent;
    border: none;
    padding: 6px 14px;
    border-radius: var(--radius-full);
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
}

.filter-btn.active {
    background-color: var(--primary-light);
    color: var(--primary);
    font-weight: 600;
}

.tasks-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.task-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    transition: var(--transition);
}

.task-item:hover {
    border-color: var(--border-hover);
}

.task-item.completed {
    opacity: 0.6;
}

.task-item.completed .task-text {
    text-decoration: line-through;
    color: var(--text-muted);
}

.task-checkbox {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: var(--primary);
}

.task-content {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.task-text {
    font-size: 0.95rem;
    font-weight: 500;
}

.task-meta {
    display: flex;
    gap: 10px;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.priority-tag {
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 0.7rem;
}

.priority-high { background-color: #fee2e2; color: #b91c1c; }
.priority-medium { background-color: #fef3c7; color: #b45309; }
.priority-low { background-color: #e0f2fe; color: #0369a1; }

.task-actions {
    display: flex;
    gap: 6px;
}

.btn-task-del {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 6px;
    transition: var(--transition);
}

.btn-task-del:hover {
    color: var(--accent-red);
}

/* Stats Tab */
.stats-overview {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 28px;
}

.stat-card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    box-shadow: var(--shadow-sm);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    margin-bottom: 12px;
}

.icon-blue { background-color: #e0e7ff; color: #4338ca; }
.icon-green { background-color: #d1fae5; color: #047857; }
.icon-orange { background-color: #ffedd5; color: #c2410c; }
.icon-purple { background-color: #f3e8ff; color: #7e22ce; }

.stat-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.stat-title {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 24px;
}

.chart-card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-sm);
}

.chart-card h3 {
    font-size: 1.1rem;
    margin-bottom: 18px;
}

.chart-container {
    position: relative;
    height: 260px;
    width: 100%;
}

/* Settings Tab */
.settings-container {
    max-width: 750px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.settings-card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-sm);
}

.settings-card h3 {
    font-size: 1.15rem;
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 6px;
}

.settings-desc {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 18px;
}

.settings-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.toggle-label {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
}

.toggle-label input {
    display: none;
}

.toggle-slider {
    width: 44px;
    height: 24px;
    background-color: var(--border-color);
    border-radius: var(--radius-full);
    position: relative;
    transition: var(--transition);
}

.toggle-slider::before {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background-color: #ffffff;
    top: 3px;
    right: 4px;
    transition: var(--transition);
}

.toggle-label input:checked + .toggle-slider {
    background-color: var(--primary);
}

.toggle-label input:checked + .toggle-slider::before {
    transform: translateX(-18px);
}

.pin-config {
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.backup-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.file-upload-label {
    cursor: pointer;
}

.danger-zone {
    border-color: rgba(239, 68, 68, 0.4);
}

.danger-zone h3 {
    color: var(--accent-red);
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 100;
    animation: fadeIn 0.2s ease-out;
}

.modal-overlay.hidden {
    display: none;
}

.modal-card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 680px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-xl);
    padding: 28px;
    animation: modalScale 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalScale {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border-color);
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}

/* Form Styles */
.form-row {
    display: flex;
    gap: 16px;
    margin-bottom: 16px;
}

.flex-1 { flex: 1; }
.flex-2 { flex: 2; }

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 16px;
}

.form-group label {
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.form-group input[type="text"],
.form-group input[type="datetime-local"],
.form-group textarea {
    padding: 10px 14px;
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 0.95rem;
    color: var(--text-primary);
    outline: none;
    transition: var(--transition);
}

.form-group input:focus,
.form-group textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

/* Mood Selector */
.mood-selector {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 8px;
}

.mood-opt {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 10px;
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
}

.mood-opt .emoji {
    font-size: 1.5rem;
}

.mood-opt .label {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.mood-opt:hover {
    border-color: var(--primary);
}

.mood-opt.active {
    background-color: var(--primary-light);
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--primary);
}

/* Image Upload Area */
.image-upload-area {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.image-preview-container {
    position: relative;
    width: 100%;
    max-height: 240px;
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.image-preview-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.btn-remove-img {
    position: absolute;
    top: 10px;
    left: 10px;
    background-color: rgba(239, 68, 68, 0.85);
    color: #ffffff;
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
}

.btn-remove-img:hover {
    background-color: #ef4444;
}

/* View Entry Modal */
.view-body {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.view-title {
    font-size: 1.6rem;
    font-weight: 700;
}

.view-meta {
    display: flex;
    align-items: center;
    gap: 16px;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.view-image-wrap img {
    width: 100%;
    max-height: 380px;
    object-fit: cover;
    border-radius: var(--radius-md);
}

.view-content-text {
    font-size: 1.05rem;
    line-height: 1.8;
    white-space: pre-wrap;
    color: var(--text-primary);
}

/* PIN Screen */
.pin-card {
    max-width: 360px;
    text-align: center;
    padding: 36px 28px;
}

.pin-icon {
    width: 60px;
    height: 60px;
    background: var(--primary-light);
    color: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    margin: 0 auto 16px;
}

.pin-inputs {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin: 20px 0;
    direction: ltr;
}

.pin-digit,
.pin-digit-set {
    width: 48px;
    height: 54px;
    text-align: center;
    font-size: 1.6rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    outline: none;
    transition: var(--transition);
}

.pin-digit:focus,
.pin-digit-set:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.error-msg {
    color: var(--accent-red);
    font-size: 0.85rem;
    margin-bottom: 12px;
}

.save-status {
    font-size: 0.85rem;
    color: var(--accent-green);
    margin-right: 8px;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 24px;
    left: 24px;
    background-color: #0f172a;
    color: #ffffff;
    padding: 12px 20px;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    box-shadow: var(--shadow-xl);
    z-index: 1000;
    animation: toastSlide 0.3s ease-out;
}

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

.hidden {
    display: none !important;
}

/* Custom Confirmation Modal Styles */
.confirm-card {
    max-width: 420px;
    text-align: center;
    padding: 32px 24px;
}

.confirm-icon-wrap {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    margin: 0 auto 16px;
    background-color: #fee2e2;
    color: var(--accent-red);
}

.confirm-icon-wrap.warning {
    background-color: #fef3c7;
    color: var(--accent-amber);
}

.confirm-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.confirm-message {
    font-size: 0.95rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 24px;
}

.confirm-actions {
    display: flex;
    justify-content: center;
    gap: 12px;
}

.confirm-actions .btn {
    flex: 1;
}


/* Responsive Mobile */
@media (max-width: 768px) {
    .app-container {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        height: auto;
        position: relative;
        padding: 16px;
        border-left: none;
        border-bottom: 1px solid var(--border-color);
    }
    
    .nav-menu {
        flex-direction: row;
        overflow-x: auto;
        padding-bottom: 6px;
    }
    
    .nav-item {
        padding: 8px 12px;
        font-size: 0.85rem;
        white-space: nowrap;
    }
    
    .streak-widget {
        display: none;
    }
    
    .main-content {
        padding: 16px;
    }
    
    .top-header {
        flex-direction: column;
        align-items: stretch;
    }
    
    .form-row {
        flex-direction: column;
        gap: 0;
    }
}
