/* =========================================
   Modern Header Redesign - BridgeWork Pro
   ========================================= */

:root {
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --bg-card: #ffffff;
    --bg-page: #f8fafc;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.04);
}

/* Main Header Container */
.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    background: var(--bg-card);
    padding: 16px 24px;
    border-radius: 16px;
    margin-bottom: 24px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    gap: 16px;
    color: var(--text-main);
}

/* Profile Cover Section */
.profile-cover-wrapper {
    position: relative;
    width: 100%;
    height: 240px;
    border-radius: 20px;
    overflow: hidden;
    margin-bottom: 30px;
    background: #e2e8f0;
    box-shadow: 0 10px 30px rgba(0,0,0,0.08);
}

.cover-image-container {
    width: 100%;
    height: 100%;
    position: relative;
}

.cover-image-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.cover-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(15, 23, 42, 0.8) 0%, rgba(15, 23, 42, 0.2) 50%, transparent 100%);
}

.edit-cover-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(255,255,255,0.2);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.3);
    color: #fff;
    padding: 8px 16px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: 0.3s;
    z-index: 10;
}

.edit-cover-btn:hover { background: rgba(255,255,255,0.3); transform: scale(1.05); }

.profile-info-overlay {
    position: absolute;
    bottom: 30px;
    left: 40px;
    display: flex;
    align-items: center;
    gap: 20px;
    z-index: 5;
}

.profile-avatar-large {
    width: 100px !important;
    height: 100px !important;
    border: 4px solid #fff;
    box-shadow: 0 8px 20px rgba(0,0,0,0.2);
    cursor: pointer;
}

.profile-text h1 {
    color: #fff;
    font-size: 28px;
    font-weight: 800;
    letter-spacing: -1px;
    margin: 0;
    text-shadow: 0 2px 10px rgba(0,0,0,0.3);
}

.profile-text p {
    color: rgba(255,255,255,0.9);
    font-size: 14px;
    font-weight: 600;
    margin: 4px 0 0 0;
}

/* 1. Date Navigation Section (Left) */
.date-nav-group {
    display: flex;
    align-items: center;
    gap: 16px;
}

.month-picker {
    display: flex;
    align-items: center;
    background: var(--bg-page);
    border-radius: 12px;
    padding: 4px;
    border: 1px solid var(--border-color);
}

.nav-arrow {
    background: transparent;
    border: none;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    cursor: pointer;
    color: var(--text-muted);
    transition: all 0.2s;
    font-size: 14px;
}

.nav-arrow:hover {
    background: var(--bg-card);
    color: var(--primary);
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

#currentViewLabel {
    font-weight: 700;
    font-size: 16px;
    color: var(--text-main);
    padding: 0 12px;
    min-width: 140px;
    text-align: center;
}

#btnToday {
    background: #eff6ff;
    color: #2563eb;
    border: none;
    padding: 8px 16px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s;
}

#btnToday:hover {
    background: #dbeafe;
}

/* 2. Language Switcher (Segmented Control) */
.lang-switcher {
    display: flex;
    background: var(--bg-page);
    padding: 4px;
    border-radius: 10px;
    gap: 2px;
    border: 1px solid var(--border-color);
}

.lang-switcher button {
    border: none;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    background: transparent;
    color: var(--text-muted);
    transition: all 0.2s;
}

.lang-switcher button.active {
    background: var(--bg-card);
    color: var(--text-main);
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

/* 3. Primary Actions (Right) */
.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

#btnExport {
    background: var(--bg-card);
    color: var(--text-muted);
    border: 1px solid var(--border-color);
    padding: 10px 20px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: 0.2s;
}

#btnExport:hover {
    background: var(--bg-page);
    border-color: var(--text-muted);
}

#btnAdd {
    background: var(--primary);
    color: #ffffff;
    border: none;
    padding: 10px 20px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.2);
    transition: all 0.2s;
}

#btnAdd:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 6px 15px rgba(99, 102, 241, 0.3);
}

#btnAdd:active {
    transform: translateY(0);
}

/* Status Indicators */
.status-pill {
    font-size: 11px;
    padding: 4px 10px;
    border-radius: 20px;
    background: var(--bg-page);
    color: var(--text-muted);
    border: 1px solid var(--border-color);
    display: none; /* Hidden until linked */
}

.status-pill.status-active {
    display: inline-block;
    background: #ecfdf5;
    color: #059669;
    border-color: #a7f3d0;
}

/* Responsive Fixes for Small Screens */
@media (max-width: 1100px) {
    .dashboard-header {
        justify-content: center;
    }
    .header-user-info {
        width: 100%;
        text-align: center;
        display: flex;
        flex-direction: column;
        align-items: center;
    }
    .main {
        margin-left: 0;
        padding: 16px;
    }
}

@media (max-width: 600px) {
    .dashboard-header {
        padding: 12px;
        gap: 12px;
    }
    .header-actions, .date-nav-group {
        width: 100%;
        justify-content: center;
    }
    #currentViewLabel {
        min-width: 120px;
        font-size: 14px;
    }
    .cards {
        grid-template-columns: 1fr;
    }
    .tools-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Sidebar Hierarchical Navigation */
.sidebar-group {
    margin-top: 16px;
    display: flex;
    flex-direction: column;
}

.sidebar-group-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    padding: 8px 24px;
    font-weight: 800;
}

.sidebar-sub-item {
    padding-left: 40px !important;
    font-size: 13px !important;
}

/* To-Do List Styles */
.todo-container {
    max-width: 700px;
    margin: 0 auto;
    background: var(--bg-card);
    border-radius: 24px;
    padding: 32px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.03);
    border: 1px solid var(--border-color);
}

.todo-header-area {
    margin-bottom: 24px;
}

.todo-title-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 12px;
}

.todo-title-row h2 {
    font-size: 20px;
    font-weight: 800;
    color: var(--text-main);
    margin: 0;
}

.todo-stats-text {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
}

.todo-progress-bg {
    height: 6px;
    background: var(--bg-page);
    border-radius: 10px;
    overflow: hidden;
}

.todo-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), #818cf8);
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.todo-input-group {
    display: flex;
    gap: 0;
    background: var(--bg-page);
    padding: 6px;
    border-radius: 16px;
    border: 1px solid var(--border-color);
    margin-bottom: 24px;
    transition: 0.3s;
}

.todo-input-group:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.todo-input-group input {
    flex: 1;
    background: transparent;
    border: none;
    padding: 12px 18px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-main);
}

.todo-input-group input:focus { outline: none; }

.btn-todo-add {
    background: var(--primary);
    color: white;
    border: none;
    padding: 0 20px;
    border-radius: 12px;
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
    transition: 0.2s;
}

.btn-todo-add:hover { background: var(--primary-hover); transform: scale(1.02); }

.todo-item {
    display: flex;
    align-items: center;
    padding: 16px 20px;
    background: #fff;
    border-radius: 16px;
    margin-bottom: 12px;
    transition: all 0.3s ease;
    border: 1px solid var(--border-color);
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}

.todo-item:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.04);
}

.todo-item.priority-high {
    border-left: 5px solid #ef4444;
}

.todo-item.done {
    background: var(--bg-page);
    border-color: transparent;
    opacity: 0.7;
}

/* Custom Checkbox */
.todo-check-wrapper {
    position: relative;
    width: 22px;
    height: 22px;
    flex-shrink: 0;
}

.todo-check-wrapper input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 100%;
    width: 100%;
    top: 0;
    left: 0;
    z-index: 2;
}

.todo-checkmark {
    position: absolute;
    top: 0; left: 0;
    height: 22px; width: 22px;
    background-color: #fff;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    transition: 0.2s;
    z-index: 1;
}

.todo-check-wrapper:hover input ~ .todo-checkmark {
    border-color: var(--primary);
}

.todo-check-wrapper input:checked ~ .todo-checkmark {
    background-color: var(--primary);
    border-color: var(--primary);
}

.todo-checkmark:after {
    content: "";
    position: absolute;
    display: none;
    left: 7px; top: 3px;
    width: 5px; height: 10px;
    border: solid white;
    border-width: 0 2.5px 2.5px 0;
    transform: rotate(45deg);
}

.todo-check-wrapper input:checked ~ .todo-checkmark:after {
    display: block;
}

.todo-item.done .todo-text {
    text-decoration: line-through;
    color: var(--text-muted);
}

.todo-text {
    flex: 1;
    margin: 0 16px;
    font-size: 15px;
    font-weight: 500;
    color: var(--text-main);
    line-height: 1.4;
}

.todo-del {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: #cbd5e1;
    cursor: pointer;
    transition: 0.2s;
}

.todo-del:hover {
    background: #fee2e2;
    color: #ef4444;
}

.priority-badge {
    font-size: 10px;
    background: #ef4444;
    color: white;
    padding: 4px 8px;
    border-radius: 6px;
    font-weight: 800;
    margin-right: 12px;
}

/* Loan Report Specifics */
.loan-history-table tr.paid {
    background-color: rgba(16, 185, 129, 0.05);
}
.loan-history-table tr.paid td {
    color: #059669;
}
.loan-history-table tr.overdue {
    background-color: rgba(239, 68, 68, 0.05);
    border-left: 3px solid #ef4444;
}
.loan-history-table tr.overdue td {
    color: #dc2626;
}

.badge-warning {
    background: #fff7ed;
    color: #ea580c;
    border: 1px solid #ffedd5;
}
.badge-danger {
    background: #fff1f2;
    color: #e11d48;
    border: 1px solid #fecdd3;
}

/* Tabbed Settings UI - Vertical Sidebar Layout */
.settings-layout { 
    display: flex; 
    height: 500px;
    background: var(--bg-card);
    overflow: hidden;
    margin: -24px -24px 20px -24px; /* Only offset top, left, and right; leave space at bottom */
    border-bottom: 1px solid var(--border-color);
}

.settings-tabs { 
    width: 200px;
    display: flex; 
    flex-direction: column; 
    gap: 2px; 
    border-right: 1px solid var(--border-color); 
    padding: 15px 8px;
    flex-shrink: 0;
    background: var(--bg-main);
    border-radius: 16px 0 0 16px;
}

.settings-tab-btn {
    background: none; 
    border: none; 
    padding: 12px 14px;
    font-size: 12px;
    font-weight: 600; 
    color: var(--text-muted); 
    cursor: pointer;
    text-align: left;
    border-radius: 8px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 10px;
}

.settings-tab-btn:hover { 
    background: var(--border-color); 
    color: var(--text-main); 
}

.settings-tab-btn.active { 
    background: var(--primary) !important;
    color: #ffffff !important;
    font-weight: 700;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.2);
}

.settings-tab-content {
    flex: 1;
    padding: 40px;
    display: none;
    overflow-y: auto;
    background: var(--card-bg);
    will-change: opacity, transform;
    animation: fadeIn 0.25s ease-out forwards;
}

.settings-tab-content.active { 
    display: block;
}

.settings-section-title {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    margin-bottom: 20px;
    font-weight: 800;
}

.preference-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 0;
    border-bottom: 1px solid var(--border-color);
}

.preference-item:last-child {
    border-bottom: none;
}
.preference-info h4 { font-size: 12px; margin: 0; color: var(--text-main); }
.preference-info p { font-size: 10px; color: var(--text-muted); margin: 0; }

.cat-pill {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: var(--bg-main);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 6px;
    font-size: 12px;
    font-weight: 600;
}

.switch-toggle {
    appearance: none;
    width: 34px;
    height: 18px;
    background: #cbd5e1;
    border-radius: 20px;
    position: relative;
    cursor: pointer;
    transition: background 0.3s;
}
.switch-toggle::before {
    content: '';
    position: absolute;
    width: 14px;
    height: 14px;
    background: white;
    border-radius: 50%;
    top: 2px;
    left: 2px;
    transition: transform 0.3s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.switch-toggle:checked { background: var(--primary); }
.switch-toggle:checked::before { transform: translateX(16px); }

/* Privacy Mode - Blur Effect */
.blur-sensitive {
    filter: blur(8px);
    transition: filter 0.3s ease;
    user-select: none;
    pointer-events: none;
}

/* --- Custom Cover UI Logic --- */

.cover-actions-group {
    position: absolute; top: 20px; right: 20px; display: flex; gap: 8px; z-index: 20;
    /* Hide the buttons by default to keep UI clean */
    opacity: 0;
    transform: translateY(-10px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Show actions only when hovering over the banner OR while repositioning */
.profile-cover-wrapper:hover .cover-actions-group,
.repositioning-mode .cover-actions-group {
    opacity: 1;
    transform: translateY(0);
}

.repositioning-mode .cover-image-container img {
    cursor: ns-resize; filter: brightness(0.8);
}

.repositioning-mode::after {
    content: '⇅ Drag vertically to adjust view';
    position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
    background: rgba(0,0,0,0.6); color: #fff; padding: 8px 16px; border-radius: 20px;
    font-size: 11px; font-weight: 700; pointer-events: none;
}

.modal-content {
    max-height: 90vh;
    overflow-y: auto;
}

.repositioning-mode .edit-cover-btn:not(.reposition-control) { display: none; }
.save-pos-btn { display: none; }
.repositioning-mode .save-pos-btn { display: flex; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }
