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

body {
    font-family: 'Outfit', sans-serif;
    background: #F7F9FC;
    /* Clean modern background */
    color: #2D3748;
    min-height: 100vh;
    margin: 0;
    overflow-x: hidden;
}

.main-container {
    padding-top: 2rem;
}

/* Typography & Headings */
h1,
h2,
h3,
h4,
h5,
h6 {
    color: #1A202C;
}

/* CRM Layout Styles */
.crm-wrapper {
    display: flex;
    min-height: 100vh;
    width: 100%;
}

.crm-sidebar {
    width: 260px;
    background: #FFFFFF;
    color: #4A5568;
    flex-shrink: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1000;
    box-shadow: 2px 0 24px rgba(0, 0, 0, 0.04);
    position: fixed;
    height: 100vh;
    left: 0;
    top: 0;
    overflow-y: auto;
}

.crm-sidebar-header {
    padding: 2.5rem 1.5rem 2rem;
    text-align: center;
}

.crm-logo-box {
    width: 60px;
    height: 60px;
    background: #5E17EB;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
    box-shadow: 0 8px 15px rgba(94, 23, 235, 0.2);
}

.crm-logo-box i {
    color: #FFFFFF !important;
}

.crm-nav {
    padding: 1.5rem 0;
    list-style: none;
    margin: 0;
}

.crm-nav-item {
    margin-bottom: 0.5rem;
}

.crm-nav-link {
    display: flex;
    align-items: center;
    padding: 0.8rem 1.2rem;
    color: #4A5568;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s ease;
    border-radius: 8px;
    margin: 0 0.5rem;
}

.crm-nav-link i {
    width: 24px;
    margin-right: 12px;
    font-size: 1.2rem;
    text-align: center;
    transition: transform 0.2s ease;
}

.crm-nav-link:hover {
    color: #5E17EB;
    background: rgba(94, 23, 235, 0.04);
}

.crm-nav-link:hover i {
    transform: scale(1.1);
}

.crm-nav-link.active {
    color: #5E17EB;
    font-weight: 600;
    background: #f3e8ff;
}

.crm-nav-link.text-danger:hover {
    color: #E53E3E !important;
    background: rgba(229, 62, 62, 0.04);
}

/* Modern Logout Button */
.crm-logout-btn {
    display: flex;
    align-items: center;
    padding: 0.8rem 1.2rem;
    color: #E53E3E;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.2s ease;
    border-radius: 8px;
    margin: 0 0.5rem;
}

.crm-logout-btn i {
    width: 24px;
    margin-right: 12px;
    font-size: 1.2rem;
    text-align: center;
    transition: transform 0.2s ease;
}

.crm-logout-btn:hover {
    background: rgba(229, 62, 62, 0.04);
}

.crm-logout-btn:hover i {
    transform: translateX(4px);
}

.crm-main-content {
    flex-grow: 1;
    margin-left: 260px;
    padding: 2rem 3rem;
    min-height: 100vh;
    width: calc(100% - 260px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.crm-mobile-toggle {
    display: none;
    background: #FFFFFF;
    border: 1px solid rgba(0, 0, 0, 0.05);
    padding: 0.6rem 1.2rem;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    color: #2D3748;
    margin-bottom: 1.5rem;
    font-weight: 600;
    transition: all 0.2s;
}

.crm-mobile-toggle:hover {
    background: #F7F9FC;
    color: #5E17EB;
}

@media (max-width: 991px) {
    .crm-sidebar {
        transform: translateX(-100%);
    }

    .transaction-main-card {
        padding: 20px !important;
    }

    .card-icon-circle {
        display: none !important;
    }

    .crm-sidebar.show {
        transform: translateX(0);
    }

    .crm-main-content {
        margin-left: 0;
        width: 100%;
        padding: 0.75rem;
    }

    .crm-mobile-toggle {
        display: inline-flex;
        align-items: center;
    }

    .sidebar-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        background: rgba(15, 23, 42, 0.6);
        backdrop-filter: blur(4px);
        z-index: 999;
        display: none;
        opacity: 0;
        transition: opacity 0.3s ease;
    }

    .sidebar-overlay.show {
        display: block;
        opacity: 1;
    }
}

/* Glassmorphism & Modern Cards */
.card {
    background: #FFFFFF;
    border: 1px solid rgba(0, 0, 0, 0.04);
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.03);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.3s ease;
    overflow: hidden;
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: 0 20px 40px rgba(94, 23, 235, 0.08);
}

/* Primary Colors based on user code #5E17EB */
.bg-primary {
    background: linear-gradient(135deg, #5E17EB 0%, #8A2BE2 100%) !important;
}

.text-primary {
    color: #5E17EB !important;
}

.btn-primary {
    background: #5E17EB;
    border: none;
    border-radius: 50rem;
    font-weight: 600;
    color: white;
    padding: 0.6rem 1.5rem;
    box-shadow: 0 4px 12px rgba(94, 23, 235, 0.25);
    transition: all 0.3s ease;
}

.btn-primary:hover {
    background: #430da8;
    transform: translateY(-2px);
    color: white;
    box-shadow: 0 6px 15px rgba(94, 23, 235, 0.4);
}

.btn-outline-primary {
    border: 2px solid #5E17EB;
    color: #5E17EB;
    border-radius: 12px;
    font-weight: 600;
    transition: all 0.3s ease;
    background: transparent;
}

.btn-outline-primary:hover {
    background: #5E17EB;
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(94, 23, 235, 0.25);
}

/* Stat Cards */
.stat-card {
    border-radius: 16px;
    padding: 1.5rem;
    background: #FFFFFF;
    border: 1px solid rgba(0, 0, 0, 0.03);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.02);
    position: relative;
}

.icon-box {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.icon-box.rounded-lg {
    border-radius: 12px;
}

.trend-badge {
    display: inline-block;
    padding: 0.3rem 0.6rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
}

/* Tables */
.table {
    border-collapse: separate;
    border-spacing: 0 12px;
}

.table thead th {
    border-bottom: none;
    font-weight: 600;
    color: #718096;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 1px;
    padding: 0 1.5rem;
}

.table tbody tr {
    background: #fff;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.02);
    border-radius: 12px;
    transition: all 0.3s ease;
}

.table tbody tr:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.06);
}

.table tbody td {
    border: none;
    padding: 1.2rem 1.5rem;
    vertical-align: middle;
    color: #4A5568;
}

.table tbody td:first-child {
    border-top-left-radius: 12px;
    border-bottom-left-radius: 12px;
}

.table tbody td:last-child {
    border-top-right-radius: 12px;
    border-bottom-right-radius: 12px;
}

/* Inputs */
.form-control,
.form-select,
.input-group-text {
    border-radius: 12px;
    border: 1.5px solid #E2E8F0;
    padding: 0.8rem 1.2rem;
    background-color: #F8FAFC;
    transition: all 0.3s ease;
    font-weight: 500;
    color: #2D3748;
}

.input-group-text {
    background-color: #F8FAFC;
    border-right: none;
    color: #A0AEC0;
    padding-right: 0.5rem; /* Reduce space between icon and input */
}

.input-group .form-control,
.input-group .form-select {
    border-left: none;
    padding-left: 0.5rem; /* Reduce space between icon and input */
}

.form-control:focus,
.form-select:focus {
    box-shadow: none;
    border-color: #5E17EB;
    background-color: #FFFFFF;
}

.input-group:focus-within .input-group-text,
.input-group:focus-within .form-control {
    border-color: #5E17EB;
    background-color: #FFFFFF;
}

.input-group:focus-within .input-group-text {
    color: #5E17EB;
}

.input-group:focus-within {
    box-shadow: 0 0 0 4px rgba(94, 23, 235, 0.1);
    border-radius: 12px;
}

/* Custom fade animation */
.fade-in {
    animation: fadeIn 0.6s cubic-bezier(0.165, 0.84, 0.44, 1) forwards;
    opacity: 0;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Navbar (for non-authenticated pages) */
.navbar {
    background: linear-gradient(135deg, #5E17EB 0%, #8A2BE2 100%) !important;
    border-bottom-left-radius: 20px;
    border-bottom-right-radius: 20px;
    box-shadow: 0 10px 30px rgba(94, 23, 235, 0.2);
}

.nav-link {
    font-weight: 500;
    position: relative;
}

.nav-link::after {
    content: '';
    position: absolute;
    width: 0;
    height: 3px;
    background: #fff;
    bottom: 2px;
    left: 10px;
    border-radius: 3px;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-link:hover::after {
    width: calc(100% - 20px);
}

/* Links */
a {
    color: #5E17EB;
    transition: color 0.2s;
}

a:hover {
    color: #430da8;
}

/* CRM Enhancements */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    width: 100%;
}

.table th,
.table td {
    white-space: nowrap;
}

.badge-status {
    padding: 0.5rem 0.8rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.8rem;
}

.bg-soft-success {
    background-color: rgba(16, 185, 129, 0.1);
    color: #059669;
}

.bg-soft-warning {
    background-color: rgba(245, 158, 11, 0.1);
    color: #D97706;
}

.bg-soft-primary {
    background-color: rgba(94, 23, 235, 0.1);
    color: #5E17EB;
}

.bg-soft-danger {
    background-color: rgba(229, 62, 62, 0.1);
    color: #E53E3E;
}

.bg-soft-secondary {
    background-color: rgba(100, 116, 139, 0.1);
    color: #475569;
}

/* Proper Responsive Tables (Card View on Mobile) */
@media (max-width: 767px) {

    .table-responsive table,
    .table-responsive thead,
    .table-responsive tbody,
    .table-responsive th,
    .table-responsive td,
    .table-responsive tr {
        display: block;
    }

    .table-responsive thead tr {
        position: absolute;
        top: -9999px;
        left: -9999px;
    }

    .table-responsive tr {
        margin-bottom: 0.5rem;
        background: #fff;
        border-radius: 12px;
        padding: 0.75rem;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
        border: 1px solid rgba(0, 0, 0, 0.05);
    }

    .table-responsive td {
        border: none !important;
        position: relative;
        padding: 1rem 1rem 1rem 40% !important;
        text-align: right !important;
        border-bottom: 1px solid #f8fafc !important;
        min-height: 50px;
        white-space: normal;
        display: flex;
        justify-content: flex-end;
        align-items: center;
    }

    .table-responsive td::before {
        content: attr(data-label);
        position: absolute;
        left: 1rem;
        width: 35%;
        padding-right: 10px;
        white-space: nowrap;
        text-align: left;
        font-weight: 600;
        color: #718096;
        text-transform: uppercase;
        font-size: 0.75rem;
        top: 50%;
        transform: translateY(-50%);
    }

    .table-responsive td:last-child {
        border-bottom: 0 !important;
        justify-content: center;
        padding-left: 1rem !important;
    }

    .table-responsive td:last-child::before {
        display: none;
    }
}

/* Modern SweetAlert2 Custom Styling */
.modern-swal-popup {
    border-radius: 20px !important;
    padding: 2rem !important;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.1) !important;
    border: 1px solid rgba(0, 0, 0, 0.05) !important;
    font-family: 'Outfit', sans-serif !important;
}

.modern-swal-title {
    font-size: 1.5rem !important;
    font-weight: 700 !important;
    color: #1A202C !important;
}

.modern-swal-btn-confirm {
    border-radius: 50rem !important;
    padding: 0.6rem 2rem !important;
    font-weight: 600 !important;
    background: #E53E3E !important;
    color: white !important;
    border: none !important;
    outline: none !important;
    box-shadow: 0 4px 12px rgba(229, 62, 62, 0.25) !important;
    transition: all 0.3s ease !important;
}

.modern-swal-btn-confirm:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 6px 15px rgba(229, 62, 62, 0.4) !important;
}

.modern-swal-btn-cancel {
    border-radius: 50rem !important;
    padding: 0.6rem 2rem !important;
    font-weight: 600 !important;
    background: transparent !important;
    color: #4A5568 !important;
    border: 2px solid #E2E8F0 !important;
    transition: all 0.3s ease !important;
}

.modern-swal-btn-cancel:hover {
    background: #F7F9FC !important;
    border-color: #CBD5E1 !important;
    transform: translateY(-2px) !important;
}

/* Reports page styles */
.report-filter-form {
    margin: 0;
}

.filter-group {
    min-width: 220px;
}

.summary-label-net {
    margin-bottom: 12px;
}

.balance-divider {
    width: 1px;
    height: 30px;
    background: #e2e8f0;
}

.table-responsive-wrapper {
    overflow-x: auto;
}

.empty-transactions {
    text-align: center;
    padding: 30px;
    color: #64748b;
}

.pagination-controls {
    display: flex;
    align-items: center;
    gap: 20px;
}

.pag-text {
    font-size: 14px;
    color: #475569;
}

.pag-show-rows {
    display: flex;
    align-items: center;
    gap: 8px;
}

.select-wrapper {
    position: relative;
}

.custom-select {
    appearance: none;
    -webkit-appearance: none;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    padding: 6px 32px 6px 12px;
    font-size: 14px;
    color: #0f172a;
    outline: none;
    background: #fff;
    cursor: pointer;
    min-width: 60px;
}

.select-icon {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 11px;
    color: #475569;
    pointer-events: none;
}

/* Custom Table Styles */
.custom-table { width: 100%; border-collapse: separate; border-spacing: 0; }
.custom-table th {
    font-size: 11px;
    font-weight: 700;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 12px 16px;
    border-bottom: 1px solid #f1f5f9;
    text-align: left;
}
.custom-table td {
    padding: 16px;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
    font-size: 13px;
    color: #334155;
}
.custom-table tr:last-child td { border-bottom: none; }

.td-date { display: flex; align-items: flex-start; gap: 12px; }
.td-date i { color: #94a3b8; font-size: 16px; margin-top: 2px; }
.td-date .d-text { font-weight: 600; color: #1e293b; }
.td-date .d-time { font-size: 11px; color: #94a3b8; display: block; margin-top: 2px; }

.badge-type { padding: 4px 10px; border-radius: 4px; font-size: 11px; font-weight: 700; color: #fff; text-transform: uppercase; }
.bg-income { background: #16a34a; }
.bg-expense { background: #dc2626; }

.badge-method { padding: 4px 10px; border-radius: 4px; font-size: 11px; font-weight: 700; text-transform: uppercase; }
.bm-cash { background: #dcfce7; color: #16a34a; }
.bm-upi { background: #f3e8ff; color: #9333ea; }
.bm-online { background: #dbeafe; color: #2563eb; }

.amt-income { color: #16a34a; font-weight: 700; }
.amt-expense { color: #dc2626; font-weight: 700; }

.action-btns { display: flex; gap: 8px; }
.btn-action {
    width: 32px; height: 32px; border-radius: 6px; display: flex; align-items: center; justify-content: center; font-size: 13px; text-decoration: none; transition: all 0.2s;
}
.btn-edit { border: 1px solid #e0d4fc; color: #7c3aed; background: #fff; }
.btn-edit:hover { background: #f5f3ff; }
.btn-delete { border: 1px solid #fecaca; color: #dc2626; background: #fff; }
.btn-delete:hover { background: #fef2f2; }
.table-responsive-wrapper { overflow-x: auto; }

/* Global Button Radius Override */
.btn, .btn-action, .modern-swal-btn-confirm, .modern-swal-btn-cancel {
    border-radius: 10px !important;
}

/* Smaller placeholders and inputs on tablet and mobile */
@media (max-width: 991px) {
    ::placeholder {
        font-size: 13px !important;
    }
    ::-webkit-input-placeholder {
        font-size: 13px !important;
    }
    :-ms-input-placeholder {
        font-size: 13px !important;
    }
    .form-select, .form-control {
        font-size: 13px !important;
    }
    
    /* Responsive buttons */
    .btn-lg {
        padding: 0.75rem 1rem !important;
        font-size: 0.95rem !important;
    }
    .btn {
        padding: 0.5rem 1rem !important;
        font-size: 0.9rem !important;
    }
}