﻿/* =========================================================
   Negosyo 365 - GLOBAL
   ========================================================= */

html,
body {
    margin: 0;
    padding: 0;
    font-family: Arial, Helvetica, sans-serif;
    background-color: #f5f6f8;
    color: #111827;
}

* {
    box-sizing: border-box;
}


/* =========================================================
   APPLICATION LAYOUT
   ========================================================= */

.app-layout {
    display: flex;
    width: 100%;
    min-height: 100vh;
}


/* =========================================================
   SIDEBAR
   ========================================================= */

.sidebar-container {
    width: 240px;
    min-width: 240px;
    max-width: 240px;
    min-height: 100vh;
    flex: 0 0 240px;
    background-color: #1f2937;
    overflow-x: hidden;
}

.sidebar {
    width: 100%;
    min-height: 100vh;
    color: white;
}


/* =========================================================
   BRAND
   ========================================================= */

.brand {
    height: 64px;
    display: flex;
    align-items: center;
    padding: 0 20px;
    font-size: 19px;
    font-weight: 600;
    color: white;
    border-bottom: 1px solid #374151;
}

.brand-icon {
    margin-right: 10px;
}


/* =========================================================
   SIDEBAR MENU
   ========================================================= */

.sidebar-container .menu {
    width: 100%;
    padding: 15px 10px;
    margin: 0;
    display: flex;
    flex-direction: column;
    align-items: stretch;
}


    /* =========================================================
   ALL TOP LEVEL MENU ROWS
   IMPORTANT:
   Dashboard, Sales, Purchasing, Inventory,
   Reports, Administration and Logout
   MUST HAVE THE SAME WIDTH/HEIGHT.
   ========================================================= */

    .sidebar-container .menu > .menu-item,
    .sidebar-container .menu > .nav-section > .nav-parent {
        width: 100%;
        min-width: 100%;
        max-width: 100%;
        height: 42px;
        min-height: 42px;
        max-height: 42px;
        margin: 2px 0;
        padding: 0 12px;
        display: flex;
        align-items: center;
        border: 0;
        border-radius: 6px;
        box-sizing: border-box;
        font-family: Arial, Helvetica, sans-serif;
        font-size: 14px;
        line-height: 1;
        text-decoration: none;
    }


    /* =========================================================
   NORMAL MENU ITEM
   ========================================================= */

    .sidebar-container .menu > .menu-item {
        flex: 0 0 100%;
        justify-content: flex-start;
        color: #d1d5db;
        background-color: transparent;
        cursor: pointer;
        transition: background-color 0.15s ease, color 0.15s ease;
    }


/* =========================================================
   NAVIGATION SECTION
   ========================================================= */

.sidebar-container .nav-section {
    width: 100%;
    min-width: 100%;
    max-width: 100%;
    margin: 2px 0;
    padding: 0;
    display: block;
    box-sizing: border-box;
}


/* =========================================================
   EXPANDABLE MENU BUTTON
   ========================================================= */

.sidebar-container .nav-parent {
    flex: 0 0 100%;
    justify-content: space-between;
    color: #d1d5db;
    background-color: transparent;
    outline: none;
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
}


    /* =========================================================
   NAV PARENT CONTENT
   ========================================================= */

    .sidebar-container .nav-parent > span:first-child {
        display: flex;
        align-items: center;
        flex: 1 1 auto;
        min-width: 0;
        margin: 0;
        padding: 0;
        text-align: left;
    }


/* =========================================================
   NAV ICON
   ========================================================= */

.sidebar-container .nav-icon {
    width: 26px;
    min-width: 26px;
    margin-right: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    font-size: 15px;
}


/* =========================================================
   SUBMENU ARROW
   ========================================================= */

.sidebar-container .submenu-arrow {
    width: 20px;
    min-width: 20px;
    margin-left: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
}


/* =========================================================
   SUBMENU
   ========================================================= */

.sidebar-container .nav-submenu {
    width: 100%;
    min-width: 100%;
    margin: 0;
    padding: 2px 0 4px 12px;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    box-sizing: border-box;
}


    /* =========================================================
   SUBMENU ITEMS
   ========================================================= */

    .sidebar-container .nav-submenu .menu-item {
        width: 100%;
        min-width: 100%;
        max-width: 100%;
        height: 38px;
        min-height: 38px;
        max-height: 38px;
        margin: 1px 0;
        padding: 0 12px;
        display: flex;
        align-items: center;
        justify-content: flex-start;
        box-sizing: border-box;
        border-radius: 6px;
        color: #d1d5db;
        text-decoration: none;
        font-size: 13px;
        line-height: 1;
        transition: background-color 0.15s ease, color 0.15s ease;
    }


        /* =========================================================
   HOVER
   ========================================================= */

        .sidebar-container .menu > .menu-item:hover,
        .sidebar-container .nav-parent:hover,
        .sidebar-container .nav-submenu .menu-item:hover {
            background-color: #374151;
            color: white;
        }


/* =========================================================
   ACTIVE
   ========================================================= */

.sidebar-container .menu-item.active {
    background-color: #2563eb !important;
    color: white !important;
}


/* =========================================================
   LOGOUT
   ========================================================= */

.sidebar-container .menu > .menu-item:last-child {
    margin-top: 10px;
}


/* =========================================================
   MAIN CONTENT
   ========================================================= */

.main-content {
    flex: 1 1 auto;
    min-width: 0;
    min-height: 100vh;
    background-color: #f5f6f8;
}


/* =========================================================
   TOP BAR
   ========================================================= */

.top-bar {
    height: 64px;
    background-color: white;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 25px;
}

    .top-bar strong {
        font-size: 18px;
        color: #111827;
    }

.tenant-info {
    color: #6b7280;
    font-size: 14px;
}


/* =========================================================
   PAGE CONTENT
   ========================================================= */

.content {
    padding: 25px;
}


/* =========================================================
   PAGE HEADER
   ========================================================= */

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

    .page-header h1 {
        margin: 0;
        font-size: 30px;
        font-weight: 600;
    }

.page-subtitle {
    margin: 5px 0 0;
    color: #6b7280;
    font-size: 14px;
}


/* =========================================================
   CARDS
   ========================================================= */

.card {
    background-color: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
}


/* =========================================================
   SEARCH BAR
   ========================================================= */

.search-bar {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
}

    .search-bar .form-control {
        flex: 1;
        max-width: 600px;
    }


/* =========================================================
   FORM CONTROLS
   ========================================================= */

.form-control {
    width: 100%;
    padding: 9px 11px;
    border: 1px solid #d1d5db;
    border-radius: 5px;
    background-color: white;
    color: #111827;
    font-size: 14px;
    outline: none;
}

    .form-control:focus {
        border-color: #2563eb;
        box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.12);
    }

    .form-control::placeholder {
        color: #9ca3af;
    }


/* =========================================================
   BUTTONS
   ========================================================= */

.btn {
    border: none;
    border-radius: 5px;
    padding: 9px 16px;
    cursor: pointer;
    font-family: inherit;
    font-size: 14px;
    white-space: nowrap;
    transition: background-color 0.15s ease, transform 0.05s ease;
}

    .btn:active {
        transform: translateY(1px);
    }


.btn-primary {
    background-color: #2563eb;
    color: white;
}

    .btn-primary:hover {
        background-color: #1d4ed8;
    }


.btn-secondary {
    background-color: #374151;
    color: white;
}

    .btn-secondary:hover {
        background-color: #1f2937;
    }


.btn-light {
    background-color: #e5e7eb;
    color: #374151;
}

    .btn-light:hover {
        background-color: #d1d5db;
    }


.btn-small {
    padding: 6px 10px;
    background-color: #e5e7eb;
    color: #111827;
    margin-right: 5px;
}

    .btn-small:hover {
        background-color: #d1d5db;
    }


.btn-danger {
    background-color: #dc2626;
    color: white;
}

    .btn-danger:hover {
        background-color: #b91c1c;
    }


.btn-success {
    background-color: #198754;
    color: white;
}

    .btn-success:hover {
        background-color: #157347;
    }


/* =========================================================
   MESSAGES
   ========================================================= */

.required {
    color: #dc3545;
}

.message-success {
    background: #d1e7dd;
    color: #0f5132;
    border: 1px solid #badbcc;
    border-radius: 6px;
    padding: 12px 16px;
    margin-bottom: 20px;
}

.message-error {
    background: #f8d7da;
    color: #842029;
    border: 1px solid #f5c2c7;
    border-radius: 6px;
    padding: 12px 16px;
    margin-bottom: 20px;
}

.status.warning {
    background: #fff3cd;
    color: #664d03;
    margin-left: 8px;
}


/* =========================================================
   MODAL
   ========================================================= */

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-dialog {
    width: 420px;
    max-width: calc(100% - 30px);
    padding: 24px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
}

    .modal-dialog h3 {
        margin-top: 0;
    }

    .modal-dialog .form-actions {
        margin-top: 20px;
    }


/* =========================================================
   CUSTOMER FORM
   ========================================================= */

.customer-form {
    margin-top: 20px;
}

.form-header {
    margin-bottom: 20px;
}

    .form-header h2 {
        margin: 0;
        font-size: 21px;
        font-weight: 600;
    }


.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

    .form-group label {
        font-weight: 600;
        font-size: 14px;
        color: #374151;
    }

.form-full {
    grid-column: 1 / -1;
}


.checkbox-group {
    justify-content: center;
}

    .checkbox-group label {
        display: flex;
        align-items: center;
        gap: 8px;
        font-weight: 500;
    }

    .checkbox-group input {
        width: 16px;
        height: 16px;
    }


.form-actions {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #e5e7eb;
    display: flex;
    gap: 10px;
}


/* =========================================================
   DATA TABLE
   ========================================================= */

.data-table {
    width: 100%;
    border-collapse: collapse;
}

    .data-table th {
        text-align: left;
        padding: 12px;
        background-color: #f9fafb;
        border-bottom: 2px solid #e5e7eb;
        font-size: 13px;
        font-weight: 600;
        color: #374151;
    }

    .data-table td {
        padding: 12px;
        border-bottom: 1px solid #e5e7eb;
        font-size: 14px;
        color: #374151;
    }

    .data-table tbody tr:hover {
        background-color: #f9fafb;
    }

    .data-table tbody tr:last-child td {
        border-bottom: none;
    }

.actions-column {
    width: 180px;
}


/* =========================================================
   EMPTY TABLE
   ========================================================= */

.empty-state {
    text-align: center !important;
    padding: 50px 20px !important;
    color: #6b7280 !important;
    font-size: 14px;
}


/* =========================================================
   STATUS
   ========================================================= */

.status {
    display: inline-block;
    padding: 4px 9px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

    .status.active {
        background-color: #dcfce7;
        color: #166534;
    }

    .status.inactive {
        background-color: #fee2e2;
        color: #991b1b;
    }


/* =========================================================
   NOTIFICATION
   ========================================================= */

.message {
    position: fixed;
    right: 25px;
    bottom: 25px;
    background-color: #111827;
    color: white;
    padding: 12px 18px;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    font-size: 14px;
    z-index: 1000;
}


/* =========================================================
   HEADINGS
   ========================================================= */

h1,
h2,
h3,
h4 {
    color: #111827;
}

h1 {
    margin-top: 0;
}


/* =========================================================
   LINKS
   ========================================================= */

a {
    color: #2563eb;
}

    a:hover {
        color: #1d4ed8;
    }


/* =========================================================
   DASHBOARD
   ========================================================= */

.dashboard-container {
    padding: 24px;
}

.dashboard-header {
    margin-bottom: 24px;
}

    .dashboard-header h2 {
        margin: 0;
        font-size: 28px;
        font-weight: 600;
    }

    .dashboard-header p {
        margin: 4px 0 0;
        opacity: 0.7;
    }

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 20px;
}

.dashboard-card {
    padding: 22px;
    border-radius: 12px;
    background: var(--bs-body-bg, #ffffff);
    border: 1px solid var(--bs-border-color, #dee2e6);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

.dashboard-card-title {
    font-size: 15px;
    font-weight: 500;
    opacity: 0.75;
}

.dashboard-card-value {
    margin-top: 10px;
    font-size: 32px;
    font-weight: 700;
}

.dashboard-card-footer {
    margin-top: 8px;
    font-size: 13px;
    opacity: 0.6;
}

.inventory-value-card {
    margin-top: 20px;
    padding: 24px;
    border-radius: 12px;
    background: var(--bs-body-bg, #ffffff);
    border: 1px solid var(--bs-border-color, #dee2e6);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.inventory-value-title {
    font-size: 18px;
    font-weight: 600;
}

.inventory-value-subtitle {
    margin-top: 4px;
    font-size: 13px;
    opacity: 0.65;
}

.inventory-value {
    font-size: 28px;
    font-weight: 700;
}

.dashboard-loading {
    padding: 40px;
    text-align: center;
    opacity: 0.7;
}


/* =========================================================
   DASHBOARD CHART
   ========================================================= */

.dashboard-chart-card {
    margin-top: 20px;
    padding: 24px;
    border-radius: 12px;
    background: var(--bs-body-bg, #ffffff);
    border: 1px solid var(--bs-border-color, #dee2e6);
}

.dashboard-chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}

    .dashboard-chart-header h3 {
        margin: 0;
        font-size: 20px;
    }

    .dashboard-chart-header p {
        margin: 5px 0 0;
        font-size: 13px;
        opacity: 0.65;
    }

.chart-legend {
    display: flex;
    gap: 15px;
    font-size: 13px;
}

    .chart-legend span {
        display: flex;
        align-items: center;
        gap: 5px;
    }

.legend-sales,
.legend-purchases {
    width: 10px;
    height: 10px;
    display: inline-block;
    border-radius: 2px;
}

.legend-sales {
    background: #0d6efd;
}

.legend-purchases {
    background: #6c757d;
}

.chart-container {
    height: 320px;
    display: flex;
    align-items: stretch;
    gap: 12px;
    padding: 20px 10px 0;
    border-bottom: 1px solid var(--bs-border-color, #dee2e6);
}

.chart-column {
    flex: 1;
    min-width: 30px;
    display: flex;
    flex-direction: column;
}

.chart-bars {
    flex: 1;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 4px;
}

.chart-bar {
    width: 35%;
    min-height: 2px;
    border-radius: 4px 4px 0 0;
    transition: height 0.3s ease;
}

.sales-bar {
    background: #0d6efd;
}

.purchases-bar {
    background: #6c757d;
}

.chart-month {
    height: 25px;
    margin-top: 8px;
    text-align: center;
    font-size: 12px;
    opacity: 0.65;
}


/* =========================================================
   USER INFO
   ========================================================= */

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

    .user-info small {
        font-size: 13px;
    }


/* =========================================================
   TABLET
   ========================================================= */

@media (max-width: 900px) {

    .sidebar-container {
        width: 210px;
        min-width: 210px;
        max-width: 210px;
        flex-basis: 210px;
    }

    .content {
        padding: 20px;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .form-full {
        grid-column: auto;
    }

    .data-table {
        font-size: 13px;
    }

        .data-table th,
        .data-table td {
            padding: 9px;
        }

    .dashboard-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}


/* =========================================================
   MOBILE
   ========================================================= */

@media (max-width: 700px) {

    .app-layout {
        display: block;
    }

    .sidebar-container {
        width: 100%;
        min-width: 100%;
        max-width: 100%;
        flex-basis: auto;
        min-height: auto;
    }

    .sidebar {
        min-height: auto;
    }

    .brand {
        height: 55px;
    }

    /*
       Mobile menu becomes horizontal.
    */

    .sidebar-container .menu {
        width: 100%;
        display: flex;
        flex-direction: row;
        overflow-x: auto;
        align-items: center;
        padding: 8px;
    }

        .sidebar-container .menu > .menu-item,
        .sidebar-container .menu > .nav-section > .nav-parent {
            width: auto;
            min-width: auto;
            max-width: none;
            flex: 0 0 auto;
            height: 40px;
            min-height: 40px;
            max-height: 40px;
            margin: 0 2px;
        }

    .sidebar-container .nav-section {
        width: auto;
        min-width: auto;
        max-width: none;
        flex: 0 0 auto;
    }

    .sidebar-container .nav-submenu {
        position: absolute;
        width: 220px;
        min-width: 220px;
        background-color: #1f2937;
        border-radius: 6px;
        box-shadow: 0 5px 15px rgba(0, 0, 0, 0.25);
        z-index: 100;
    }

    .main-content {
        min-height: auto;
    }

    .top-bar {
        height: 55px;
        padding: 0 15px;
    }

    .content {
        padding: 15px;
    }

    .page-header {
        align-items: flex-start;
        gap: 15px;
    }

        .page-header h1 {
            font-size: 25px;
        }

    .search-bar {
        flex-direction: column;
        align-items: stretch;
    }

        .search-bar .form-control {
            max-width: none;
        }

    .data-table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }

    .dashboard-container {
        padding: 16px;
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .inventory-value-card {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    .dashboard-chart-header {
        align-items: flex-start;
        gap: 15px;
    }

    .chart-legend {
        flex-wrap: wrap;
    }
}


/* =========================================================
   VERY SMALL SCREENS
   ========================================================= */

@media (max-width: 480px) {

    .page-header {
        flex-direction: column;
    }

        .page-header .btn {
            width: 100%;
        }

    .card {
        padding: 15px;
    }

    .form-actions {
        flex-direction: column;
    }

        .form-actions .btn {
            width: 100%;
        }

    .message {
        left: 15px;
        right: 15px;
        bottom: 15px;
        text-align: center;
    }

    .user-info {
        display: flex;
        flex-direction: column;
        align-items: flex-start;
    }

        .user-info small {
            font-size: 0.8rem;
        }
}

/* =========================================================
   MODAL DIALOG
   ========================================================= */

.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(0, 0, 0, 0.45);
}

.modal-dialog {
    width: 420px;
    max-width: 100%;
    max-height: calc(100vh - 40px);
    display: flex;
    flex-direction: column;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
    overflow: hidden;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #e5e7eb;
}

    .modal-header h3 {
        margin: 0;
        font-size: 18px;
        font-weight: 600;
        color: #111827;
    }

.modal-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: none;
    border-radius: 5px;
    background: transparent;
    color: #6b7280;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
}

    .modal-close:hover {
        background: #f3f4f6;
        color: #111827;
    }

.modal-body {
    padding: 20px;
    overflow-y: auto;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 15px 20px;
    border-top: 1px solid #e5e7eb;
    background: #f9fafb;
}


/* =========================================================
   MOBILE MODAL
   ========================================================= */

@media (max-width: 480px) {

    .modal-backdrop {
        padding: 15px;
    }

    .modal-dialog {
        width: 100%;
        max-height: calc(100vh - 30px);
    }

    .modal-header {
        padding: 14px 16px;
    }

    .modal-body {
        padding: 16px;
    }

    .modal-footer {
        padding: 12px 16px;
    }
}

/* =========================================================
   ALERT MESSAGE
   ========================================================= */
/* Forces the background, text, and border to a true red */
.alert-danger {
    background-color: #dc3545 !important; /* Bootstrap primary danger red */
    color: #ffffff !important; /* White text for better contrast */
    border-color: #bd2130 !important; /* Darker red border */
}