:root {
    --primary-color: #000000;
    --secondary-color: #f8f9fa;
    --text-color: #212529;
    --text-muted: #6c757d;
    --success-color: #28a745;
    --warning-color: #ffc107;
    --danger-color: #dc3545;
    --light-gray: #f8f9fa;
    --white: #ffffff;
    --border-color: #e9ecef;
}

body {
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: var(--white);
    color: var(--text-color);
}

/* Mobile Toggle Button */
.mobile-toggle {
    display: none;
    position: fixed;
    top: 1rem;
    left: 1rem;
    z-index: 1050;
}

.navbar-toggler {
    background-color: var(--white);
    border: 1px solid var(--border-color);
    padding: 0.5rem;
    border-radius: 0.25rem;
    cursor: pointer;
}

/* Sidebar Styling */
.sidebar {
    background-color: var(--white);
    min-height: 100vh;
    width: 250px;
    border-right: 1px solid var(--border-color);
    position: fixed;
    left: 0;
    top: 0;
    z-index: 1040;
    transition: transform 0.3s ease;
}

.sidebar .brand {
    font-weight: 600;
    font-size: 1.25rem;
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

/* Logo styling */
.logo-container {
    display: flex;
    align-items: center;
    position: relative;
}

.logo-icon {
    color: #333333;
    font-size: 1.5rem;
    margin-right: 0.75rem;
}

/* Menu dots styling */
.menu-dots {
    position: absolute;
    right: 0;
    cursor: pointer;
    padding: 5px;
    color: var(--text-muted);
    transition: all 0.2s;
}

.menu-dots:hover {
    color: var(--text-color);
}

.menu-dots .dropdown-menu {
    position: absolute;
    right: 0;
    top: 100%;
    background: var(--white);
    border: 1px solid var(--border-color);
    border-radius: 0.25rem;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    padding: 0.5rem 0;
    min-width: 10rem;
    display: none;
    z-index: 1050;
}

.menu-dots.active .dropdown-menu {
    display: block;
}

.dropdown-item {
    display: flex;
    align-items: center;
    padding: 0.5rem 1rem;
    color: var(--text-color);
    text-decoration: none;
    transition: background-color 0.2s;
}

.dropdown-item:hover {
    background-color: #f0f7ff;
}

.dropdown-item i {
    margin-right: 0.5rem;
    width: 20px;
    text-align: center;
}

.sidebar .nav-link {
    color: var(--text-color) !important;
    padding: 0.75rem 1.5rem;
    display: flex;
    align-items: center;
    transition: all 0.3s;
}

.sidebar .nav-link:hover,
.sidebar .nav-link.active {
    background-color: #f8f9fa;
    color: #333333 !important;
}

.sidebar .nav-link i,
.sidebar .nav-link svg {
    margin-right: 0.75rem;
    width: 20px;
    text-align: center;
}

/* Nav Section Styling */
.nav-section {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.nav-section-title {
    display: block;
    padding: 0.5rem 1.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.5rem;
}

/* Main Content */
.main-content {
    margin-left: 120px;
    padding: 2rem;
    background-color: var(--white);
    flex: 1;
    width: calc(100% - 250px);
}

.page-header {
    margin-bottom: 2rem;
}

.page-header h1 {
    font-size: 1.75rem;
    font-weight: 500;
    margin-left: 0;
    color: var(--text-color);
}

.page-header p {
    color: var(--text-muted);
    margin: 0.25rem 0 0;
}

/* Dashboard Cards */
.stats-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.dashboard-card {
    background: var(--white);
    border-radius: 0.5rem;
    padding: 1.25rem;
    border: 1px solid var(--border-color);
}

/* Dashboard card links */
.stat-link {
    text-decoration: none;
    color: var(--text-color);
    transition: all 0.3s ease;
}

.stat-link:hover {
    transform: translateY(-5px);
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    color: var(--text-color);
    border-color: #333333;
}

.dashboard-card h5 {
    color: var(--text-color);
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.75rem;
}

.dashboard-card .value {
    font-size: 2rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
    color: var(--text-color);
}

.dashboard-card .subtitle {
    color: var(--success-color);
    font-size: 0.875rem;
}

.dashboard-card .subtitle.red {
    color: var(--danger-color);
}

/* Quick Actions */
.quick-actions {
    margin-top: 2rem;
}

.quick-actions h2 {
    font-size: 1.25rem;
    font-weight: 500;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
}

.quick-actions h2 i {
    margin-right: 0.5rem;
}

.action-btn {
    display: flex;
    align-items: center;
    padding: 0.75rem;
    background: var(--white);
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    color: var(--text-color);
    text-decoration: none;
    margin-bottom: 0.5rem;
    transition: all 0.2s;
}

.action-btn:hover {
    background-color: #f8f9fa;
}

.action-btn i {
    margin-right: 0.75rem;
    width: 20px;
    text-align: center;
}

/* Recent Invoices */
.recent-invoices {
    margin-top: 2rem;
}

.recent-invoices h2 {
    font-size: 1.25rem;
    font-weight: 500;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
}

.recent-invoices h2 i {
    margin-right: 0.5rem;
}

.table {
    margin: 0;
}

.table th {
    font-weight: 500;
    color: var(--text-muted);
    border-bottom-width: 1px;
    padding: 0.75rem;
}

.table td {
    padding: 0.75rem;
    vertical-align: middle;
}

.badge {
    padding: 0.35rem 0.65rem;
    font-weight: 500;
    font-size: 0.75rem;
    border-radius: 1rem;
}

.badge.paid {
    background-color: rgba(40, 167, 69, 0.1);
    color: var(--success-color);
}

.badge.pending {
    background-color: rgba(255, 193, 7, 0.1);
    color: #997404;
}

.badge.overdue {
    background-color: rgba(220, 53, 69, 0.1);
    color: var(--danger-color);
}

/* Top Button */
.btn-new-invoice {
    padding: 0.5rem 1rem;
    background: var(--primary-color);
    color: var(--white);
    border: none;
    border-radius: 0.375rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    transition: all 0.2s;
}

.btn-new-invoice:hover {
    background: #333;
    color: var(--white);
}

/* Logout Button */
.logout-btn {
    position: fixed;
    bottom: 1rem;
    left: 1rem;
    width: calc(250px - 2rem);
    color: var(--text-color) !important;
}

/* Customer search bar */
#customerSearch {
    width: 250px;
    transition: width 0.3s ease;
}

.search-container {
    width: 100%;
    max-width: 250px;
}

/* Responsive Styles */
@media (max-width: 992px) {
    .stats-row {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
}

@media (max-width: 768px) {
    .mobile-toggle {
        display: block;
    }
    
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.show {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
        width: 100%;
        padding: 1rem;
        padding-top: 3rem; /* Add space for the toggle button */
        height: auto;
    }
    
    .page-header h1 {
        font-size: 1.5rem;
    }
    
    .stats-row {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
    
    .dashboard-card {
        padding: 1rem;
        margin-bottom: 1rem;
    }
    
    .dashboard-card .value {
        font-size: 1.5rem;
    }
    
    #customerSearch {
        width: 100%;
    }
    
    .search-container {
        width: 100%;
        max-width: 100%;
    }
    
    .dashboard-card .d-flex {
        flex-direction: column;
    }
    
    /* Ensure tables are scrollable */
    .table-responsive {
        max-height: 60vh;
        overflow-y: auto;
        margin-bottom: 20px;
        -webkit-overflow-scrolling: touch;
    }
    
    /* Improve button display */
    .mobile-actions {
        margin: 0;
    }
    
    /* Improve button group layout on mobile */
    .btn-group {
        display: flex;
        flex-wrap: wrap;
        gap: 5px;
    }
}

@media (max-width: 576px) {
    .stats-row {
        grid-template-columns: 1fr;
    }
    
    .main-content {
        padding: 0.75rem 0.5rem;
    }
    
    .dashboard-card {
        padding: 0.75rem;
    }
    
    .btn-group-sm>.btn {
        padding: 0.25rem 0.5rem;
        font-size: 0.75rem;
    }
    
    .table td, .table th {
        padding: 0.5rem;
        font-size: 0.85rem;
    }
    
    /* Full width form elements */
    .form-control, .btn {
        width: 100%;
    }
    
    /* Card body padding reduction */
    .card-body {
        padding: 0.75rem;
    }
    
    /* Improve filter form layout */
    .filter-form {
        padding: 0.75rem;
        margin-bottom: 0.75rem;
    }
    
    /* Improve action buttons in view pages */
    .card-header .btn-group {
        margin-top: 0.5rem;
        width: 100%;
    }
    
    .card-header {
        flex-direction: column;
        align-items: flex-start !important;
    }
    
    .card-header .btn-group {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        width: 100%;
        gap: 5px;
    }
    
    .card-header .btn-group .btn {
        margin: 0;
        text-align: center;
        padding: 0.375rem 0.5rem;
    }
    
    /* Improve alert spacing */
    .alert {
        padding: 0.75rem;
        margin-bottom: 0.75rem;
    }
}

/* Specific mobile improvements for invoice/watak view */
@media (max-width: 480px) {
    /* Optimize table display */
    .table-responsive {
        margin: 0 -0.75rem;
        width: calc(100% + 1.5rem);
    }
    
    .table-responsive table {
        width: 100%;
    }
    
    .table-responsive th,
    .table-responsive td {
        white-space: nowrap;
    }
    
    /* Make buttons more touch-friendly */
    .btn {
        padding: 0.5rem;
        margin-bottom: 0.25rem;
    }
    
    /* Fix spacing in view pages */
    .card-body .row {
        margin: 0 -5px;
    }
    
    .card-body .col-md-6 {
        padding: 0 5px;
    }
    
    /* Make search bar full width */
    input[type="text"], input[type="date"] {
        width: 100%;
    }
}

.d-flex {
  display: flex !important;
  width: 100%;
}

.wrapper {
  display: flex;
  width: 100%;
  min-height: 100vh;
}

/* Invoice Filter Styles */
.filter-form {
    background-color: #f8f9fa;
    border-radius: 0.25rem;
    padding: 1rem;
    margin-bottom: 1rem;
    border: 1px solid #e9ecef;
}

.filter-form label {
    font-weight: 500;
    font-size: 0.875rem;
    color: #495057;
}

.filter-form .btn {
    margin-right: 0.5rem;
    height: 38px; /* Match input height */
}

.filter-form .form-control {
    height: 38px;
}

.filter-form .d-flex {
    gap: 0.5rem;
}

/* Action buttons in view pages */
.action-buttons {
    display: flex;
    gap: 5px;
}

.action-buttons .btn {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
}

/* Improved mobile view for action buttons */
@media (max-width: 576px) {
    .action-buttons {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        width: 100%;
    }
    
    .action-buttons .btn {
        margin: 0;
        border-radius: 4px;
    }
    
    /* Back button styling */
    .action-buttons .btn-secondary {
        background-color: #6c757d;
    }
    
    /* Edit button styling */
    .action-buttons .btn-primary {
        background-color: #007bff;
    }
    
    /* Print button styling */
    .action-buttons .btn-info {
        background-color: #17a2b8;
    }
} 

/* Make sure the customer/vendor table is fully visible on mobile */
@media (max-width: 768px) {
    .main-content {
        padding: 1rem 0.75rem;
        margin-left: 0;
        width: 100%;
        height: auto;
        min-height: 100vh;
    }

    .table-responsive {
        max-height: 60vh; /* Set a reasonable height for mobile */
        overflow-y: auto;
        margin-bottom: 20px;
        border-bottom: 1px solid #e9ecef;
    }

    .dashboard-card {
        margin-bottom: 15px;
    }
    
    /* Fix button group display in tables */
    .btn-group {
        flex-wrap: wrap;
    }
    
    .btn-group .btn {
        margin: 2px;
    }
} 

/* Mobile optimized action buttons */
.mobile-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 3px;
}

@media (max-width: 576px) {
    .mobile-actions {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        width: 100%;
        gap: 4px;
    }
    
    .mobile-actions .btn {
        padding: 0.375rem;
        font-size: 0.8rem;
        width: 100%;
    }
} 

/* Table adjustments for better mobile display */
.actions-column {
    min-width: 200px;
}

@media (max-width: 576px) {
    .table {
        font-size: 0.85rem;
    }
    
    .table td, .table th {
        padding: 0.5rem 0.25rem;
    }
    
    /* Make sure the actions column is wide enough */
    .actions-column {
        width: 130px;
        min-width: 130px;
    }
    
    /* Ensure the table is scrollable horizontally */
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
} 

/* Ensure weight column is always visible */
.table th:nth-child(3),
.table td:nth-child(3) {
    display: table-cell !important;
}

/* Mobile Responsiveness for Invoice and Watak Forms */
@media (max-width: 767px) {
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        width: 100%;
        display: block;
    }
    
    .table-responsive table {
        min-width: 100%;
        width: max-content !important;
    }
    
    .form-control-sm, .form-select-sm {
        padding: 0.25rem 0.5rem;
        font-size: 0.75rem;
    }
    
    .input-group-sm > .form-control,
    .input-group-sm > .input-group-text {
        padding: 0.25rem 0.5rem;
        font-size: 0.75rem;
    }
    
    /* Force horizontal scrolling for invoice table */
    #invoice_items_table {
        min-width: 650px;
        width: auto !important;
        table-layout: fixed;
    }
    
    /* Ensure columns have proper widths */
    #invoice_items_table th:nth-child(1) { width: 25%; }
    #invoice_items_table th:nth-child(2) { width: 15%; }
    #invoice_items_table th:nth-child(3) { width: 15%; display: table-cell !important; }
    #invoice_items_table td:nth-child(3) { display: table-cell !important; }
    #invoice_items_table th:nth-child(4) { width: 15%; }
    #invoice_items_table th:nth-child(5) { width: 15%; }
    #invoice_items_table th:nth-child(6) { width: 15%; }
} 

/* Fix for invoice modal */
#invoiceModal .table-responsive {
    overflow-x: auto !important;
    max-width: 100%;
}

#invoiceModal #invoice_items_table {
    min-width: 650px;
}

#invoiceModal #invoice_items_table th,
#invoiceModal #invoice_items_table td {
    display: table-cell !important;
    white-space: nowrap;
} 

#invoiceModal #invoice_items_table th:nth-child(3),
#invoiceModal #invoice_items_table td:nth-child(3) {
    display: table-cell !important;
    visibility: visible !important;
    min-width: 80px;
}

/* Ensure weight column is always visible */ 

/* PWA Standalone Mode Styles */
@media all and (display-mode: standalone) {
    body {
        /* Remove any browser UI elements */
        -webkit-user-select: none;
        -webkit-touch-callout: none;
        -webkit-tap-highlight-color: transparent;
    }
    
    /* Ensure proper viewport in standalone mode */
    .main-content {
        padding-top: env(safe-area-inset-top);
        padding-bottom: env(safe-area-inset-bottom);
        padding-left: env(safe-area-inset-left);
        padding-right: env(safe-area-inset-right);
    }
    
    /* Hide any browser-specific elements */
    .mobile-toggle {
        top: calc(1rem + env(safe-area-inset-top));
    }
}

/* iOS Safari specific styles for standalone mode */
@supports (-webkit-touch-callout: none) {
    .standalone .main-content {
        padding-top: 20px;
    }
}

/* Android Chrome specific styles */
@media screen and (display-mode: standalone) {
    body {
        background-color: #667eea;
    }
} 