/* RealEstate CRM Custom Styling */
:root {
    --crm-primary: #3b82f6;
    --crm-primary-dark: #1d4ed8;
    --crm-secondary: #64748b;
    --crm-success: #10b981;
    --crm-warning: #f59e0b;
    --crm-danger: #ef4444;
    --crm-info: #06b6d4;
    --crm-dark: #0f172a;
    --crm-sidebar-bg: #1e293b;
    --crm-card-bg: #ffffff;
    --crm-body-bg: #f8fafc;
    --crm-border-color: #e2e8f0;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: var(--crm-body-bg);
    color: #1e293b;
    min-height: 100vh;
}

/* Sidebar Styling */
#sidebar {
    background-color: var(--crm-sidebar-bg);
    color: #f1f5f9;
    min-height: 100vh;
    transition: all 0.2s ease-in-out;
}

#sidebar .nav-link {
    color: #94a3b8;
    font-weight: 500;
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    margin-bottom: 0.25rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    transition: all 0.15s ease-in-out;
}

#sidebar .nav-link:hover {
    color: #ffffff;
    background-color: rgba(255, 255, 255, 0.08);
}

#sidebar .nav-link.active {
    color: #ffffff;
    background-color: var(--crm-primary);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.35);
}

#sidebar .nav-link.nav-locked {
    opacity: 0.65;
    cursor: not-allowed;
}

#sidebar .nav-link.nav-locked:hover {
    background-color: rgba(245, 158, 11, 0.08);
    color: #cbd5e1;
}

#sidebar .nav-link.nav-locked .lock-badge {
    margin-left: auto;
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 4px;
    background: rgba(245, 158, 11, 0.18);
    color: #f59e0b;
    border: 1px solid rgba(245, 158, 11, 0.35);
    font-weight: 600;
}

/* Top Navbar */
.crm-header {
    background-color: #ffffff;
    border-bottom: 1px solid var(--crm-border-color);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
}

/* Metric Cards */
.crm-stat-card {
    border: none;
    border-radius: 0.75rem;
    background: #ffffff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    border: 1px solid var(--crm-border-color);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.crm-stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.07);
}

.stat-icon-box {
    width: 48px;
    height: 48px;
    border-radius: 0.625rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
}

/* Pipeline Badges */
.badge-stage-new { background-color: #e0e7ff; color: #3730a3; border: 1px solid #c7d2fe; }
.badge-stage-contacted { background-color: #e0f2fe; color: #0369a1; border: 1px solid #bae6fd; }
.badge-stage-site_visit_scheduled { background-color: #fef3c7; color: #92400e; border: 1px solid #fde68a; }
.badge-stage-site_visit_completed { background-color: #dbeafe; color: #1e40af; border: 1px solid #bfdbfe; }
.badge-stage-negotiation { background-color: #f3e8ff; color: #6b21a8; border: 1px solid #e9d5ff; }
.badge-stage-closed_won { background-color: #d1fae5; color: #065f46; border: 1px solid #a7f3d0; }
.badge-stage-closed_lost { background-color: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }

/* Call Classification Badges */
.badge-call-short {
    background-color: #fef3c7;
    color: #92400e;
    border: 1px solid #fde68a;
    font-weight: 600;
}

.badge-call-long {
    background-color: #e0f2fe;
    color: #075985;
    border: 1px solid #bae6fd;
    font-weight: 600;
}

/* Punch Badges */
.badge-punch-in {
    background-color: #d1fae5;
    color: #065f46;
    font-weight: 700;
}

.badge-punch-out {
    background-color: #fef3c7;
    color: #92400e;
    font-weight: 700;
}

/* DataTables customization */
.dataTables_wrapper .dataTables_paginate .paginate_button.current {
    background: var(--crm-primary) !important;
    color: #ffffff !important;
    border-color: var(--crm-primary) !important;
    border-radius: 0.375rem;
}

.dataTables_wrapper .dataTables_filter input {
    border: 1px solid var(--crm-border-color);
    border-radius: 0.375rem;
    padding: 0.375rem 0.75rem;
}

.dataTables_wrapper .dataTables_length select {
    border: 1px solid var(--crm-border-color);
    border-radius: 0.375rem;
    padding: 0.375rem 0.75rem;
}

/* Stage filter pills */
.stage-filter-btn {
    border-radius: 2rem;
    font-size: 0.85rem;
    font-weight: 500;
    padding: 0.35rem 0.85rem;
    transition: all 0.15s ease;
}

/* Map link button */
.btn-map-link {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.825rem;
    font-weight: 600;
    text-decoration: none;
    padding: 0.25rem 0.6rem;
    border-radius: 0.375rem;
    background-color: #f1f5f9;
    color: #2563eb;
    border: 1px solid #cbd5e1;
    transition: all 0.15s ease;
}

.btn-map-link:hover {
    background-color: #2563eb;
    color: #ffffff;
    border-color: #2563eb;
}

/* Punch Widget in Header */
.punch-header-widget {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background-color: #f8fafc;
    padding: 0.35rem 0.75rem;
    border-radius: 0.5rem;
    border: 1px solid var(--crm-border-color);
}

/* Toast container */
.toast-container {
    z-index: 1080;
}

/* ========================================== */
/* STAGE 2 STYLES                             */
/* ========================================== */

/* Unit Status Badges */
.badge-unit-available { background-color: #d1fae5; color: #065f46; border: 1px solid #a7f3d0; font-weight: 600; }
.badge-unit-blocked { background-color: #fef3c7; color: #92400e; border: 1px solid #fde68a; font-weight: 600; }
.badge-unit-booked { background-color: #dbeafe; color: #1e40af; border: 1px solid #bfdbfe; font-weight: 600; }
.badge-unit-sold { background-color: #fee2e2; color: #991b1b; border: 1px solid #fecaca; font-weight: 600; }

/* Sentiment Badges */
.badge-sentiment-interested { background-color: #d1fae5; color: #065f46; font-weight: 600; }
.badge-sentiment-booking_soon { background-color: #e0e7ff; color: #3730a3; font-weight: 700; border: 1px solid #c7d2fe; }
.badge-sentiment-price_high { background-color: #fef3c7; color: #92400e; font-weight: 600; }
.badge-sentiment-location_disliked { background-color: #f1f5f9; color: #475569; font-weight: 600; }
.badge-sentiment-lost { background-color: #fee2e2; color: #991b1b; font-weight: 600; }

/* Star Rating Component */
.star-rating-input {
    display: inline-flex;
    gap: 0.35rem;
    font-size: 1.6rem;
    cursor: pointer;
}
.star-rating-input i {
    color: #cbd5e1;
    transition: color 0.15s ease, transform 0.15s ease;
}
.star-rating-input i:hover {
    transform: scale(1.15);
}
.star-rating-input i.active {
    color: #f59e0b;
}

/* Property Project Cards */
.property-card {
    border-radius: 0.75rem;
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    border: 1px solid var(--crm-border-color);
}
.property-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.08);
}
.property-img-header {
    height: 140px;
    object-fit: cover;
    width: 100%;
    background-color: #e2e8f0;
}

/* Leaderboard Badges */
.rank-badge {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
}
.rank-1 { background: linear-gradient(135deg, #fef08a, #eab308); color: #713f12; box-shadow: 0 2px 6px rgba(234, 179, 8, 0.4); }
.rank-2 { background: linear-gradient(135deg, #e2e8f0, #94a3b8); color: #1e293b; box-shadow: 0 2px 6px rgba(148, 163, 184, 0.4); }
.rank-3 { background: linear-gradient(135deg, #fed7aa, #f97316); color: #7c2d12; box-shadow: 0 2px 6px rgba(249, 115, 22, 0.4); }

/* Printable Cost Sheet Sheet Styling */
.cost-sheet-print {
    background-color: #ffffff;
    padding: 2.5rem;
    border-radius: 0.5rem;
    border: 1px solid var(--crm-border-color);
}
.cost-sheet-header {
    border-bottom: 2px solid #0f172a;
    padding-bottom: 1rem;
    margin-bottom: 1.5rem;
}

@media print {
    body * {
        visibility: hidden;
    }
    #costSheetPrintArea, #costSheetPrintArea *,
    #receiptPrintArea, #receiptPrintArea * {
        visibility: visible;
    }
    #costSheetPrintArea, #receiptPrintArea {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        margin: 0;
        padding: 20px;
        border: none;
        box-shadow: none;
    }
    .no-print {
        display: none !important;
    }
}

/* ========================================== */
/* STAGE 3 ENHANCEMENTS */
/* ========================================== */

/* WhatsApp Button */
.btn-whatsapp {
    background-color: #25d366;
    color: #ffffff;
    border: none;
    font-weight: 600;
    transition: all 0.2s ease;
}
.btn-whatsapp:hover {
    background-color: #128c7e;
    color: #ffffff;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 211, 102, 0.35);
}

/* Booking Status Badges */
.badge-booking-token_received { background-color: #e0f2fe; color: #0369a1; border: 1px solid #bae6fd; }
.badge-booking-agreement_signed { background-color: #fef3c7; color: #92400e; border: 1px solid #fde68a; }
.badge-booking-loan_sanctioned { background-color: #f3e8ff; color: #6b21a8; border: 1px solid #e9d5ff; }
.badge-booking-registered { background-color: #d1fae5; color: #065f46; border: 1px solid #a7f3d0; }
.badge-booking-cancelled { background-color: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }

/* Commission Badges */
.badge-comm-pending { background-color: #fef3c7; color: #92400e; border: 1px solid #fde68a; }
.badge-comm-approved { background-color: #dbeafe; color: #1e40af; border: 1px solid #bfdbfe; }
.badge-comm-paid { background-color: #d1fae5; color: #065f46; border: 1px solid #a7f3d0; }

/* Unified Chronological Activity Timeline */
.timeline-container {
    position: relative;
    padding-left: 2rem;
}
.timeline-container::before {
    content: '';
    position: absolute;
    top: 5px;
    bottom: 5px;
    left: 17px;
    width: 2px;
    background-color: #e2e8f0;
}
.timeline-item {
    position: relative;
    margin-bottom: 1.5rem;
}
.timeline-item:last-child {
    margin-bottom: 0;
}
.timeline-icon {
    position: absolute;
    left: -2rem;
    top: 0;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    background: #ffffff;
    border: 2px solid #e2e8f0;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    z-index: 1;
}
.timeline-card {
    background: #ffffff;
    border: 1px solid var(--crm-border-color);
    border-radius: 0.625rem;
    padding: 0.85rem 1.15rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.03);
    transition: all 0.15s ease;
}
.timeline-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.06);
    border-color: #cbd5e1;
}

/* Printable Token Receipt Styling */
.receipt-box {
    background: #ffffff;
    border: 2px solid #1e293b;
    border-radius: 0.5rem;
    padding: 2.5rem;
    color: #1e293b;
}
.receipt-header {
    border-bottom: 2px solid #1e293b;
    padding-bottom: 1.25rem;
    margin-bottom: 1.5rem;
}
.receipt-table th {
    background-color: #f8fafc;
    color: #475569;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.receipt-watermark {
    position: relative;
    overflow: hidden;
}
.receipt-watermark::after {
    content: 'OFFICIAL RECEIPT';
    position: absolute;
    top: 45%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(-30deg);
    font-size: 4rem;
    font-weight: 900;
    color: rgba(15, 23, 42, 0.04);
    pointer-events: none;
    white-space: nowrap;
}

/* ========================================== */
/* STAGE 4 STYLES: PAYMENT MILESTONES         */
/* ========================================== */

/* Milestone Status Badges */
.badge-milestone-upcoming { background-color: #f1f5f9; color: #475569; border: 1px solid #cbd5e1; font-weight: 600; }
.badge-milestone-demanded { background-color: #dbeafe; color: #1e40af; border: 1px solid #93c5fd; font-weight: 600; }
.badge-milestone-partially_paid { background-color: #fef3c7; color: #92400e; border: 1px solid #fde68a; font-weight: 600; }
.badge-milestone-paid { background-color: #d1fae5; color: #065f46; border: 1px solid #6ee7b7; font-weight: 700; }
.badge-milestone-overdue { background-color: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; font-weight: 700; }

/* Construction Progress Badges */
.badge-const-pending { background-color: #f8fafc; color: #64748b; border: 1px dashed #cbd5e1; }
.badge-const-in_progress { background-color: #ffedd5; color: #c2410c; border: 1px solid #fdba74; font-weight: 600; }
.badge-const-completed { background-color: #ecfdf5; color: #047857; border: 1px solid #a7f3d0; font-weight: 600; }

/* Demand Notice Letterhead Box */
.demand-notice-box {
    background: #ffffff;
    border: 2px solid #0f172a;
    border-radius: 0.5rem;
    padding: 2.5rem;
    color: #0f172a;
    position: relative;
}
.demand-notice-box::after {
    content: 'DEMAND NOTICE';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(-30deg);
    font-size: 4.5rem;
    font-weight: 900;
    color: rgba(15, 23, 42, 0.035);
    pointer-events: none;
    white-space: nowrap;
}
.demand-header {
    border-bottom: 2px solid #0f172a;
    padding-bottom: 1.25rem;
    margin-bottom: 1.5rem;
}
.demand-table th {
    background-color: #f8fafc;
    color: #334155;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* Print Rules for Demand Notice */
@media print {
    .no-print {
        display: none !important;
    }
}

/* Telecaller Sequential Contacts Fast Scroll Container */
.tc-table-scroll-container {
    max-height: 64vh;
    overflow-y: scroll;
    overflow-x: auto;
    position: relative;
    border: 1px solid var(--crm-border-color);
    border-radius: 0.5rem;
    background-color: #ffffff;
}

/* Custom High-Visibility Scrollbar for 10,000+ Rows */
.tc-table-scroll-container::-webkit-scrollbar {
    width: 13px;
    height: 13px;
}
.tc-table-scroll-container::-webkit-scrollbar-track {
    background: #0f172a;
    border-radius: 8px;
}
.tc-table-scroll-container::-webkit-scrollbar-thumb {
    background: #0284c7;
    border-radius: 8px;
    border: 2px solid #0f172a;
}
.tc-table-scroll-container::-webkit-scrollbar-thumb:hover {
    background: #38bdf8;
}

/* Sticky Header so columns remain visible when scrolling 10,000 rows */
.tc-table-scroll-container thead th {
    position: sticky;
    top: 0;
    background: #0f172a !important;
    color: #ffffff !important;
    z-index: 5;
    box-shadow: 0 2px 4px rgba(0,0,0,0.15);
}

/* Notification Dropdown Items */
.notif-item {
    transition: all 0.2s ease-in-out;
}
.notif-item:hover {
    background-color: #f1f5f9 !important;
    transform: translateX(2px);
}
.notif-item.bg-primary-subtle {
    background-color: rgba(37, 99, 235, 0.08) !important;
}



