/* Uniox Leather Export - Custom Styles with Leather-Inspired Theme */

:root {
    --sidebar-width: 260px;
    --sidebar-collapsed-width: 60px;
    /* Pleasant Blue Theme */
    --primary-color: #1e88e5;        /* Vibrant Blue */
    --secondary-color: #42a5f5;      /* Light Blue */
    --accent-color: #64b5f6;         /* Sky Blue */
    --hover-color: #1565c0;          /* Deep Blue */
    --text-light: #ffffff;           /* White */
    --bg-light: #f5f9fc;             /* Light Blue Background */
    --success-color: #66bb6a;        /* Green */
    --danger-color: #ef5350;         /* Red */
    --warning-color: #ffa726;        /* Orange */
    --info-color: #26c6da;           /* Cyan */
    --dark-text: #263238;            /* Blue Gray Dark */
    --border-color: #e3f2fd;         /* Light Blue Border */
    --card-shadow: rgba(30, 136, 229, 0.15);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    overflow-x: hidden;
}

/* Login Page Styles */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--secondary-color) 0%, var(--primary-color) 50%, #0d47a1 100%);
    position: relative;
}

.login-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: repeating-linear-gradient(
        45deg,
        transparent,
        transparent 10px,
        rgba(255,255,255,0.02) 10px,
        rgba(255,255,255,0.02) 20px
    );
    pointer-events: none;
}

.login-box {
    background: linear-gradient(180deg, #FFFFFF 0%, var(--bg-light) 100%);
    padding: 45px;
    border-radius: 15px;
    box-shadow: 0 15px 50px rgba(0,0,0,0.4);
    width: 100%;
    max-width: 420px;
    border: 2px solid rgba(100, 181, 246, 0.3);
    position: relative;
    z-index: 1;
}

.login-box h2 {
    color: var(--primary-color);
    font-weight: 700;
    margin-bottom: 25px;
    letter-spacing: 0.5px;
}

.login-box h2::after {
    content: '';
    display: block;
    width: 60px;
    height: 3px;
    background: linear-gradient(90deg, var(--accent-color), var(--primary-color));
    margin: 10px auto 0;
    border-radius: 2px;
}

/* Sidebar Styles */
/* Sidebar Backdrop for Mobile */
.sidebar-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    display: none;
    transition: opacity 0.3s ease;
}

.sidebar-backdrop.show {
    display: block;
}

.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
    width: var(--sidebar-width);
    background: linear-gradient(180deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: var(--text-light);
    overflow-y: auto;
    overflow-x: hidden;
    transition: width 0.3s ease;
    z-index: 1000;
    box-shadow: 4px 0 15px var(--card-shadow);
    -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
}

.sidebar.collapsed {
    width: var(--sidebar-collapsed-width);
}

@media (max-width: 768px) {
    .sidebar.collapsed {
        transform: translateX(calc(-1 * var(--sidebar-width)));
        width: var(--sidebar-width);
    }
    
    .sidebar:not(.collapsed) {
        transform: translateX(0);
    }
}

@media (min-width: 769px) {
    .sidebar-backdrop {
        display: none !important;
    }
}

.sidebar-header {
    padding: 20px;
    background: rgba(0, 0, 0, 0.15);
    text-align: center;
    border-bottom: 2px solid rgba(100, 181, 246, 0.3);
    position: relative;
    white-space: nowrap;
    overflow: hidden;
    transition: all 0.3s ease;
}

.sidebar.collapsed .sidebar-header {
    padding: 20px 5px;
}

.sidebar.collapsed .sidebar-header h4,
.sidebar.collapsed .sidebar-header small {
    opacity: 0;
    visibility: hidden;
}

.sidebar-header .sidebar-close {
    position: absolute;
    right: 10px;
    top: 10px;
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.9);
    font-size: 24px;
    cursor: pointer;
    padding: 5px;
    width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.sidebar.collapsed .sidebar-close {
    opacity: 0;
    visibility: hidden;
}

.sidebar-header .sidebar-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--accent-color);
    transform: rotate(90deg);
}

.sidebar-header h4 {
    margin: 0;
    font-weight: 700;
    color: var(--accent-color);
    font-size: 1.3rem;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
    letter-spacing: 0.5px;
}

.sidebar-header small {
    color: rgba(255,255,255,0.85);
    font-size: 0.85rem;
}

.sidebar-menu {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-menu li {
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.menu-section {
    padding: 15px 20px 10px;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(255,255,255,0.5);
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    transition: all 0.3s ease;
}

.sidebar.collapsed .menu-section {
    padding: 15px 5px 10px;
    font-size: 0;
}

.menu-link {
    display: flex;
    align-items: center;
    padding: 15px 20px;
    color: rgba(255,255,255,0.9);
    text-decoration: none;
    transition: all 0.3s ease;
    border-left: 3px solid transparent;
    white-space: nowrap;
    overflow: hidden;
}

.sidebar.collapsed .menu-link {
    padding: 15px 0;
    justify-content: center;
    border-left: none;
}

.menu-link:hover {
    background: rgba(100, 181, 246, 0.2);
    color: var(--accent-color);
    padding-left: 25px;
    border-left-color: var(--accent-color);
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.1);
}

.sidebar.collapsed .menu-link:hover {
    padding-left: 0;
    border-left: none;
}

.menu-link.active {
    background: rgba(100, 181, 246, 0.25);
    color: var(--accent-color);
    border-left: 4px solid var(--accent-color);
    font-weight: 600;
}

.sidebar.collapsed .menu-link.active {
    border-left: none;
    background: rgba(100, 181, 246, 0.3);
}

.menu-link i {
    width: 25px;
    margin-right: 10px;
    font-size: 18px;
    text-align: center;
    flex-shrink: 0;
}

.sidebar.collapsed .menu-link i {
    margin-right: 0;
    font-size: 20px;
}

.menu-link span {
    opacity: 1;
    visibility: visible;
    transition: all 0.3s ease;
}

.sidebar.collapsed .menu-link span {
    opacity: 0;
    visibility: hidden;
    width: 0;
}

/* Main Content Styles */
#main-content {
    margin-left: var(--sidebar-collapsed-width);
    min-height: 100vh;
    background: linear-gradient(135deg, #FAFAFA 0%, var(--bg-light) 100%);
    transition: margin-left 0.3s ease;
}

#main-content.expanded {
    margin-left: 0;
}

@media (max-width: 768px) {
    #main-content {
        margin-left: 0 !important;
    }
}

.navbar {
    padding: 15px 20px;
    background: linear-gradient(90deg, #FFFFFF 0%, var(--bg-light) 100%);
    border-bottom: 2px solid var(--accent-color);
    box-shadow: 0 2px 8px var(--card-shadow);
}

#sidebar-toggle {
    font-size: 20px;
    color: var(--primary-color);
}

#user-name {
    margin-left: 5px;
    font-weight: 500;
}

/* Page Content */
#page-content {
    padding: 20px 0;
}

.page-header {
    margin-bottom: 30px;
    padding-bottom: 15px;
    border-bottom: 3px solid var(--accent-color);
    background: linear-gradient(90deg, transparent 0%, rgba(100, 181, 246, 0.1) 100%);
    padding-left: 15px;
    border-radius: 5px;
}

.page-header h3 {
    color: var(--primary-color);
    font-weight: 700;
    letter-spacing: 0.5px;
}

/* Card Styles */
.card {
    border: 1px solid var(--border-color);
    border-radius: 10px;
    box-shadow: 0 2px 8px var(--card-shadow);
    margin-bottom: 20px;
    background: linear-gradient(135deg, #FFFFFF 0%, var(--bg-light) 100%);
    transition: all 0.3s ease;
}

.card:hover {
    box-shadow: 0 6px 20px var(--card-shadow);
    transform: translateY(-2px);
    border-color: var(--accent-color);
}

.card-header {
    background: linear-gradient(90deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: var(--text-light);
    font-weight: 700;
    padding: 15px 20px;
    letter-spacing: 0.5px;
    border-bottom: 2px solid var(--accent-color);
}

/* Table Styles */
.table-responsive {
    border-radius: 5px;
    overflow: hidden;
}

.table {
    margin-bottom: 0;
}

.table thead th {
    background: linear-gradient(180deg, var(--secondary-color) 0%, var(--primary-color) 100%);
    color: var(--text-light);
    border: none;
    border-bottom: 3px solid var(--accent-color);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.85rem;
    padding: 12px;
    letter-spacing: 0.5px;
}

.table tbody tr {
    transition: background 0.2s ease;
}

.table tbody tr:hover {
    background: rgba(100, 181, 246, 0.1);
}

.table tbody td {
    vertical-align: middle;
    padding: 12px;
}

/* Button Styles */
.btn {
    border-radius: 5px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.btn-primary {
    background: var(--primary-color);
    border: none;
    font-weight: 500;
}

.btn-primary:hover {
    background: var(--hover-color);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px var(--card-shadow);
}

.btn-sm {
    padding: 5px 10px;
    font-size: 13px;
}

/* Form Styles */
.form-label {
    font-weight: 500;
    color: var(--primary-color);
    margin-bottom: 5px;
}

.form-control, .form-select {
    border-radius: 5px;
    border: 1px solid #ddd;
    padding: 10px 15px;
}

.form-control:focus, .form-select:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 0.25rem rgba(100, 181, 246, 0.25);
    background: var(--bg-light);
}

/* Badge Styles */
.badge {
    padding: 6px 12px;
    font-weight: 600;
    border-radius: 6px;
    letter-spacing: 0.3px;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-overlay .spinner-border {
    width: 3rem;
    height: 3rem;
}

/* Alert Styles */
.alert {
    border-radius: 5px;
    border: none;
}

/* Modal Styles */
.modal-header {
    background: linear-gradient(90deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: var(--text-light);
    border-bottom: 2px solid var(--accent-color);
}

.modal-header .btn-close {
    filter: invert(1);
}

/* Item Rows (for dynamic forms) */
.item-row {
    background: white;
    padding: 15px;
    margin-bottom: 10px;
    border-radius: 5px;
    border: 1px solid #ddd;
}

.item-row:hover {
    box-shadow: 0 2px 8px var(--card-shadow);
    border-color: var(--accent-color);
}

.remove-item-btn {
    cursor: pointer;
    color: var(--danger-color);
}

.remove-item-btn:hover {
    color: #8B3A1F;
}

/* Print Styles */
@media print {
    .no-print {
        display: none !important;
    }
    
    body {
        margin: 0;
        padding: 0;
    }
}

/* Responsive Styles */
@media (max-width: 768px) {
    .sidebar {
        width: var(--sidebar-width);
    }
    
    .sidebar.collapsed {
        transform: translateX(calc(-1 * var(--sidebar-width)));
        width: var(--sidebar-width);
    }
    
    .sidebar:not(.collapsed) {
        transform: translateX(0);
        width: var(--sidebar-width);
        box-shadow: 4px 0 25px rgba(0, 0, 0, 0.5);
    }
    
    /* Reset collapsed styles for mobile - show full menu */
    .sidebar:not(.collapsed) .sidebar-header {
        padding: 20px;
    }
    
    .sidebar:not(.collapsed) .sidebar-header h4,
    .sidebar:not(.collapsed) .sidebar-header small {
        opacity: 1;
        visibility: visible;
    }
    
    .sidebar:not(.collapsed) .sidebar-close {
        opacity: 1;
        visibility: visible;
    }
    
    .sidebar:not(.collapsed) .menu-section {
        padding: 15px 20px 10px;
        font-size: 12px;
    }
    
    .sidebar:not(.collapsed) .menu-link {
        padding: 15px 20px;
        justify-content: flex-start;
    }
    
    .sidebar:not(.collapsed) .menu-link i {
        margin-right: 10px;
        font-size: 16px;
    }
    
    .sidebar:not(.collapsed) .menu-link span {
        opacity: 1;
        visibility: visible;
        width: auto;
    }
    
    .sidebar:not(.collapsed) .menu-link:hover {
        padding-left: 25px;
    }
    
    #main-content {
        margin-left: 0 !important;
    }
    
    .container-fluid {
        padding: 15px;
    }
    
    .page-header {
        margin-bottom: 20px;
        padding: 10px;
    }
    
    .page-header h3 {
        font-size: 1.3rem;
    }
    
    .navbar {
        padding: 10px 15px;
    }
    
    #sidebar-toggle {
        font-size: 22px;
        padding: 5px 10px;
    }
    
    .card {
        margin-bottom: 15px;
        border-radius: 8px;
    }
    
    .card-body {
        padding: 15px;
    }
    
    .table {
        font-size: 12px;
    }
    
    .table thead th {
        font-size: 11px;
        padding: 8px 5px;
    }
    
    .table tbody td {
        padding: 8px 5px;
    }
    
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin: 0 -15px;
        padding: 0 15px;
    }
    
    .btn {
        font-size: 13px;
        padding: 8px 12px;
    }
    
    .btn-sm {
        padding: 4px 8px;
        font-size: 11px;
    }
    
    .form-label {
        font-size: 13px;
        margin-bottom: 5px;
    }
    
    .form-control, .form-select {
        font-size: 14px;
        padding: 8px 12px;
    }
    
    .modal-dialog {
        margin: 10px;
        max-width: calc(100% - 20px);
    }
    
    .modal-body {
        padding: 15px;
    }
    
    /* Stack form fields on mobile */
    .row > [class*='col-'] {
        margin-bottom: 12px;
    }
    
    /* Make action buttons stack on mobile */
    .btn-group {
        flex-direction: column;
    }
    
    .btn-group .btn {
        border-radius: 4px !important;
        margin-bottom: 5px;
        width: 100%;
    }
    
    /* Dashboard cards */
    .dashboard-card {
        margin-bottom: 15px;
    }
    
    .dashboard-card .card-body {
        padding: 20px;
    }
    
    .dashboard-card h2 {
        font-size: 2rem;
    }
    
    /* Better spacing for mobile forms */
    .mb-3 {
        margin-bottom: 12px !important;
    }
    
    /* Adjust badge sizes */
    .badge {
        font-size: 11px;
        padding: 4px 8px;
    }
    
    /* Fix navbar dropdown */
    .navbar-nav {
        padding: 5px 0;
    }
    
    /* Better button spacing */
    .card-footer .btn,
    .modal-footer .btn {
        margin: 5px 0;
        width: 100%;
    }
}

/* Tablet responsive */
@media (max-width: 992px) and (min-width: 769px) {
    .sidebar {
        width: 220px;
    }
    
    #main-content {
        margin-left: 220px;
    }
    
    .container-fluid {
        padding: 20px;
    }
}

/* Small desktop */
@media (max-width: 1200px) and (min-width: 993px) {
    .container-fluid {
        padding: 25px;
    }
}

/* Utility Classes */
.text-primary-custom {
    color: var(--primary-color);
}

.bg-primary-custom {
    background: var(--primary-color);
}

.border-primary-custom {
    border-color: var(--primary-color);
}

.cursor-pointer {
    cursor: pointer;
}

.shadow-sm-custom {
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

/* Scrollbar Styles */
.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-track {
    background: var(--secondary-color);
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(100, 181, 246, 0.5);
    border-radius: 3px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: var(--accent-color);
}

/* Animation */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.5s ease;
}

/* Custom Confirmation Dialog */
.custom-confirm-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.custom-confirm-overlay.show {
    opacity: 1;
}

.custom-confirm-overlay.show .custom-confirm-dialog {
    transform: scale(1);
    opacity: 1;
}

.custom-confirm-dialog {
    background: linear-gradient(135deg, #FFFFFF 0%, var(--bg-light) 100%);
    border-radius: 15px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
    max-width: 500px;
    width: 90%;
    overflow: hidden;
    transform: scale(0.8);
    opacity: 0;
    transition: all 0.3s ease;
    border: 2px solid var(--accent-color);
}

.custom-confirm-header {
    background: linear-gradient(90deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    padding: 20px 25px;
    display: flex;
    align-items: center;
    gap: 15px;
    border-bottom: 3px solid var(--accent-color);
}

.custom-confirm-icon {
    font-size: 32px;
    opacity: 0.9;
}

.custom-confirm-title {
    margin: 0;
    font-size: 1.3rem;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.custom-confirm-body {
    padding: 30px 25px;
    background: white;
}

.custom-confirm-message {
    margin: 0;
    font-size: 1rem;
    color: var(--dark-text);
    line-height: 1.6;
}

.custom-confirm-footer {
    padding: 20px 25px;
    background: var(--bg-light);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    border-top: 1px solid var(--border-color);
}

.custom-confirm-footer .btn {
    padding: 10px 25px;
    font-weight: 600;
    border-radius: 8px;
    transition: all 0.3s ease;
    border: none;
}

.custom-confirm-footer .btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.custom-confirm-footer .btn-secondary {
    background: #6c757d;
}

.custom-confirm-footer .btn-secondary:hover {
    background: #5a6268;
}

.custom-confirm-footer .btn-danger {
    background: var(--danger-color);
}

.custom-confirm-footer .btn-danger:hover {
    background: #e53935;
}

.custom-confirm-footer .btn-primary {
    background: var(--primary-color);
}

.custom-confirm-footer .btn-primary:hover {
    background: var(--hover-color);
}

.custom-confirm-footer .btn-warning {
    background: var(--warning-color);
    color: white;
}

.custom-confirm-footer .btn-warning:hover {
    background: #fb8c00;
}

@media (max-width: 768px) {
    .custom-confirm-dialog {
        width: 95%;
        max-width: none;
    }
    
    .custom-confirm-header {
        padding: 15px 20px;
    }
    
    .custom-confirm-icon {
        font-size: 24px;
    }
    
    .custom-confirm-title {
        font-size: 1.1rem;
    }
    
    .custom-confirm-body {
        padding: 20px;
    }
    
    .custom-confirm-message {
        font-size: 0.95rem;
    }
    
    .custom-confirm-footer {
        padding: 15px;
        flex-direction: column;
    }
    
    .custom-confirm-footer .btn {
        width: 100%;
        margin: 0;
    }
}

/* Dashboard Cards */
.dashboard-card {
    border-left: 5px solid var(--primary-color);
    transition: all 0.3s ease;
    background: linear-gradient(135deg, #FFFFFF 0%, #FBF8F3 100%);
}

.dashboard-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px var(--card-shadow);
}

.dashboard-card .card-body {
    padding: 25px;
}

.dashboard-card h2 {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary-color);
}

.dashboard-card p {
    color: var(--secondary-color);
    font-weight: 500;
    text-transform: uppercase;
    font-size: 13px;
    letter-spacing: 1px;
}

.dashboard-card.customers {
    border-left-color: var(--info-color);
    background: linear-gradient(135deg, #FFFFFF 0%, #F5EEE6 100%);
}

.dashboard-card.suppliers {
    border-left-color: var(--success-color);
    background: linear-gradient(135deg, #FFFFFF 0%, #EDF4F0 100%);
}

.dashboard-card.items {
    border-left-color: var(--warning-color);
    background: linear-gradient(135deg, #FFFFFF 0%, #FDF6E8 100%);
}

.dashboard-card.orders {
    border-left-color: var(--danger-color);
    background: linear-gradient(135deg, #FFFFFF 0%, #F7EDE8 100%);
}

/* ============================================
   MOBILE RESPONSIVE FIXES FOR ITEM ENTRY GRIDS
   ============================================ */

/* Modal items table - enable horizontal scroll */
.modal .table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 -15px;
    padding: 0 15px;
    scrollbar-width: thin;
    scrollbar-color: var(--accent-color) #f0f0f0;
}

.modal .table-responsive::-webkit-scrollbar {
    height: 8px;
}

.modal .table-responsive::-webkit-scrollbar-track {
    background: #f0f0f0;
    border-radius: 4px;
}

.modal .table-responsive::-webkit-scrollbar-thumb {
    background: var(--accent-color);
    border-radius: 4px;
}

.modal .table-responsive::-webkit-scrollbar-thumb:hover {
    background: var(--primary-color);
}

/* Items table minimum width to prevent squishing */
#invoice-items-table,
#po-items-table,
#bill-items-table,
#challan-items-table,
#debit-note-items-table,
#credit-note-items-table,
#expense-items-table {
    min-width: 700px;
}

/* Mobile responsive for modals and forms */
@media (max-width: 768px) {
    /* Modal full width on mobile */
    .modal-dialog.modal-xl {
        margin: 5px;
        max-width: calc(100% - 10px);
    }
    
    .modal-body {
        padding: 12px;
    }
    
    /* Items entry table - enable scroll with visual indicator */
    .modal .table-responsive {
        margin: 0 -12px;
        padding: 0 12px;
        border: 1px solid var(--border-color);
        border-radius: 8px;
        background: linear-gradient(90deg, rgba(100, 181, 246, 0.1) 0%, transparent 20%, transparent 80%, rgba(100, 181, 246, 0.1) 100%);
    }
    
    /* Scroll hint indicator */
    .modal .table-responsive::after {
        content: '← Scroll →';
        display: block;
        text-align: center;
        font-size: 10px;
        color: var(--primary-color);
        padding: 5px;
        opacity: 0.7;
    }
    
    /* Make table cells more compact on mobile */
    #invoice-items-table td,
    #invoice-items-table th,
    #po-items-table td,
    #po-items-table th,
    #bill-items-table td,
    #bill-items-table th,
    #challan-items-table td,
    #challan-items-table th,
    #debit-note-items-table td,
    #debit-note-items-table th,
    #credit-note-items-table td,
    #credit-note-items-table th {
        padding: 6px 4px;
        font-size: 12px;
    }
    
    /* Input fields in table cells */
    #invoice-items-body input,
    #invoice-items-body select,
    #po-items-body input,
    #po-items-body select,
    #bill-items-body input,
    #bill-items-body select,
    #challan-items-body input,
    #challan-items-body select,
    #debit-note-items-body input,
    #debit-note-items-body select,
    #credit-note-items-body input,
    #credit-note-items-body select {
        font-size: 12px;
        padding: 6px 8px;
        min-width: 70px;
    }
    
    /* Item select dropdown needs more width */
    #invoice-items-body select[name="item_id"],
    #po-items-body select[name="item_id"],
    #bill-items-body select[name="item_id"],
    #challan-items-body select[name="item_id"],
    #debit-note-items-body select[name="item_id"],
    #credit-note-items-body select[name="item_id"] {
        min-width: 150px;
    }
    
    /* Filter section on mobile */
    .card-body .row > .col-md-2,
    .card-body .row > .col-md-3,
    .card-body .row > .col-md-4 {
        margin-bottom: 10px;
    }
    
    /* Filter buttons - full width and stacked */
    .card-body .row .col-md-3:last-child,
    .card-body .row .col-md-4:last-child {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .card-body .row .col-md-3:last-child .btn,
    .card-body .row .col-md-4:last-child .btn {
        flex: 1;
        min-width: 100px;
    }
    
    /* Page header mobile */
    .page-header {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 10px;
    }
    
    .page-header h3 {
        font-size: 1.2rem;
    }
    
    .page-header .btn {
        width: 100%;
    }
    
    /* Summary table in modals */
    .modal .table-sm {
        font-size: 12px;
    }
    
    .modal .table-sm td {
        padding: 4px 8px;
    }
    
    /* Form row spacing in modals */
    .modal .row > [class*='col-md-'] {
        margin-bottom: 10px;
    }
    
    /* Remarks textarea */
    .modal #remarks,
    .modal #notes,
    .modal #reason {
        font-size: 13px;
    }
    
    /* Add item button */
    .modal .btn-success.btn-sm,
    .modal .btn-outline-primary.btn-sm {
        width: 100%;
        margin-bottom: 15px;
    }
    
    /* Modal footer buttons */
    .modal-footer {
        flex-direction: column;
        gap: 8px;
    }
    
    .modal-footer .btn {
        width: 100%;
        margin: 0;
    }
    
    /* Alert in modal */
    .modal .alert {
        font-size: 12px;
        padding: 10px;
    }
    
    .modal .alert small {
        font-size: 11px;
    }
    
    /* List table (main data tables) */
    #invoice-table-container .table,
    #po-table-container .table,
    #bill-table-container .table,
    #challan-table-container .table,
    #debit-note-table-container .table,
    #credit-note-table-container .table,
    #expense-table-container .table {
        min-width: 600px;
    }
    
    /* Action buttons in data tables */
    .btn-group-sm {
        display: flex;
        flex-wrap: nowrap;
        gap: 2px;
    }
    
    .btn-group-sm .btn {
        padding: 4px 6px;
        font-size: 11px;
    }
}

/* Extra small devices */
@media (max-width: 480px) {
    .modal-dialog.modal-xl {
        margin: 2px;
        max-width: calc(100% - 4px);
    }
    
    .modal-body {
        padding: 10px;
    }
    
    .modal-header {
        padding: 10px 15px;
    }
    
    .modal-title {
        font-size: 1rem;
    }
    
    /* Even more compact table on very small screens */
    #invoice-items-table,
    #po-items-table,
    #bill-items-table,
    #challan-items-table,
    #debit-note-items-table,
    #credit-note-items-table {
        min-width: 600px;
    }
    
    /* Smaller inputs */
    #invoice-items-body input,
    #invoice-items-body select,
    #po-items-body input,
    #po-items-body select,
    #bill-items-body input,
    #bill-items-body select,
    #challan-items-body input,
    #challan-items-body select,
    #debit-note-items-body input,
    #debit-note-items-body select,
    #credit-note-items-body input,
    #credit-note-items-body select {
        font-size: 11px;
        padding: 5px 6px;
    }
    
    /* Form labels */
    .form-label {
        font-size: 12px;
    }
    
    /* Section headers */
    .modal h6 {
        font-size: 14px;
    }
}

/* ============================================
   CHATBOT STYLES
   ============================================ */

/* Floating Chat Button */
.chatbot-toggle {
    position: fixed;
    bottom: 25px;
    right: 25px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #004d99 0%, #0066cc 100%);
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 77, 153, 0.4);
    z-index: 9998;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chatbot-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0, 77, 153, 0.5);
}

.chatbot-toggle.active {
    background: linear-gradient(135deg, #003366 0%, #004d99 100%);
}

.chatbot-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    width: 22px;
    height: 22px;
    background-color: #ef5350;
    border-radius: 50%;
    font-size: 12px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid white;
}

/* Chat Panel */
.chatbot-panel {
    position: fixed;
    bottom: 100px;
    right: 25px;
    width: 380px;
    height: 520px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.95);
    transition: all 0.3s ease;
}

.chatbot-panel.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* Chat Header */
.chatbot-header {
    background: linear-gradient(135deg, #004d99 0%, #0066cc 100%);
    color: white;
    padding: 15px 20px;
    border-radius: 16px 16px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chatbot-header-info {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    font-size: 16px;
}

.chatbot-header-info i {
    font-size: 20px;
}

.chatbot-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.chatbot-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Messages Area */
.chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    background: #f8f9fa;
}

.chat-message {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #004d99 0%, #0066cc 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 14px;
    flex-shrink: 0;
}

.message-content {
    max-width: 80%;
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 13px;
    line-height: 1.5;
}

.bot-message .message-content {
    background: white;
    color: #333;
    border: 1px solid #e9ecef;
    border-radius: 12px 12px 12px 0;
}

.user-message {
    flex-direction: row-reverse;
}

.user-message .message-content {
    background: linear-gradient(135deg, #004d99 0%, #0066cc 100%);
    color: white;
    border-radius: 12px 12px 0 12px;
    max-width: 80%;
}

/* Typing Indicator */
.typing-dots {
    display: flex;
    gap: 4px;
    padding: 5px 0;
}

.typing-dots span {
    width: 8px;
    height: 8px;
    background: #adb5bd;
    border-radius: 50%;
    animation: typingBounce 1.4s infinite ease-in-out;
}

.typing-dots span:nth-child(1) { animation-delay: 0s; }
.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingBounce {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.5; }
    40% { transform: scale(1); opacity: 1; }
}

/* Quick Actions */
.chatbot-quick-actions {
    padding: 10px 15px;
    background: white;
    border-top: 1px solid #e9ecef;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.quick-action {
    background: #e3f2fd;
    border: 1px solid #bbdefb;
    color: #004d99;
    padding: 5px 10px;
    border-radius: 15px;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.quick-action:hover {
    background: #004d99;
    color: white;
    border-color: #004d99;
}

/* Input Area */
.chatbot-input-area {
    display: flex;
    padding: 15px;
    background: white;
    border-top: 1px solid #e9ecef;
    border-radius: 0 0 16px 16px;
    gap: 10px;
}

#chatbot-input {
    flex: 1;
    border: 1px solid #dee2e6;
    border-radius: 20px;
    padding: 10px 15px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

#chatbot-input:focus {
    border-color: #004d99;
}

#chatbot-input::placeholder {
    color: #adb5bd;
}

#chatbot-send {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #004d99 0%, #0066cc 100%);
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
}

#chatbot-send:hover {
    transform: scale(1.05);
}

#chatbot-send:active {
    transform: scale(0.95);
}

/* Mobile Responsive Chatbot */
@media (max-width: 480px) {
    .chatbot-toggle {
        bottom: 15px;
        right: 15px;
        width: 50px;
        height: 50px;
        font-size: 20px;
    }
    
    .chatbot-panel {
        bottom: 0;
        right: 0;
        left: 0;
        width: 100%;
        height: 100%;
        border-radius: 0;
        max-height: 100vh;
    }
    
    .chatbot-header {
        border-radius: 0;
    }
    
    .chatbot-input-area {
        border-radius: 0;
        padding: 10px;
    }
    
    .chatbot-quick-actions {
        padding: 8px 10px;
    }
    
    .quick-action {
        font-size: 10px;
        padding: 4px 8px;
    }
}

/* Scrollbar Styling for Chat */
.chatbot-messages::-webkit-scrollbar {
    width: 6px;
}

.chatbot-messages::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.chatbot-messages::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.chatbot-messages::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}
