/* assets/css/style.css */

/* Fonts Import */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&display=swap');

:root {
    --font-primary: 'Outfit', sans-serif;
    
    /* Light Mode Variables */
    --bg-primary: #f8fafc;
    --bg-secondary: #ffffff;
    --bg-sidebar: #0f172a;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --border-color: #e2e8f0;
    --primary-color: #4f46e5;
    --primary-hover: #4338ca;
    --accent-color: #3b82f6;
    --sidebar-text: #94a3b8;
    --sidebar-active-bg: #1e293b;
    --sidebar-active-text: #ffffff;
    --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);
    --card-bg: #ffffff;
    --card-border: #f1f5f9;
}

/* Dark Mode Variables Override */
[data-bs-theme="dark"] {
    --bg-primary: #090d16;
    --bg-secondary: #0f172a;
    --bg-sidebar: #0b0f19;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --border-color: #1e293b;
    --primary-color: #6366f1;
    --primary-hover: #4f46e5;
    --accent-color: #60a5fa;
    --sidebar-text: #64748b;
    --sidebar-active-bg: #1e293b;
    --sidebar-active-text: #ffffff;
    --card-bg: #0f172a;
    --card-border: #1e293b;
}

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

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: var(--bg-primary);
}
::-webkit-scrollbar-thumb {
    background: var(--text-muted);
    border-radius: 4px;
}

/* App Layout Grid */
#app-wrapper {
    display: flex;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
}

/* Sidebar Styling */
#sidebar {
    width: 260px;
    min-width: 260px;
    background-color: #090d16 !important; /* Premium dark navy slate */
    display: flex;
    flex-direction: column;
    height: 100%;
    transition: all 0.3s ease;
    z-index: 1000;
    border-right: 1px solid rgba(255, 255, 255, 0.05);
}

#sidebar.collapsed {
    width: 80px;
    min-width: 80px;
}

#sidebar .brand {
    height: 75px;
    display: flex;
    align-items: center;
    padding: 0 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    color: #ffffff;
    text-decoration: none;
    font-weight: 700;
    font-size: 1.25rem;
    letter-spacing: 0.5px;
}

#sidebar .brand i {
    background: linear-gradient(135deg, var(--primary-color) 0%, #818cf8 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

#sidebar.collapsed .brand span {
    display: none;
}

/* User Badge Card */
.sidebar-user {
    background: rgba(255, 255, 255, 0.02);
    margin: 12px 16px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.05) !important;
}

.sidebar-user .bg-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, #312e81 100%) !important;
    box-shadow: 0 4px 10px rgba(79, 70, 229, 0.3);
}

#sidebar.collapsed .sidebar-user {
    margin: 12px 8px;
    padding: 8px !important;
}
#sidebar.collapsed .sidebar-user .user-info {
    display: none;
}

/* Sidebar Search Box */
.sidebar-search {
    margin: 0 16px 12px 16px;
    padding: 0 !important;
    border-bottom: none !important;
}

#sidebar.collapsed .sidebar-search {
    display: none;
}

.sidebar-search .form-control {
    background-color: rgba(255, 255, 255, 0.03) !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    border-radius: 8px !important;
    color: #ffffff !important;
    padding: 8px 12px !important;
}

.sidebar-search .form-control:focus {
    border-color: var(--primary-color) !important;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15) !important;
}

.sidebar-search .input-group-text {
    background-color: rgba(255, 255, 255, 0.03) !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    border-right: none !important;
    color: rgba(255, 255, 255, 0.4) !important;
}

#sidebar .nav-links {
    flex-grow: 1;
    padding: 10px 0;
    overflow-y: auto;
}

#sidebar .nav-item {
    margin: 2px 16px;
}

#sidebar.collapsed .nav-item {
    margin: 2px 8px;
}

#sidebar .nav-link {
    display: flex;
    align-items: center;
    padding: 10px 14px;
    color: #94a3b8 !important;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 500;
    font-size: 0.88rem;
    transition: all 0.25s ease;
    position: relative;
}

#sidebar .nav-link i {
    font-size: 1.15rem;
    margin-right: 12px;
    width: 20px;
    text-align: center;
    color: #64748b;
    transition: color 0.2s ease;
}

#sidebar.collapsed .nav-link i {
    margin-right: 0;
    width: 100%;
}

#sidebar.collapsed .nav-link span {
    display: none;
}

/* Hover & Active States */
#sidebar .nav-link:hover {
    background-color: rgba(255, 255, 255, 0.03) !important;
    color: #ffffff !important;
}

#sidebar .nav-link:hover i {
    color: #ffffff;
}

#sidebar .nav-item.active .nav-link {
    background-color: rgba(79, 70, 229, 0.08) !important;
    color: #ffffff !important;
    font-weight: 600;
}

#sidebar .nav-item.active .nav-link i {
    color: var(--primary-color) !important;
}

#sidebar .nav-item.active .nav-link::before {
    content: '';
    position: absolute;
    left: 0;
    top: 20%;
    height: 60%;
    width: 3px;
    background-color: var(--primary-color);
    border-radius: 0 4px 4px 0;
}

#sidebar .border-top {
    border-top: 1px solid rgba(255, 255, 255, 0.06) !important;
    padding: 16px !important;
}

#sidebar .btn-outline-danger {
    border-color: rgba(239, 68, 68, 0.2) !important;
    background-color: rgba(239, 68, 68, 0.03) !important;
    color: #f87171 !important;
    height: 40px !important;
    font-size: 0.85rem;
    font-weight: 600;
}

#sidebar .btn-outline-danger:hover {
    background-color: #ef4444 !important;
    color: #ffffff !important;
    border-color: #ef4444 !important;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.2);
}

/* Main Content Wrapper */
#content-wrapper {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    background-color: var(--bg-primary);
}

/* Navbar Styling */
.main-navbar {
    height: 70px;
    background-color: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 30px;
    z-index: 99;
    box-shadow: var(--shadow-sm);
}

/* Content Container */
.main-content {
    flex-grow: 1;
    overflow-y: auto;
    padding: 30px;
}

/* Premium Card Designs */
.crm-card {
    background-color: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    margin-bottom: 24px;
}

.crm-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.crm-card-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    background-color: transparent;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.crm-card-body {
    padding: 24px;
}

/* Premium Metrics/KPI Cards */
.kpi-card {
    border-left: 4px solid var(--primary-color);
}
.kpi-card.success { border-left-color: #10b981; }
.kpi-card.warning { border-left-color: #f59e0b; }
.kpi-card.danger { border-left-color: #ef4444; }
.kpi-card.info { border-left-color: #06b6d4; }

.kpi-value {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1;
    margin-bottom: 4px;
}

/* Timeline Custom Component */
.timeline {
    position: relative;
    padding-left: 30px;
    margin-left: 10px;
    border-left: 2px solid var(--border-color);
}

.timeline-item {
    position: relative;
    margin-bottom: 30px;
}

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

.timeline-marker {
    position: absolute;
    left: -41px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background-color: var(--bg-secondary);
    border: 4px solid var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
}

.timeline-item.success .timeline-marker { border-color: #10b981; }
.timeline-item.warning .timeline-marker { border-color: #f59e0b; }
.timeline-item.danger .timeline-marker { border-color: #ef4444; }
.timeline-item.info .timeline-marker { border-color: #06b6d4; }

.timeline-content {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 16px 20px;
    box-shadow: var(--shadow-sm);
}

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

/* Tag Styles */
.crm-tag {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 100px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 2px;
}

/* DataTables Styling Overrides */
.dataTables_wrapper .dataTables_paginate .paginate_button.current {
    background: var(--primary-color) !important;
    border-color: var(--primary-color) !important;
    color: #ffffff !important;
    border-radius: 6px;
}
.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
    background: var(--primary-hover) !important;
    border-color: var(--primary-hover) !important;
    color: #ffffff !important;
}

table.dataTable {
    border-collapse: collapse !important;
}

table.dataTable tbody tr {
    background-color: var(--card-bg) !important;
    color: var(--text-primary) !important;
}

table.dataTable thead th {
    border-bottom: 2px solid var(--border-color) !important;
    color: var(--text-secondary) !important;
    background-color: var(--bg-primary) !important;
}

/* Form Styling */
.form-control, .form-select {
    background-color: var(--card-bg);
    border-color: var(--border-color);
    color: var(--text-primary);
    border-radius: 8px;
    padding: 10px 14px;
}

.form-control:focus, .form-select:focus {
    background-color: var(--card-bg);
    border-color: var(--primary-color);
    color: var(--text-primary);
    box-shadow: 0 0 0 0.25rem rgba(79, 70, 229, 0.15);
}

/* Mobile Responsive Sidebar Overlap & Overrides */
@media (max-width: 768px) {
    #sidebar {
        position: fixed !important;
        left: -280px !important;
        width: 280px !important;
        height: 100% !important;
        z-index: 1000 !important;
        box-shadow: 10px 0 30px rgba(0, 0, 0, 0.25) !important;
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
        transform: translateX(0);
    }
    #sidebar.show {
        transform: translateX(280px);
    }
    #sidebar .brand {
        height: 60px;
    }
}

/* --- PREMIUM MOBILE-FIRST SaaS OVERHAUL --- */

/* Micro-interactions & Smooth Transitions */
.crm-card, .btn, .nav-link, .bottom-nav-item, .fab-main-btn, .fab-action-btn {
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

.crm-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg) !important;
}

/* Glassmorphism Sidebar Overlay */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    opacity: 0;
    pointer-events: none;
    z-index: 999;
    transition: opacity 0.3s ease;
}
.sidebar-overlay.show {
    opacity: 1;
    pointer-events: auto;
}

/* Mobile Bottom Navigation Bar */
.mobile-bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 65px;
    background-color: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.05);
    display: flex;
    justify-content: space-around;
    align-items: center;
    z-index: 900;
    padding-bottom: env(safe-area-inset-bottom);
    backdrop-filter: blur(10px);
    background-color: rgba(255, 255, 255, 0.85);
}

[data-bs-theme="dark"] .mobile-bottom-nav {
    background-color: rgba(15, 23, 42, 0.85);
    border-top: 1px solid var(--border-color);
}

.bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.7rem;
    font-weight: 500;
    width: 20%;
    height: 100%;
    position: relative;
}

.bottom-nav-item i {
    font-size: 1.25rem;
    margin-bottom: 4px;
    transition: transform 0.2s ease;
}

.bottom-nav-item:hover, .bottom-nav-item.active {
    color: var(--primary-color);
}

.bottom-nav-item.active i {
    transform: translateY(-2px);
}

.bottom-nav-item.active::after {
    content: '';
    position: absolute;
    top: 0;
    width: 30px;
    height: 3px;
    background-color: var(--primary-color);
    border-radius: 0 0 4px 4px;
}

/* Floating Action Button (FAB) */
.fab-wrapper {
    position: fixed;
    bottom: 80px;
    right: 20px;
    z-index: 999;
}

.fab-main-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color) 0%, #818cf8 100%);
    color: #ffffff;
    border: none;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    cursor: pointer;
    z-index: 1001;
    position: relative;
}

.fab-main-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 16px rgba(79, 70, 229, 0.45);
}

.fab-wrapper.open .fab-main-btn {
    transform: rotate(135deg);
    background: #ef4444;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.35);
}

.fab-menu {
    position: absolute;
    bottom: 60px;
    right: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
    pointer-events: none;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.25s, transform 0.25s;
    z-index: 1000;
}

.fab-wrapper.open .fab-menu {
    pointer-events: auto;
    opacity: 1;
    transform: translateY(0);
}

.fab-action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    box-shadow: var(--shadow-md);
    position: relative;
}

.fab-label {
    position: absolute;
    right: 60px;
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    box-shadow: var(--shadow-sm);
    white-space: nowrap;
    border: 1px solid var(--border-color);
}

.fab-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(4px);
    opacity: 0;
    pointer-events: none;
    z-index: 998;
    transition: opacity 0.25s ease;
}

.fab-overlay.show {
    opacity: 1;
    pointer-events: auto;
}

/* Premium Mobile Card Layouts for Tables */
.crm-mobile-card {
    background-color: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 12px;
    box-shadow: var(--shadow-sm);
}

.crm-mobile-card .card-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-color);
}

.crm-mobile-card .card-row:last-child {
    border-bottom: none;
}

.crm-mobile-card .card-row .label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.crm-mobile-card .card-row .value {
    font-size: 0.85rem;
    font-weight: 600;
    text-align: right;
}

/* Main Content Area Spacing Adjustments */
@media (max-width: 768px) {
    .main-content {
        padding: 12px !important;
        padding-bottom: 85px !important; /* avoid bottom nav overlay */
    }
    .main-navbar {
        padding: 0 15px !important;
        height: 60px !important;
    }
    #content-wrapper {
        height: calc(100vh - 65px) !important;
    }
    #app-wrapper {
        height: 100vh !important;
    }
    body {
        font-size: 0.9rem;
    }
    .kpi-value {
        font-size: 1.6rem;
    }
}

@media (min-width: 768px) and (max-width: 1024px) {
    .main-content {
        padding: 20px !important;
        padding-bottom: 85px !important;
    }
}

/* Collapsible Form/Info Accordion Styling */
.accordion-premium {
    border: 1px solid var(--card-border);
    border-radius: 12px;
    overflow: hidden;
    background-color: var(--card-bg);
    margin-bottom: 15px;
}

.accordion-premium-header {
    background-color: var(--bg-secondary);
    padding: 16px 20px;
    font-weight: 700;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    border-bottom: 1px solid var(--border-color);
}

.accordion-premium-body {
    padding: 20px;
}

/* Touch Friendly Form Fields & Sticky Actions */
.form-control, .form-select, .btn {
    min-height: 44px; /* Touch target minimum */
}

@media (max-width: 768px) {
    .mobile-sticky-action-bar {
        position: fixed;
        bottom: 65px; /* right above bottom nav */
        left: 0;
        width: 100%;
        background-color: var(--bg-secondary);
        border-top: 1px solid var(--border-color);
        padding: 12px 16px;
        display: flex;
        gap: 10px;
        z-index: 890;
        box-shadow: 0 -4px 15px rgba(0, 0, 0, 0.05);
    }
    .mobile-sticky-action-bar .btn {
        flex: 1;
        margin: 0 !important;
    }
}

/* Modern Soft Tonal Buttons (Premium MNC Style) */
.btn-soft-primary {
    background-color: rgba(79, 70, 229, 0.08) !important;
    color: #4f46e5 !important;
    border: none !important;
    font-weight: 600;
}
.btn-soft-primary:hover, .btn-soft-primary:active {
    background-color: rgba(79, 70, 229, 0.15) !important;
}

.btn-soft-secondary {
    background-color: rgba(100, 116, 139, 0.08) !important;
    color: #64748b !important;
    border: none !important;
    font-weight: 600;
}
.btn-soft-secondary:hover, .btn-soft-secondary:active {
    background-color: rgba(100, 116, 139, 0.15) !important;
}

.btn-soft-success {
    background-color: rgba(16, 185, 129, 0.08) !important;
    color: #10b981 !important;
    border: none !important;
    font-weight: 600;
}
.btn-soft-success:hover, .btn-soft-success:active {
    background-color: rgba(16, 185, 129, 0.15) !important;
}

.btn-soft-warning {
    background-color: rgba(245, 158, 11, 0.08) !important;
    color: #d97706 !important;
    border: none !important;
    font-weight: 600;
}
.btn-soft-warning:hover, .btn-soft-warning:active {
    background-color: rgba(245, 158, 11, 0.15) !important;
}

.btn-soft-danger {
    background-color: rgba(239, 68, 68, 0.08) !important;
    color: #ef4444 !important;
    border: none !important;
    font-weight: 600;
}
.btn-soft-danger:hover, .btn-soft-danger:active {
    background-color: rgba(239, 68, 68, 0.15) !important;
}

.btn-soft-whatsapp {
    background-color: rgba(37, 211, 102, 0.08) !important;
    color: #25d366 !important;
    border: none !important;
}
.btn-soft-whatsapp:hover, .btn-soft-whatsapp:active {
    background-color: rgba(37, 211, 102, 0.15) !important;
}

/* Adjust mobile card action buttons */
.crm-mobile-card .btn {
    border-radius: 30px !important; /* Premium Pill style */
    padding: 8px 16px !important;
    font-size: 0.8rem !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 36px;
    font-weight: 600;
}

.crm-mobile-card .btn-icon {
    width: 36px !important;
    height: 36px !important;
    padding: 0 !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50% !important;
}

