/* public/css/style.css */

/* --- CUSTOM FONTS --- */
/* Note: Assuming your font files are .ttf. If they are .otf or .woff, please change the extension below */
@font-face {
    font-family: 'Poppins';
    src: url('/custom-fonts/Poppins-Light.ttf') format('truetype');
    font-weight: 300;
    font-style: normal;
}

@font-face {
    font-family: 'Poppins';
    src: url('/custom-fonts/Poppins-Medium.ttf') format('truetype');
    font-weight: 500;
    font-style: normal;
}

@font-face {
    font-family: 'Rajdhani';
    src: url('/custom-fonts/Rajdhani-Bold.ttf') format('truetype');
    font-weight: 700;
    font-style: normal;
}
/* -------------------- */

:root {
--dt-body-bg: #121212;
    --dt-card-bg: #1e1e1e;
    --dt-input-bg: #2b2b2b;
    --dt-border: #333333;
    --dt-text-main: #f8f9fa;
    --dt-text-muted: #adb5bd;
    --sidebar-width: 260px;
    --sidebar-collapsed-width: 70px;
    --sidebar-bg: #181818;
    --accent-color: #0d6efd;
    --accent-hover: #0b5ed7;
    --dt-placeholder-color: #6c757d;
    
    /* Font Variables */
    --font-base: 'Poppins', sans-serif;
    --font-display: 'Rajdhani', sans-serif;
}

/* --- TYPOGRAPHY FIXES FOR DARK THEME --- */
body {
    background-color: var(--dt-body-bg);
    color: var(--dt-text-main);
    font-family: var(--font-base) !important;
    font-weight: 300; /* Uses Poppins-Light */
    font-size: 0.875rem; /* ~14px, matches the sleek dashboard reference */
    overflow-x: hidden;
    margin: 0;
}

h1, h2, h3, h4, h5, h6,
.h1, .h2, .h3, .h4, .h5, .h6,
.modal-title, .sidebar-heading {
    color: var(--dt-text-main) !important;
    font-family: var(--font-display) !important;
    font-weight: 700; /* Uses Rajdhani-Bold */
    letter-spacing: 0.5px;
}

label, .form-label, .card-header {
    color: var(--dt-text-main) !important;
    font-family: var(--font-base);
    font-weight: 500; /* Uses Poppins-Medium */
}

/* Map bold utilities to Poppins-Medium for better readability */
b, strong, .fw-bold {
    font-weight: 500 !important; 
}

.text-muted {
    color: var(--dt-text-muted) !important;
}
/* --------------------------------------- */


/* --- SIDEBAR (AdminLTE Style Hover/Expand) --- */
#sidebar-wrapper {
    min-height: 100vh;
    width: var(--sidebar-collapsed-width);
    background-color: var(--sidebar-bg);
    border-right: 1px solid var(--dt-border);
    position: fixed;
    z-index: 1050;
    transition: width 0.3s ease-in-out;
    overflow-y: hidden;
    overflow-x: hidden;
    white-space: nowrap;
}

#sidebar-wrapper:hover, body.sidebar-open #sidebar-wrapper {
    width: var(--sidebar-width);
    box-shadow: 4px 0 10px rgba(0,0,0,0.3);
    overflow-y: auto;
}

/* Custom Scrollbar for Sidebar */
#sidebar-wrapper::-webkit-scrollbar { width: 6px; }
#sidebar-wrapper::-webkit-scrollbar-thumb { background: #444; border-radius: 4px; }

.sidebar-heading {
    height: 60px;
    display: flex;
    align-items: center;
    padding: 0 1.25rem;
    font-size: 1.4rem; /* Larger for Brand Text */
}

.brand-text {
    opacity: 0;
    transition: opacity 0.2s ease-in-out;
    margin-left: 10px;
}

#sidebar-wrapper:hover .brand-text, body.sidebar-open .brand-text {
    opacity: 1;
    transition-delay: 0.1s;
}

/* --- SIDEBAR ICONS & LINKS --- */
.nav-link {
    color: #ffffff !important;
    padding: 0.8rem 1.25rem;
    display: flex;
    align-items: center;
    border-radius: 0;
    transition: all 0.2s;
    overflow: hidden;
    white-space: nowrap;
    font-size: 0.95rem;
}

.nav-link:hover {
    background-color: rgba(255,255,255,0.05) !important;
}

.nav-link.active {
    background-color: rgba(13, 110, 253, 0.15) !important;
    color: #5da8ff !important;
    border-left: 4px solid #5da8ff !important;
    font-weight: 500; /* Pop active items */
}

.nav-icon {
    min-width: 30px;
    text-align: center;
    font-size: 1.1rem;
}

.nav-text, .brand-text {
    opacity: 0;
    margin-left: 10px;
    transition: opacity 0.2s ease-in-out;
}

#sidebar-wrapper:hover .nav-text,
#sidebar-wrapper:hover .brand-text {
    opacity: 1;
    transition-delay: 0.15s;
}

/* --- TOP NAVBAR --- */
.main-header {
    height: 60px;
    background-color: var(--dt-card-bg);
    border-bottom: 1px solid var(--dt-border);
    display: flex;
    align-items: center;
    padding: 0 1.25rem;
    position: fixed;
    top: 0;
    right: 0;
    left: var(--sidebar-collapsed-width);
    z-index: 1000;
    transition: left 0.3s ease-in-out;
}

#sidebar-wrapper:hover ~ .main-header {
    left: var(--sidebar-width);
}

.navbar-toggler-icon { cursor: pointer; color: var(--dt-text-main); font-size: 1.2rem; }

/* --- PAGE CONTENT --- */
#page-content-wrapper {
    margin-left: var(--sidebar-collapsed-width);
    padding: 80px 20px 20px 20px;
    transition: margin-left 0.3s ease-in-out;
    min-height: 100vh;
}

#sidebar-wrapper:hover ~ #page-content-wrapper {
    margin-left: var(--sidebar-width);
}

/* --- CARDS & UI ELEMENTS --- */
.card {
    background-color: var(--dt-card-bg) !important;
    border: 1px solid var(--dt-border) !important;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1) !important;
    margin-bottom: 1.5rem;
}

.card-header {
    border-bottom: 1px solid var(--dt-border) !important;
    background-color: transparent !important;
    padding: 1rem 1.25rem;
}

.form-control, .form-select {
    background-color: var(--dt-input-bg) !important;
    border: 1px solid var(--dt-border) !important;
    color: var(--dt-text-main) !important;
    font-size: 0.85rem; /* Tighter input text */
}

.form-control:focus {
    border-color: var(--accent-color) !important;
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25) !important;
}

/* Base table styling to match the reference image */
.table {
    font-size: 0.85rem;
}
.table thead th {
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.5px;
    color: var(--dt-text-muted);
}

/* --- LOGIN PAGE SPECIFIC --- */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100vh;
    background-color: var(--dt-body-bg);
}

.login-box {
    width: 400px;
    padding: 2rem;
    background: var(--dt-card-bg);
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    border: 1px solid var(--dt-border);
}

/* --- LOGS PAGE & TABLE SPECIFIC --- */
.log-badge {
    font-size: 0.80rem;
    padding: 0.4em 0.8em;
    border-radius: 6px;
    font-weight: 500;
}

.log-nav-tabs {
    border-bottom: 1px solid #495057;
}

.log-table-head {
    border-bottom: 2px solid #333333;
}

.log-table-row {
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

/* Custom Dark Pagination */
.dark-pagination .page-link {
    background-color: #212529;
    color: #adb5bd;
    border-color: #495057;
    transition: all 0.2s;
    font-size: 0.85rem;
}

.dark-pagination .page-link:hover {
    background-color: #343a40;
    color: #ffffff;
}

.dark-pagination .page-item.active .page-link {
    background-color: var(--accent-color);
    border-color: var(--accent-color);
    color: #ffffff;
}

.dark-pagination .page-item.disabled .page-link {
    color: #6c757d;
    background-color: #1a1e21;
    border-color: #495057;
}

/* --- SETTINGS PAGE SPECIFIC --- */
.config-card { 
    background-color: var(--dt-card-bg); 
    border: 1px solid var(--dt-border); 
    border-radius: 8px; 
}
.form-label-custom { 
    font-size: 0.75rem; 
    text-transform: uppercase; 
    letter-spacing: 0.5px; 
    color: var(--dt-text-muted); 
    font-weight: 500; /* Updated to use Poppins-Medium */
    margin-bottom: 4px; 
}
.checkbox-scroll-container { 
    scrollbar-width: thin; 
    scrollbar-color: #495057 #212529; 
    max-height: 120px; 
    overflow-y: auto; 
    background: #000; 
    border: 1px solid var(--dt-border); 
    border-radius: 4px; 
    padding: 10px; 
}
.settings-list-group .list-group-item { 
    background-color: transparent !important; 
    border-bottom: 1px solid var(--dt-border); 
}

/* --- ACCOUNTS & LEDGER SPECIFIC --- */
.account-card {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.account-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 12px rgba(0,0,0,0.3) !important;
}
.custom-scroll {
    scrollbar-width: none; 
}
.custom-scroll::-webkit-scrollbar {
    display: none; 
}

/* --- DASHBOARD SPECIFIC --- */
.blinking {
    animation: blinker 1.5s linear infinite;
}
@keyframes blinker {
    50% { opacity: 0; }
}

/* --- CUSTOM DATA TABLE DESIGN --- */
:root {
    /* Increased opacity from 0.08 to 0.18 so the lines are clearly visible */
    --tbl-line-color: rgba(255, 255, 255, 0.18); 
    --tbl-header-accent: #0d6efd;
}

.custom-data-table {
    width: 100%;
    border-collapse: collapse;
    background-color: transparent;
    color: var(--dt-text-main);
}

.custom-data-table th {
    background-color: transparent;
    color: var(--dt-text-muted);
    font-family: var(--font-base);
    font-size: 0.70rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 12px 15px;
    border-bottom: 1px solid var(--tbl-line-color) !important; 
    border-right: 1px solid var(--tbl-line-color) !important;
    white-space: nowrap;
}

/* 1. Horizontal AND vertical grid lines for EVERY entry */
.custom-data-table td {
    padding: 12px 15px;
    font-size: 0.85rem;
    vertical-align: middle;
    border-bottom: 1px solid var(--tbl-line-color) !important;
    border-right: 1px solid var(--tbl-line-color) !important;
}

/* Remove the right border from the very last column to keep the table edges clean */
.custom-data-table th:last-child,
.custom-data-table td:last-child {
    border-right: none !important;
}

.custom-data-table tbody tr {
    transition: background-color 0.2s;
}

.custom-data-table tbody tr:hover td {
    background-color: rgba(255, 255, 255, 0.05); /* Slightly brighter hover effect */
}

/* 2. Full-width colored horizontal line to separate DATES */
.custom-data-table tbody tr.new-date-row td {
    /* Changed to a brighter blue/cyan so the date break really pops */
    border-top: 2px solid #7e4444 !important; 
}

/* --- UTILITY CALCULATOR STYLES --- */
.calc-result-value { 
    font-family: 'Courier New', Courier, monospace; 
    font-weight: bold; 
    letter-spacing: -1px;
}
.calc-year-row { 
    cursor: pointer; 
    background-color: #212529 !important; 
}
.calc-year-row:hover { 
    background-color: #2c3034 !important; 
}
.month-row { 
    background-color: #121212 !important; 
    display: none; 
} 
.month-row td { 
    color: #999; 
    font-size: 0.8rem; 
    border-bottom: 1px solid #222 !important; 
}
.chevron-icon { 
    transition: transform 0.2s ease-in-out; 
}
.expanded .chevron-icon { 
    transform: rotate(90deg); 
}
.grocery-input { 
    background: transparent; 
    border: none; 
    color: white; 
    padding: 4px;
    border-radius: 4px;
}
.grocery-input:focus { 
    outline: none; 
    background: rgba(255,255,255,0.05); 
}
.grocery-input::placeholder { 
    color: #555; 
    font-style: italic; 
}

/* ========================================== */
/* --- DIARY MODULE STYLES --- */
/* ========================================== */

/* FullCalendar Overrides */
.fc { font-size: 0.85em; }
.fc-theme-standard td, .fc-theme-standard th { border-color: #404040 !important; }
.fc-day-today { background-color: rgba(255,255,255,0.08) !important; }
.fc-day-selected { background-color: rgba(13, 110, 253, 0.3) !important; transition: background-color 0.2s; }
.fc .fc-toolbar-title { color: #fff; font-size: 1.1rem; }
.fc .fc-button-primary { background-color: #0d6efd !important; border-color: #0d6efd !important; padding: 0.2rem 0.5rem; }
.fc .fc-daygrid-day-top { flex-direction: row; padding: 2px; }
.fc .fc-daygrid-day-number { color: #e0e0e0; text-decoration: none; font-weight: bold; padding: 4px; }

/* Custom Diary Event Styling */
.fc-event-diary { 
    background-color: #198754 !important; 
    border: none !important; 
    cursor: pointer; 
    border-left: 3px solid #a3cfbb !important; 
    color: white !important;
}

#mainDiaryContent::placeholder { color: #ffffff !important; opacity: 0.4; }

/* Mobile-Friendly Thumbnail Grid */
.diary-img-container { 
    display: flex; 
    flex-wrap: wrap; 
    gap: 10px; 
}
.diary-img-item { 
    position: relative; 
    width: 80px; 
    height: 80px; 
    border-radius: 8px; 
    overflow: hidden; 
    border: 1px solid #404040; 
    cursor: pointer; 
    transition: transform 0.2s; 
    background-color: #000;
}
@media (min-width: 768px) {
    .diary-img-item { width: 100px; height: 100px; }
}
.diary-img-item:hover { transform: scale(1.05); }
.diary-img-item img { width: 100%; height: 100%; object-fit: cover; }

/* Remove Button for Thumbnails */
.remove-img-btn { 
    position: absolute; 
    top: 4px; 
    right: 4px; 
    background: rgba(220, 53, 69, 0.95); 
    color: white; 
    border: none; 
    border-radius: 50%; 
    width: 22px; 
    height: 22px; 
    font-size: 11px; 
    cursor: pointer; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    z-index: 10; 
}

/* public/css/activities.css */

.timeline {
    position: relative;
    padding-left: 20px;
}

.timeline::before {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: 24px;
    width: 2px;
    background-color: #495057; /* Secondary border color */
}

.timeline-item {
    position: relative;
    padding-left: 30px;
    padding-bottom: 25px;
}

.timeline-item:last-child {
    padding-bottom: 0;
}

.timeline-marker {
    position: absolute;
    top: 5px;
    left: 0;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    z-index: 1;
    border: 2px solid #212529; /* Dark background to cut the line */
}

/* ========================================== */
/* --- ACCOUNTS LEDGER & NEWS TICKER --- */
/* ========================================== */

/* Active filter pop effect */
.scale-up { 
    transform: scale(1.03); 
    box-shadow: 0 .5rem 1rem rgba(255,255,255,.1) !important; 
}
.account-card:hover { 
    transform: scale(1.03); 
}

/* News Ticker Wrapper */
.ticker-wrapper {
    position: relative;
    width: 100%;
    overflow: hidden;
    background-color: #1a1d20;
    border: 1px solid #333;
    border-radius: 6px;
    padding: 8px 0;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.2);
}

/* Static Label (Top Spending) */
.ticker-label {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    background: linear-gradient(90deg, #1e1e1e 85%, transparent 100%);
    color: #0dcaf0;
    font-weight: 700;
    padding: 8px 40px 8px 15px;
    z-index: 10;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    display: flex;
    align-items: center;
}

/* ========================================== */
/* --- DASHBOARD TOP SPENDING TABLE --- */
/* ========================================== */

/* Dark Sticky Header */
.custom-dark-header th {
    position: sticky;
    top: 0;
    z-index: 10;
    background-color: #1a1d20 !important; /* Deep dark grey that matches cards */
    color: #f8f9fa !important; /* Pure white text */
    border-bottom: 2px solid #333 !important;
    padding-top: 12px;
    padding-bottom: 12px;
}

.custom-scroll::-webkit-scrollbar {
    width: 6px;
}
.custom-scroll::-webkit-scrollbar-track {
    background: #1e1e1e;
}
.custom-scroll::-webkit-scrollbar-thumb {
    background-color: #555;
    border-radius: 10px;
}

/* Forces columns to take up only as much space as they need */
.tight-col {
    width: 1%;
    white-space: nowrap;
    padding-left: 1.5rem !important; /* Adds consistent spacing between the grouped numbers */
}

/* Custom dark track for progress bars to prevent utility class conflicts */
.custom-progress-track {
    background-color: #d911d5 !important; /* A clean, dark grey that matches your card borders */
}

/* ========================================== */
/* --- EMI REPORTS STYLES --- */
/* ========================================== */

/* Increases the title sizes to exactly 1rem */
.emi-stat-title {
    font-size: 1rem !important;
    font-weight: 600;
    letter-spacing: 0.5px;
    margin-bottom: 2px;
}

/* Formats the ledger table header */
.emi-table-header th {
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
}

/* Custom color specifically for Fund Transfer amounts */
.text-transfer-yellow {
    color: rgb(248, 253, 25) !important;
}

/* ========================================== */
/* --- MOBILE RESPONSIVENESS & SIDEBAR --- */
/* ========================================== */

/* Mobile Overlay Background (Hidden by default) */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.6);
    z-index: 1040; /* Sits just below the sidebar (1050) */
    backdrop-filter: blur(2px);
}

@media (max-width: 768px) {
    /* Slide sidebar off-screen and set it to full expanded width when open */
    #sidebar-wrapper {
        transform: translateX(-100%);
        width: var(--sidebar-width) !important; 
        transition: transform 0.3s ease-in-out;
    }

    /* Class added by JS when hamburger is clicked */
    body.sidebar-mobile-open #sidebar-wrapper {
        transform: translateX(0);
        box-shadow: 4px 0 15px rgba(0,0,0,0.6);
    }

    /* Force the Header to start at the left edge */
    .main-header,
    #sidebar-wrapper:hover ~ .main-header {
        left: 0 !important;
    }

    /* Force the Content to start at the left edge and reduce padding */
    #page-content-wrapper,
    #sidebar-wrapper:hover ~ #page-content-wrapper {
        margin-left: 0 !important;
        padding: 75px 10px 15px 10px !important; 
    }

    /* Show the darkened overlay when sidebar is open */
    body.sidebar-mobile-open .sidebar-overlay {
        display: block;
    }

    /* NEW: Force text to be visible when mobile sidebar is open */
    body.sidebar-mobile-open .nav-text,
    body.sidebar-mobile-open .brand-text {
        opacity: 1 !important;
        transition-delay: 0.15s;
    }
}

/* ========================================== */
/* --- SELECT2 (ASSETS/PARENT DROPDOWN) --- */
/* ========================================== */

.select2-container--default .select2-selection--single {
    background-color: var(--dt-input-bg) !important;
    border: 1px solid var(--dt-border) !important;
    border-radius: 0.375rem !important;
    height: 38px !important;
    display: flex;
    align-items: center;
    font-family: var(--font-base);
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
    color: var(--dt-text-main) !important;
    padding-left: 0.75rem;
    font-size: 0.85rem;
}

.select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 36px !important;
}

/* Dropdown menu styling */
.select2-dropdown {
    background-color: var(--dt-card-bg) !important;
    border: 1px solid var(--dt-border) !important;
}

.select2-search--dropdown .select2-search__field {
    background-color: var(--dt-input-bg) !important;
    border: 1px solid var(--dt-border) !important;
    color: var(--dt-text-main) !important;
    font-family: var(--font-base);
}

.select2-results__option {
    color: var(--dt-text-main) !important;
    font-size: 0.85rem;
    font-family: var(--font-base);
}

.select2-results__option--selected {
    background-color: rgba(255, 255, 255, 0.05) !important; /* Matches your subtle hover effects */
}

.select2-results__option--highlighted.select2-results__option--selectable {
    background-color: var(--accent-color) !important; /* Uses your primary blue */
    color: #ffffff !important;
}

/* ========================================== */
/* --- ASSETS SPECIFIC STYLES --- */
/* ========================================== */

/* Ensure wrapping containers do not hide overflow, allowing window-level sticky */
.assets-table-wrapper {
    overflow: visible !important; 
}

/* Stick the table header just below the main fixed navbar (assumed 60px height) */
.assets-table-wrapper thead th {
    position: sticky;
    top: 60px; 
    z-index: 20;
    background-color: var(--dt-card-bg) !important;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2); 
}

/* Stick the parent location row directly beneath the table header */
/* 60px navbar + ~48px table header = 108px */
.location-sticky-td {
    position: sticky;
    top: 108px; 
    z-index: 10;
    background-color: #2c3034 !important; /* Solid dark color to obscure scrolling text underneath */
    box-shadow: 0 2px 4px rgba(0,0,0,0.15); 
}