/* Professional Mobile-Only Application Styles */
/* Corporate, clean, and polished design */

/* Hide desktop sidebar completely */
#sidebar {
    display: none !important;
}

/* Show back to top button above bottom nav. The nav is ~74px tall including its
   own safe-area padding, so this clears it with a visible gap rather than
   sitting flush against it. */
.back-to-top {
    display: flex !important;
    bottom: calc(92px + env(safe-area-inset-bottom)) !important;
    right: 15px !important;
    border-radius: 50% !important;
}

/* Remove body padding for full-width layout */
body {
    padding: 0 !important;
}

/* Make main content full width always - no horizontal padding */
#main {
    margin-top: 0 !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    padding: 0 0 calc(60px + env(safe-area-inset-bottom)) 0 !important;
    background: #f8f9fa;
}

/* Hide desktop header completely on mobile */
.header {
    display: none !important;
}

/* Page Title with Clean Design - Full Width */
.pagetitle {
    background: #ffffff;
    margin: 0 0 5px 0 !important;
    padding: 15px 15px !important;
    border-radius: 0;
    border-bottom: 1px solid #dee2e6;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.pagetitle h1 {
    color: #2c3e50 !important;
    font-size: 22px;
    font-weight: 700;
    margin: 0;
    text-shadow: none;
    text-transform: uppercase;
}

.pagetitle h1 i {
    margin-right: 8px;
    color: #0d6efd;
    font-size: 24px;
    vertical-align: middle;
}

/* Hide breadcrumbs on mobile */
.pagetitle nav {
    display: none !important;
}

/* Add top margin to first card after button */
.section .card {
    margin-top: 0;
}

/* Professional Bottom Navigation with Colorful Icons */
.mobile-bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #ffffff;
    border-top: 1px solid #e9ecef;
    z-index: 1000;
    padding: 4px 0 calc(4px + env(safe-area-inset-bottom));
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.08);
}

.mobile-bottom-nav .nav-item {
    flex: 1;
    text-align: center;
}

.mobile-bottom-nav .nav-link {
    display: flex;
    flex: 1 1 0;
    flex-direction: column;
    align-items: center;
    padding: 4px 2px;
    font-size: 13px;
    font-weight: 600;
    color: #6c757d;
    text-decoration: none;
    transition: all 0.3s ease;
    position: relative;
}

.mobile-bottom-nav .nav-link i {
    font-size: 20px;
    margin-bottom: 2px;
    transition: all 0.3s ease;
}

/* Colorful icons for each nav item */
.mobile-bottom-nav .nav-link:nth-child(1) i {
    color: #3498db;
    /* Blue for Home */
}

.mobile-bottom-nav .nav-link:nth-child(2) i {
    color: #27ae60;
    /* Green for Invoices */
}

.mobile-bottom-nav .nav-link:nth-child(3) i {
    color: #f39c12;
    /* Orange for Stock */
}

.mobile-bottom-nav .nav-link:nth-child(4) i {
    color: #9b59b6;
    /* Purple for Contacts */
}

.mobile-bottom-nav .nav-link:nth-child(5) i {
    color: #e74c3c;
    /* Red for More */
}

/* Active state: icon sits inside a solid colored bubble */
.mobile-bottom-nav .nav-link.active i {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    color: #fff !important;
    font-size: 15px;
    margin-bottom: 1px;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.2);
}

.mobile-bottom-nav .nav-link.active span {
    font-weight: 700;
}

.mobile-bottom-nav .nav-link.active:nth-child(1) i {
    background: #3498db;
}

.mobile-bottom-nav .nav-link.active:nth-child(1) span {
    color: #2980b9;
}

.mobile-bottom-nav .nav-link.active:nth-child(2) i {
    background: #27ae60;
}

.mobile-bottom-nav .nav-link.active:nth-child(2) span {
    color: #229954;
}

.mobile-bottom-nav .nav-link.active:nth-child(3) i {
    background: #f39c12;
}

.mobile-bottom-nav .nav-link.active:nth-child(3) span {
    color: #d68910;
}

.mobile-bottom-nav .nav-link.active:nth-child(4) i {
    background: #9b59b6;
}

.mobile-bottom-nav .nav-link.active:nth-child(4) span {
    color: #7d3c98;
}

.mobile-bottom-nav .nav-link.active:nth-child(5) i {
    background: #e74c3c;
}

.mobile-bottom-nav .nav-link.active:nth-child(5) span {
    color: #c0392b;
}

/* Hide desktop tables, show mobile lists */

.mobile-list {
    display: block !important;
}

/* Professional Card Styles */
.mobile-card {
    background: #fff;
    border-radius: 8px;
    padding: 10px 12px;
    margin-bottom: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    border: 1px solid #e9ecef;
}

/* Touch-friendly buttons with professional styling */
.btn {
    min-height: 38px;
    padding: 8px 16px;
    font-weight: 500;
    border-radius: 6px;
}

.btn-sm {
    min-height: 32px;
    padding: 6px 12px;
    font-size: 14px;
}

.btn-primary {
    background: #3498db;
    border-color: #3498db;
}

.btn-primary:hover {
    background: #2980b9;
    border-color: #2980b9;
}

/* Larger form controls for mobile */
.form-control,
.form-select {
    min-height: 38px;
    font-size: 16px;
    border-radius: 6px;
    border: 1px solid #dee2e6;
    padding: 6px 12px;
}

.form-control:focus,
.form-select:focus {
    border-color: #3498db;
    box-shadow: 0 0 0 0.2rem rgba(52, 152, 219, 0.15);
}

/* Colorful Dashboard Cards with Gradients */
.info-card {
    margin-bottom: 16px;
    background: #fff;
    border: none;
    border-radius: 16px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    overflow: hidden;
}

.info-card:hover {
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
    transform: translateY(-4px);
}

/* Colorful gradient backgrounds for each card */
.info-card.users-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.info-card.customers-card {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.info-card.suppliers-card {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

.info-card.bank-card {
    background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
}

.info-card.stocks-card {
    background: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
}

.info-card.expenses-card {
    background: linear-gradient(135deg, #30cfd0 0%, #330867 100%);
}

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

.info-card .card-icon {
    width: 64px;
    height: 64px;
    font-size: 32px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.25) !important;
    backdrop-filter: blur(10px);
    color: #fff !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.info-card .card-title {
    color: rgba(255, 255, 255, 0.9) !important;
    font-weight: 600;
    font-size: 15px;
    margin-top: 12px;
}

.info-card h6 {
    color: #fff !important;
    font-weight: 700;
    font-size: 28px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.breadcrumb {
    font-size: 13px;
    background: transparent;
    padding: 0;
    margin: 0;
}

.breadcrumb-item {
    color: #6c757d;
}

.breadcrumb-item.active {
    color: #2c3e50;
}

/* Professional Mobile list item */
.mobile-list-item {
    background: #ffffff;
    border-radius: 12px;
    padding: 10px 12px;
    margin-bottom: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
}

.mobile-list-item:active {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.mobile-list-item-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 8px;
}

.mobile-list-item-title {
    font-weight: 600;
    font-size: 17px;
    color: #2c3e50;
    margin-bottom: 4px;
}

.mobile-list-item-subtitle {
    font-size: 15px;
    color: #6c757d;
}

.mobile-list-item-amount {
    font-size: 19px;
    font-weight: 700;
    color: #2c3e50;
}

.mobile-list-item-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #f0f0f0;
}

.mobile-list-item-actions {
    display: flex;
    gap: 12px;
}

/* Inline row action buttons — the alternative to the "..." dropdown for pages that show
   their actions directly on the row. One icon button per action, colour-coded by intent. */
.list-action-btns {
    display: flex;
    align-items: center;
    gap: 8px;
}

.list-action-btn,
.list-action-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    background: #fff;
    color: #64748b;
    line-height: 1;
    text-decoration: none;
    transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}

.list-action-btn {
    width: 32px;
    height: 32px;
    padding: 0;
    font-size: 0.95rem;
}

/* Labelled counterpart to .list-action-btn, for the primary actions that head a
   detail page. Same outlined look and colour names; keeps its icon and text. */
.list-action-pill {
    flex: 1 1 0;
    gap: 6px;
    padding: 10px 12px;
    font-size: 0.9rem;
    font-weight: 600;
    white-space: nowrap;
}

.list-action-btn:focus,
.list-action-btn:active,
.list-action-pill:focus,
.list-action-pill:active {
    box-shadow: none !important;
}

.list-action-btn.is-ledger,
.list-action-btn.is-view,
.list-action-pill.is-ledger,
.list-action-pill.is-view {
    color: #3498db;
}

.list-action-btn.is-ledger:hover,
.list-action-btn.is-view:hover,
.list-action-pill.is-ledger:hover,
.list-action-pill.is-view:hover {
    background: #eff6ff;
    border-color: #bfdbfe;
    color: #2563eb;
}

.list-action-btn.is-add,
.list-action-btn.is-got,
.list-action-pill.is-add,
.list-action-pill.is-got {
    color: #27ae60;
}

.list-action-btn.is-add:hover,
.list-action-btn.is-got:hover,
.list-action-pill.is-add:hover,
.list-action-pill.is-got:hover {
    background: #ecfdf5;
    border-color: #a7f3d0;
    color: #059669;
}

.list-action-btn.is-download,
.list-action-btn.is-print,
.list-action-pill.is-download,
.list-action-pill.is-print {
    color: #6366f1;
}

.list-action-btn.is-download:hover,
.list-action-btn.is-print:hover,
.list-action-pill.is-download:hover,
.list-action-pill.is-print:hover {
    background: #eef2ff;
    border-color: #c7d2fe;
    color: #4f46e5;
}

.list-action-btn.is-edit,
.list-action-pill.is-edit {
    color: #f59e0b;
}

.list-action-btn.is-edit:hover,
.list-action-pill.is-edit:hover {
    background: #fffbeb;
    border-color: #fde68a;
    color: #d97706;
}

.list-action-btn.is-key,
.list-action-pill.is-key {
    color: #0d9488;
}

.list-action-btn.is-key:hover,
.list-action-pill.is-key:hover {
    background: #f0fdfa;
    border-color: #99f6e4;
    color: #0f766e;
}

.list-action-btn.is-suspend,
.list-action-pill.is-suspend {
    color: #f97316;
}

.list-action-btn.is-suspend:hover,
.list-action-pill.is-suspend:hover {
    background: #fff7ed;
    border-color: #fed7aa;
    color: #ea580c;
}

.list-action-btn.is-delete,
.list-action-btn.is-gave,
.list-action-pill.is-delete,
.list-action-pill.is-gave {
    color: #e74c3c;
}

.list-action-btn.is-delete:hover,
.list-action-btn.is-gave:hover,
.list-action-pill.is-delete:hover,
.list-action-pill.is-gave:hover {
    background: #fef2f2;
    border-color: #fecaca;
    color: #dc2626;
}

/* The block at the top of a ledger page — who the ledger belongs to, their details
   and the entry/export actions. Tinted and outlined so it reads as its own section
   rather than running straight into the ledger list below it. */
.ledger-header-panel {
    background: #f8fafc;
    border: 1px solid #e9eef5;
    border-radius: 12px;
    padding: 14px;
    margin-bottom: 16px;
}

.ledger-header-panel > :last-child {
    margin-bottom: 0 !important;
}

/* Disclosure toggle that sits at the end of a title row, paired with a Bootstrap
   collapse. Bootstrap keeps aria-expanded in step with the panel, so the chevron
   can animate straight off it. Built on .list-action-btn for the same look. */
.info-toggle-btn {
    margin-left: auto;
    flex-shrink: 0;
}

.info-toggle-btn i {
    transition: transform .25s ease;
}

.info-toggle-btn[aria-expanded="true"] i {
    transform: rotate(180deg);
}

/* Row actions "..." dropdown — used on list/table rows across list pages instead of a
   row of separate buttons. Shared globally so every page gets the same look/behavior. */
.row-actions-toggle {
    border: 1px solid #e2e8f0;
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border-radius: 8px;
    background: #fff;
}

.row-actions-toggle:focus,
.row-actions-toggle:active {
    box-shadow: none !important;
}

.row-actions .dropdown-menu {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    border: none;
    border-radius: 10px;
    padding: 6px;
    min-width: 190px;
    /* Above the fixed bottom nav (z-index 1000) and the back-to-top button (z-index 99999). */
    z-index: 100000;
}

.row-actions .dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.9rem;
}

.row-actions .dropdown-item:hover {
    background: #f1f5f9;
}

.row-actions .dropdown-item.text-danger:hover {
    background: #fef2f2;
}

/* Professional color for amounts */
.text-success {
    color: #27ae60 !important;
}

.text-danger {
    color: #e74c3c !important;
}

.text-primary {
    color: #3498db !important;
}

/* Floating Action Button - professional style */
.mobile-fab {
    position: fixed;
    bottom: calc(65px + env(safe-area-inset-bottom));
    right: 16px;
    width: 56px;
    height: 56px;
    background: #3498db;
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.3);
    font-size: 24px;
    z-index: 999;
    text-decoration: none;
    transition: all 0.2s ease;
}

.mobile-fab:hover,
.mobile-fab:focus {
    color: #fff;
    background: #2980b9;
    box-shadow: 0 6px 16px rgba(52, 152, 219, 0.4);
}

.mobile-fab:active {
    transform: scale(0.95);
}

/* Safe area support for notched devices */
@supports (padding: env(safe-area-inset-bottom)) {
    .mobile-bottom-nav {
        padding-bottom: calc(6px + env(safe-area-inset-bottom));
    }
}

/* Smooth transitions */
* {
    -webkit-tap-highlight-color: rgba(52, 152, 219, 0.1);
}

/* Professional badge styles */
.badge {
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 14px;
}

.badge.bg-primary {
    background-color: #3498db !important;
}

.badge.bg-success {
    background-color: #27ae60 !important;
}

.badge.bg-danger {
    background-color: #e74c3c !important;
}

.badge.bg-warning {
    background-color: #f39c12 !important;
}

.badge.bg-info {
    background-color: #3498db !important;
}

/* Empty state - professional */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
}

.empty-state > i {
    display: block;
    font-size: 4rem;
    color: #dee2e6;
    margin-bottom: 1rem;
}

.empty-state p {
    color: #6c757d;
    margin-top: 1rem;
    font-size: 16px;
}

/* Icons inside empty-state buttons/links keep normal button sizing. */
.empty-state .btn i {
    font-size: 1rem;
    color: inherit;
    margin-bottom: 0;
}

/* Card adjustments for better mobile display */
.card {
    border-radius: 0 !important;
    box-shadow: none !important;
    margin-bottom: 8px;
    border-left: none !important;
    border-right: none !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
}

.card-title {
    color: #2c3e50;
    font-weight: 600;
}

/* Improve spacing - Full width container */
.section {
    padding: 0 !important;
}

.row {
    margin-left: 0 !important;
    margin-right: 0 !important;
}

/* Add padding to card bodies to maintain internal spacing */
.card-body {
    padding: 10px 12px !important;
}

/* Header toggle button - hide since we don't need sidebar */
.header-nav .nav-icon {
    display: none !important;
}

.toggle-sidebar-btn {
    display: none !important;
}

/* Hide any sidebar toggle buttons */
.bi-list {
    display: none !important;
}

/* Professional offcanvas styling */
.offcanvas-header {
    border-bottom: 1px solid #e9ecef;
}

.offcanvas-title {
    font-weight: 600;
    color: #2c3e50;
}

/* Professional More Menu Grid */
.more-menu-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 16px 12px;
    background: #fff;
    border-radius: 12px;
    text-decoration: none;
    color: #2c3e50;
    font-weight: 600;
    font-size: 13px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.more-menu-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    color: #2c3e50;
}

.more-menu-item:active {
    transform: translateY(-2px);
}

/* Highlight for the currently open page: a small check badge on the icon */
.more-menu-item.active span {
    color: #0d6efd;
    font-weight: 700;
}

.more-menu-item.active .more-menu-icon {
    position: relative;
}

.more-menu-item.active .more-menu-icon::after {
    content: '\2713';
    position: absolute;
    top: -4px;
    right: -4px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #22c55e;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

/* Disabled menu items (coming soon) */
.more-menu-item.disabled {
    pointer-events: none;
    opacity: 0.5;
}

.more-menu-item.disabled span {
    color: #95a5a6;
}

.more-menu-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.more-menu-icon i {
    font-size: 20px;
    color: #fff;
}

.more-menu-item span {
    font-size: 13px;
    font-weight: 600;
    color: #2c3e50;
}

.list-group-item {
    border-color: #e9ecef;
    padding: 14px 16px;
    color: #2c3e50;
    font-weight: 500;
}

.list-group-item:hover {
    background-color: #f8f9fa;
}

.list-group-item i {
    width: 20px;
    text-align: center;
}

/* Professional alert styling */
.alert {
    border-radius: 6px;
    border: none;
    font-weight: 500;
}

.alert-success {
    background-color: #d4edda;
    color: #155724;
}

.alert-danger {
    background-color: #f8d7da;
    color: #721c24;
}

/* Typography improvements */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: #2c3e50;
    line-height: 1.6;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-weight: 600;
    color: #2c3e50;
}

/* WhatsApp button professional styling */
.btn[style*="#25D366"] {
    background: #25D366 !important;
    border-color: #25D366 !important;
}

.btn[style*="#25D366"]:hover {
    background: #128C7E !important;
    border-color: #128C7E !important;
}

/* Navigation Loader Styles */
.nav-link-loading {
    position: relative;
    pointer-events: none;
    opacity: 0.7;
}

.nav-link-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: nav-spinner 0.6s linear infinite;
}

.mobile-bottom-nav .nav-link-loading::after {
    border: 2px solid rgba(52, 152, 219, 0.3);
    border-top-color: #3498db;
}

@keyframes nav-spinner {
    to {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

/* More Menu Item Loading State */
.more-menu-item-loading {
    position: relative;
    pointer-events: none;
    opacity: 0.7;
}

.more-menu-item-loading .more-menu-icon {
    position: relative;
}

.more-menu-item-loading .more-menu-icon::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 30px;
    height: 30px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: menu-spinner 0.6s linear infinite;
}

@keyframes menu-spinner {
    to {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

/* Hide icon when loading */
.nav-link-loading i,
.more-menu-item-loading i {
    opacity: 0;
}

.nav-link-loading span,
.more-menu-item-loading span {
    opacity: 0.5;
}