/*
 * =====================================================
 * INVVEX - XavexPay Invoicing Solution
 * =====================================================
 * 
 * Copyright (c) 2024 XavexPay. All rights reserved.
 * 
 * This file is part of the Invvex application.
 * 
 * File: style.css
 * Type: CSS Stylesheet
 * Description: CSS stylesheet for style.css
 * 
 * Author: XavexPay Development Team
 * Created: 2025-07-12
 * Last Modified: 2025-07-12
 * Version: 1.0.0
 * 
 * =====================================================
 */

/* Custom styles for Invvex */
@import url('https://fonts.googleapis.com/css2?family=Poppins:ital,wght@0,300;0,400;0,500;0,600;0,700;1,400&display=swap');
@import url('side-panel.css');

:root {
    --invvex-header-height: 60px;
    --invvex-footer-height: 72px;
    --invvex-font-family: 'Poppins', sans-serif;
    --bs-font-sans-serif: var(--invvex-font-family);
    --bs-body-font-family: var(--invvex-font-family);
}

body {
    font-family: var(--invvex-font-family);
    background-color: #f8f9fa;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
}

button,
input,
optgroup,
select,
textarea,
.form-control,
.btn {
    font-family: inherit;
}

/*
 * App shell: header + growing main + footer in one column.
 * Single page scroll on the document; sidebar scrolls only when its menu is tall.
 */
body.invvex-app {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

body.invvex-app > header.invvex-header,
body.invvex-app > .invvex-header {
    flex-shrink: 0;
}

body.invvex-app > .main-content,
body.invvex-app > main.main-content,
body.invvex-app > main.flex-grow-1 {
    flex: 1 1 auto;
    display: flex;
    margin-top: 0;
    min-height: 0;
    width: 100%;
}

body.invvex-app > .settings-layout {
    flex: 1 1 auto;
    display: flex;
    min-height: 0;
    width: 100%;
}

body.invvex-app > .container-fluid,
body.invvex-app > .container {
    flex: 1 1 auto;
    min-height: 0;
    width: 100%;
}

body.invvex-app > footer.invvex-footer,
body.invvex-app > .invvex-footer {
    flex-shrink: 0;
    margin-top: 0;
}

body.invvex-app .content-area {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    min-height: 0;
    min-width: 0;
    overflow: visible;
    padding: 12px 20px 20px;
}

body.invvex-app .settings-content {
    flex: 1 1 auto;
    min-height: 0;
    min-width: 0;
    overflow: visible;
}

/* Main layout structure (legacy pages without invvex-app) */
.main-content {
    display: flex;
    margin-top: 20px;
}

.sidebar {
    position: fixed;
    top: 60px; /* Start below header */
    bottom: 0; /* Full viewport height; footer overlays on top */
    left: 0;
    z-index: 100;
    padding: 0;
    box-shadow: inset -1px 0 0 rgba(0, 0, 0, .1);
    width: 280px;
    background-color: #fff;
    overflow-x: visible;
    overflow-y: auto;
    overscroll-behavior: contain;
    transition: transform 0.25s ease;
    transform: translateX(-100%);
}

.sidebar-collapse-handle {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 34px;
    height: 34px;
    border: 1px solid #d0d7de;
    border-radius: 50%;
    background-color: #fff;
    color: #495057;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
    z-index: 110;
    transition: background-color 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.sidebar-collapse-handle:hover {
    color: #007bff;
    border-color: #007bff;
    background-color: #f8fbff;
    transform: translateY(-1px);
}

.sidebar-collapse-handle i {
    margin-right: 0;
    font-size: 0.9rem;
}

.content-area {
    flex: 1;
    margin-left: 0;
    padding: 0 20px 20px;
    overflow: visible;
}

main.col-md-9.ms-sm-auto.col-lg-10.px-md-4 {
    width: 100%;
    max-width: 100%;
    flex: 0 0 100%;
    margin-left: 0 !important;
    transition: margin-left 0.25s ease, width 0.25s ease, max-width 0.25s ease, flex-basis 0.25s ease;
}

/* Pinned sidebar preference (applied on <html> before sidebar.js runs) */
html.sidebar-pref-pinned .sidebar {
    transform: translateX(0);
}

html.sidebar-pref-pinned .content-area,
html.sidebar-pref-pinned .settings-content {
    margin-left: 280px;
}

html.sidebar-pref-pinned main.col-md-9.ms-sm-auto.col-lg-10.px-md-4 {
    width: calc(100% - 280px);
    max-width: calc(100% - 280px);
    flex: 0 0 calc(100% - 280px);
    margin-left: 280px !important;
}

body.sidebar-initialized:not(.sidebar-collapsed) .sidebar {
    transform: translateX(0);
}

body.sidebar-initialized:not(.sidebar-collapsed) .content-area,
body.sidebar-initialized:not(.sidebar-collapsed) .settings-content {
    margin-left: 280px;
}

body.sidebar-initialized:not(.sidebar-collapsed) main.col-md-9.ms-sm-auto.col-lg-10.px-md-4 {
    width: calc(100% - 280px);
    max-width: calc(100% - 280px);
    flex: 0 0 calc(100% - 280px);
    margin-left: 280px !important;
}

.sidebar-inner {
    display: flex;
    flex-direction: column;
    min-height: 0;
}

#sidebarMenu {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
}

#sidebarMenu .nav-link[href="/logout"],
#sidebarMenu .nav-link[href$="/logout"] {
    margin-top: auto;
}

.sidebar .nav-link {
    font-weight: 500;
    color: #333;
    padding: 0.75rem 1rem;
    border-radius: 0.375rem;
    margin: 0.125rem 0.5rem;
}

.sidebar .nav-link:hover {
    color: #007bff;
    background-color: #e9ecef;
}

.sidebar .nav-link.active {
    color: #007bff;
    background-color: #e7f3ff;
}

.sidebar .nav-link i {
    margin-right: 0.5rem;
}

.navbar-brand {
    font-weight: bold;
}

.navbar-brand i {
    margin-right: 0.5rem;
}

.card {
    border: none;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    border-radius: 0.5rem;
}

.card-header {
    background-color: #fff;
    border-bottom: 1px solid #dee2e6;
    font-weight: 600;
}

.btn {
    border-radius: 0.375rem;
    font-weight: 500;
}

.btn i {
    margin-right: 0.25rem;
}

.alert {
    border: none;
    border-radius: 0.5rem;
}

.alert i {
    margin-right: 0.5rem;
}

.form-control {
    border-radius: 0.375rem;
}

.form-control:focus {
    border-color: #007bff;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

.table {
    border-radius: 0.5rem;
    overflow: hidden;
}

.table thead th {
    background-color: #f8f9fa;
    border-bottom: 2px solid #dee2e6;
    font-weight: 600;
}

.pagination {
    margin-bottom: 0;
}

.page-link {
    border-radius: 0.375rem;
    margin: 0 0.125rem;
}

.badge {
    font-weight: 500;
    padding: 0.5em 0.75em;
}

/* Status badges */
.badge.bg-success {
    background-color: #28a745 !important;
}

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

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

.badge.bg-info {
    background-color: #17a2b8 !important;
}

.badge.bg-secondary {
    background-color: #6c757d !important;
}

/* Footer sits above the fixed sidebar at the bottom of the page */
.invvex-footer {
    position: relative;
    bottom: auto;
    left: auto;
    right: auto;
    z-index: 200;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1rem 0;
    box-shadow: 0 -2px 4px rgba(0,0,0,0.1);
    margin-top: 1.5rem;
}

body.invvex-app > footer.invvex-footer,
body.invvex-app > .invvex-footer {
    margin-top: 0;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        top: 60px;
        bottom: 0;
        height: auto;
        padding-top: 0;
        width: 280px;
        transform: translateX(-100%);
        overflow-y: auto;
    }
    
    .content-area {
        margin-left: 0;
        padding: 10px;
    }

    main.col-md-9.ms-sm-auto.col-lg-10.px-md-4 {
        width: 100%;
        max-width: 100%;
        flex: 0 0 100%;
        margin-left: 0 !important;
    }
    
    .invvex-footer {
        margin-top: 1rem; /* Less margin on mobile */
    }
    
    .main-content {
        flex-direction: column;
    }

    html.sidebar-pref-open .sidebar,
    body.sidebar-open .sidebar {
        transform: translateX(0);
    }

    .sidebar-collapse-handle {
        display: none;
    }
}

/* Custom animations */
.fade-in {
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Loading spinner */
.spinner-border-sm {
    width: 1rem;
    height: 1rem;
}

/* Tooltip customizations */
.tooltip {
    font-size: 0.875rem;
}

/* Modal customizations */
.modal-content {
    border: none;
    border-radius: 0.5rem;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

.modal-header {
    border-bottom: 1px solid #dee2e6;
    padding: 1rem 1.5rem;
}

.modal-footer {
    border-top: 1px solid #dee2e6;
    padding: 1rem 1.5rem;
}

.form-check-input {
    border-radius: 0.25rem;
}

.form-switch .form-check-input {
    width: 2rem;
    height: 1rem;
    margin-top: 0.25rem;
}

.form-switch.form-switch-xl {
    padding-left: 3rem;
}

.form-switch.form-switch-xl .form-check-input {
    width: 3rem;
    height: 1.5rem;
}

.settings-layout {
    display: flex;
    min-height: 100vh;
}

body.invvex-app .settings-layout {
    min-height: 0;
}

.settings-sidebar {
    width: 280px;
    background-color: #f8f9fa;
    border-right: 1px solid #dee2e6;
    padding: 1rem;
}

.settings-submenu {
    position: static;
    top: auto;
    left: auto;
    width: calc(100% - 1rem);
    height: auto;
    background-color: #fff;
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
    z-index: 99;
    display: block;
    overflow: hidden;
    margin: 0.25rem 0.5rem 0.5rem 0.5rem;
    max-height: 0;
    opacity: 0;
    visibility: hidden;
    transition: max-height 1s ease, opacity 0.25s ease;
}

.settings-submenu.open {
    max-height: 500px;
    opacity: 1;
    visibility: visible;
}

.submenu-header {
    display: none;
}

#settingsMenu .fa-chevron-right,
#accessMenu .fa-chevron-right {
    transition: transform 0.25s ease;
}

#settingsMenu.menu-expanded .fa-chevron-right,
#accessMenu.menu-expanded .fa-chevron-right {
    transform: rotate(90deg);
}

#settingsMenu.menu-parent-active,
#accessMenu.menu-parent-active {
    color: #007bff;
    background-color: #e7f3ff;
}

.settings-content {
    flex: 1 1 auto;
    margin-left: 0;
    padding: 2rem;
    background-color: #fff;
    min-height: calc(100vh - 60px - 80px); /* Account for header and footer */
    width: 60%;
    max-width: 60%;
}

body.invvex-app .settings-content {
    min-height: 0;
    width: 60%;
    max-width: 60%;
}

/* Company settings: label | field | save per row */
.company-setting-row {
    border-bottom: 1px solid #e9ecef;
    padding: 0.875rem 0;
    margin: 0;
}

.company-setting-row:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.company-setting-row:first-child {
    padding-top: 0;
}

.company-setting-row .setting-label {
    font-weight: 500;
    margin-bottom: 0.15rem;
}

.company-setting-row .setting-hint {
    display: block;
    font-size: 0.8125rem;
    color: #6c757d;
    line-height: 1.35;
}

.company-setting-row .btn-save-setting {
    min-width: 4.5rem;
}

@media (max-width: 767.98px) {
    .company-setting-row .btn-save-setting {
        width: 100%;
        margin-top: 0.25rem;
    }
}

.submenu-header {
    padding: 1rem;
    border-bottom: 1px solid #dee2e6;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #f8f9fa;
}

.settings-submenu .submenu-header {
    display: none !important;
}

.submenu-link {
    display: block;
    padding: 0.75rem 1rem;
    color: #333;
    text-decoration: none;
    border-radius: 0.375rem;
    margin: 0.125rem 0.5rem;
}

.submenu-link:hover {
    color: #007bff;
    background-color: #e9ecef;
    text-decoration: none;
}

.submenu-link.active {
    color: #007bff;
    background-color: #e7f3ff;
}

.submenu-link i {
    margin-right: 0.5rem;
    width: 1rem;
}

@media (max-width: 1200px) {
    .settings-sidebar {
        width: 240px;
    }
    
    .settings-submenu {
        left: auto;
        width: calc(100% - 1rem);
        height: auto;
    }
    
    .settings-content {
        margin-left: 240px;
        min-height: calc(100vh - 60px - 80px); /* Account for header and footer */
    }
}

@media (max-width: 768px) {
    .settings-layout {
        flex-direction: column;
    }
    
    .settings-sidebar,
    .settings-submenu {
        width: 100%;
        position: static;
        height: auto;
    }

    .settings-submenu {
        width: calc(100% - 1rem);
    }
    
    .settings-content {
        margin-left: 0;
        padding: 1rem;
        width: 100%;
        max-width: 100%;
    }
}

/* Payments page — status & method badges */
.payment-status-badge,
.payment-method-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
    line-height: 1.2;
    white-space: nowrap;
}

.payment-status-badge {
    text-transform: capitalize;
}

.payment-status-completed {
    background-color: #198754;
    color: #fff;
}

.payment-status-pending {
    background-color: #fff3cd;
    color: #664d03;
}

.payment-status-failed {
    background-color: #f8d7da;
    color: #842029;
}

.payment-status-cancelled {
    background-color: #e2e3e5;
    color: #41464b;
}

.payment-method-badge i {
    font-size: 0.85rem;
    opacity: 0.95;
}

.payment-method-cash {
    background-color: #d1e7dd;
    color: #0a3622;
    border: 1px solid #a3cfbb;
}

.payment-method-bank_transfer {
    background-color: #cfe2ff;
    color: #052c65;
    border: 1px solid #9ec5fe;
}

.payment-method-credit_card {
    background-color: #e2d9f3;
    color: #432874;
    border: 1px solid #c5b3e6;
}

.payment-method-debit_card {
    background-color: #ffe5d0;
    color: #7c2d12;
    border: 1px solid #fecba1;
}

.payment-method-check {
    background-color: #d3f9d8;
    color: #2b8a3e;
    border: 1px solid #8ce99a;
}

.payment-method-online {
    background-color: #cff4fc;
    color: #055160;
    border: 1px solid #9eeaf9;
}

.payment-method-other {
    background-color: #e9ecef;
    color: #495057;
    border: 1px solid #ced4da;
}