/*
 * MichPOS Clean Modern Theme
 * Minimalist, clutter-free design
 * Version: 2.0.0
 */

/* ========================================
   CSS VARIABLES
   ======================================== */
:root {
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --primary-light: #eef2ff;
    --success: #059669;
    --danger: #dc2626;
    --warning: #d97706;
    --info: #0284c7;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-500: #6b7280;
    --gray-700: #374151;
    --gray-900: #111827;
    --white: #ffffff;
    --radius: 6px;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

/* ========================================
   BASE
   ======================================== */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&display=swap');

body {
    font-family: 'Inter', system-ui, sans-serif !important;
    background: var(--gray-50) !important;
    color: var(--gray-900);
    -webkit-font-smoothing: antialiased;
}

/* ========================================
   BUTTONS - Clean & Minimal
   ======================================== */
.btn,
button,
input[type="submit"],
input[type="button"],
a.btn {
    font-family: inherit !important;
    font-weight: 500 !important;
    font-size: 0.875rem !important;
    padding: 0.5rem 1rem !important;
    border-radius: var(--radius) !important;
    border: 1px solid transparent !important;
    cursor: pointer;
    transition: all 0.15s ease !important;
    text-decoration: none !important;
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
}

.btn:hover {
    transform: none !important;
}

/* Primary - Solid */
.btn-primary {
    background: var(--primary) !important;
    color: var(--white) !important;
    border-color: var(--primary) !important;
}

.btn-primary:hover {
    background: var(--primary-hover) !important;
    border-color: var(--primary-hover) !important;
}

/* Success */
.btn-success {
    background: var(--success) !important;
    color: var(--white) !important;
    border-color: var(--success) !important;
}

.btn-success:hover {
    opacity: 0.9;
}

/* Danger */
.btn-danger {
    background: var(--danger) !important;
    color: var(--white) !important;
    border-color: var(--danger) !important;
}

.btn-danger:hover {
    opacity: 0.9;
}

/* Warning */
.btn-warning {
    background: var(--warning) !important;
    color: var(--white) !important;
    border-color: var(--warning) !important;
}

/* Info */
.btn-info {
    background: var(--info) !important;
    color: var(--white) !important;
    border-color: var(--info) !important;
}

/* Default/Secondary - Outline style */
.btn-default,
.btn-secondary {
    background: var(--white) !important;
    color: var(--gray-700) !important;
    border: 1px solid var(--gray-300) !important;
}

.btn-default:hover,
.btn-secondary:hover {
    background: var(--gray-50) !important;
    border-color: var(--gray-300) !important;
}

/* Small buttons */
.btn-xs,
.btn-sm {
    padding: 0.25rem 0.5rem !important;
    font-size: 0.75rem !important;
}

/* ========================================
   CARDS & BOXES - Simple
   ======================================== */
.box,
.card,
.panel {
    background: var(--white) !important;
    border: 1px solid var(--gray-200) !important;
    border-radius: var(--radius) !important;
    box-shadow: var(--shadow) !important;
    margin-bottom: 1rem;
}

.box-header,
.card-header {
    background: var(--white) !important;
    border-bottom: 1px solid var(--gray-200) !important;
    padding: 0.75rem 1rem !important;
    font-weight: 600;
    font-size: 0.875rem;
}

.box-body,
.card-body {
    padding: 1rem !important;
}

.box-footer,
.card-footer {
    background: var(--gray-50) !important;
    border-top: 1px solid var(--gray-200) !important;
    padding: 0.75rem 1rem !important;
}

/* ========================================
   TABLES - Excel Spreadsheet Style
   ======================================== */
.table {
    background: var(--white);
    font-size: 0.8125rem;
    border-collapse: collapse !important;
    border-spacing: 0 !important;
    border: none !important;
    width: 100% !important;
}

.table>thead>tr>th {
    background: #f8fafc !important;
    color: #64748b !important;
    font-weight: 700 !important;
    font-size: 10px !important;
    text-transform: uppercase !important;
    letter-spacing: 0.06em !important;
    padding: 6px 10px !important;
    border: none !important;
    border-bottom: 2px solid #e2e8f0 !important;
    white-space: nowrap;
}

/* Sorting icons */
.table>thead>tr>th.sorting::before,
.table>thead>tr>th.sorting::after,
.table>thead>tr>th.sorting_asc::before,
.table>thead>tr>th.sorting_asc::after,
.table>thead>tr>th.sorting_desc::before,
.table>thead>tr>th.sorting_desc::after {
    color: #94a3b8 !important;
    opacity: 1;
}

.table>tbody>tr>td {
    padding: 5px 10px !important;
    border: none !important;
    border-bottom: 1px solid #f1f5f9 !important;
    vertical-align: middle !important;
    color: var(--gray-900);
    font-size: 13px !important;
    line-height: 1.4 !important;
}

.table>tbody>tr:last-child>td {
    border-bottom: none !important;
}

/* No striping - clean white rows */
.table>tbody>tr:nth-child(odd),
.table>tbody>tr:nth-child(even),
.table-striped>tbody>tr:nth-of-type(odd),
.table-striped>tbody>tr:nth-of-type(even),
.dataTable>tbody>tr:nth-child(odd),
.dataTable>tbody>tr:nth-child(even),
.dataTables_wrapper .dataTable>tbody>tr:nth-child(odd),
.dataTables_wrapper .dataTable>tbody>tr:nth-child(even),
table.dataTable>tbody>tr:nth-child(odd),
table.dataTable>tbody>tr:nth-child(even) {
    background-color: #ffffff !important;
}

/* Subtle hover */
.table>tbody>tr:hover,
.dataTable>tbody>tr:hover,
table.dataTable>tbody>tr:hover {
    background-color: #f8fafc !important;
    transition: background-color 0.1s ease;
}

/* Active/selected row */
.table>tbody>tr.selected,
.table>tbody>tr.active {
    background-color: #eff6ff !important;
}

.table>tbody>tr.success {
    background: #f0fdf4 !important;
}

/* Tfoot */
.table>tfoot>tr>th,
.table>tfoot>tr>td {
    background: #f8fafc !important;
    font-weight: 600 !important;
    border: none !important;
    border-top: 2px solid #e2e8f0 !important;
    padding: 5px 10px !important;
    font-size: 13px !important;
}

/* Remove all borders on bordered/striped variants */
.table-bordered>thead>tr>th,
.table-bordered>thead>tr>td,
.table-bordered>tbody>tr>th,
.table-bordered>tbody>tr>td {
    border: none !important;
    border-bottom: 1px solid #f1f5f9 !important;
}

/* ========================================
   FORMS - Minimal
   ======================================== */
.form-control {
    border: 1px solid var(--gray-300) !important;
    border-radius: var(--radius) !important;
    padding: 0.5rem 0.75rem !important;
    font-size: 0.875rem !important;
    transition: border-color 0.15s !important;
}

.form-control:focus {
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 2px var(--primary-light) !important;
    outline: none !important;
}

label {
    font-weight: 500;
    font-size: 0.875rem;
    color: var(--gray-700);
}

/* ========================================
   PAGINATION - Simple
   ======================================== */
.pagination>li>a,
.pagination>li>span,
.paginate_button {
    border: 1px solid var(--gray-200) !important;
    color: var(--gray-700) !important;
    padding: 0.375rem 0.75rem !important;
    font-size: 0.875rem !important;
    margin: 0 2px !important;
    border-radius: var(--radius) !important;
    background: var(--white) !important;
}

.pagination>li>a:hover,
.paginate_button:hover {
    background: var(--gray-50) !important;
    border-color: var(--gray-300) !important;
}

.pagination>.active>a,
.pagination>.active>span,
.paginate_button.current {
    background: var(--primary) !important;
    border-color: var(--primary) !important;
    color: var(--white) !important;
}

/* Previous/Next */
.paginate_button.previous,
.paginate_button.next {
    background: var(--white) !important;
    color: var(--gray-700) !important;
    border: 1px solid var(--gray-200) !important;
}

.paginate_button.previous:hover,
.paginate_button.next:hover {
    background: var(--primary) !important;
    color: var(--white) !important;
    border-color: var(--primary) !important;
}

.paginate_button.disabled {
    opacity: 0.5 !important;
    cursor: not-allowed !important;
}

/* ========================================
   EXPORT BUTTONS - Distinct colors
   ======================================== */
.dt-buttons {
    margin-bottom: 0.75rem;
}

.dt-button,
.buttons-excel,
.buttons-csv,
.buttons-pdf,
.buttons-print,
.buttons-copy {
    padding: 0.375rem 0.75rem !important;
    font-size: 0.8125rem !important;
    font-weight: 500 !important;
    border-radius: var(--radius) !important;
    margin-right: 0.25rem !important;
    border: none !important;
    cursor: pointer;
}

.buttons-excel {
    background: #16a34a !important;
    color: var(--white) !important;
}

.buttons-csv {
    background: #0891b2 !important;
    color: var(--white) !important;
}

.buttons-pdf {
    background: #dc2626 !important;
    color: var(--white) !important;
}

.buttons-print {
    background: var(--gray-700) !important;
    color: var(--white) !important;
}

.buttons-copy {
    background: var(--gray-500) !important;
    color: var(--white) !important;
}

/* ========================================
   DROPDOWNS - Clean
   ======================================== */
.dropdown-menu {
    border: 1px solid var(--gray-200) !important;
    border-radius: var(--radius) !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1) !important;
    padding: 0.25rem !important;
    z-index: 9999 !important;
    min-width: 150px !important;
}

.dropdown-menu>li>a {
    padding: 0.5rem 0.75rem !important;
    font-size: 0.875rem !important;
    color: var(--gray-700) !important;
    border-radius: 4px !important;
}

.dropdown-menu>li>a:hover {
    background: var(--gray-100) !important;
    color: var(--gray-900) !important;
}

/* Dropdown visibility fix */
.table-responsive {
    overflow: visible !important;
}

td .dropdown-menu {
    position: absolute !important;
}

/* ========================================
   MODALS - Minimal
   ======================================== */
.modal-content {
    border: none !important;
    border-radius: var(--radius) !important;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12) !important;
}

.modal-header {
    background: var(--white) !important;
    border-bottom: 1px solid var(--gray-200) !important;
    padding: 1rem !important;
}

.modal-header .modal-title {
    font-weight: 600;
    font-size: 1rem;
    color: var(--gray-900);
}

.modal-body {
    padding: 1rem !important;
}

.modal-footer {
    background: var(--gray-50) !important;
    border-top: 1px solid var(--gray-200) !important;
    padding: 0.75rem 1rem !important;
}

/* ========================================
   ALERTS - Simple left border
   ======================================== */
.alert {
    border: none !important;
    border-left: 3px solid !important;
    border-radius: var(--radius) !important;
    padding: 0.75rem 1rem !important;
}

.alert-success {
    background: #ecfdf5 !important;
    border-color: var(--success) !important;
    color: #065f46 !important;
}

.alert-danger {
    background: #fef2f2 !important;
    border-color: var(--danger) !important;
    color: #991b1b !important;
}

.alert-warning {
    background: #fffbeb !important;
    border-color: var(--warning) !important;
    color: #92400e !important;
}

.alert-info {
    background: #eff6ff !important;
    border-color: var(--info) !important;
    color: #1e40af !important;
}

/* ========================================
   SCROLLBAR - Thin & Clean
   ======================================== */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: var(--gray-100);
}

::-webkit-scrollbar-thumb {
    background: var(--gray-300);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--gray-500);
}

* {
    scrollbar-width: thin;
    scrollbar-color: var(--gray-300) var(--gray-100);
}

/* ========================================
   BADGES & LABELS
   ======================================== */
.badge,
.label {
    font-size: 0.6875rem !important;
    font-weight: 500 !important;
    padding: 0.25rem 0.5rem !important;
    border-radius: 4px !important;
}

/* ========================================
   SIDEBAR & HEADER
   ======================================== */
.main-sidebar {
    background: var(--gray-900) !important;
}

.sidebar-menu>li>a {
    color: var(--gray-300);
    font-size: 0.875rem;
}

.sidebar-menu>li>a:hover {
    background: rgba(255, 255, 255, 0.05) !important;
}

.sidebar-menu>li.active>a {
    background: rgba(79, 70, 229, 0.2) !important;
    border-left: 3px solid var(--primary);
}

.main-header .navbar {
    background: var(--white) !important;
    border: none !important;
    box-shadow: var(--shadow) !important;
}

/* ========================================
   UTILITIES
   ======================================== */
.bg-primary {
    background: var(--primary) !important;
}

.bg-success {
    background: var(--success) !important;
}

.bg-danger {
    background: var(--danger) !important;
}

.text-primary {
    color: var(--primary) !important;
}

/* ========================================
   WIDGETS
   ======================================== */
.info-box,
.small-box {
    border-radius: var(--radius) !important;
    box-shadow: var(--shadow) !important;
}

/* ========================================
   SIDE PANEL MODAL - Product View
   ======================================== */
#view_product_modal,
.view_product_modal,
.product_modal {
    padding-left: 0 !important;
}

#view_product_modal .modal-dialog,
.view_product_modal .modal-dialog,
.product_modal .modal-dialog {
    position: fixed !important;
    left: 0 !important;
    top: 0 !important;
    bottom: 0 !important;
    margin: 0 !important;
    width: 450px !important;
    max-width: 90vw !important;
    height: 100% !important;
    transform: translateX(-100%) !important;
    transition: transform 0.3s ease !important;
}

#view_product_modal.in .modal-dialog,
.view_product_modal.in .modal-dialog,
.product_modal.in .modal-dialog {
    transform: translateX(0) !important;
}

#view_product_modal .modal-content,
.view_product_modal .modal-content,
.product_modal .modal-content {
    height: 100% !important;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.15) !important;
    display: flex;
    flex-direction: column;
}

#view_product_modal .modal-header,
.view_product_modal .modal-header,
.product_modal .modal-header {
    background: var(--gray-900) !important;
    color: var(--white) !important;
    border-radius: 0 !important;
    padding: 1rem 1.25rem !important;
    flex-shrink: 0;
}

#view_product_modal .modal-header .close,
.view_product_modal .modal-header .close,
.product_modal .modal-header .close {
    color: var(--white) !important;
    opacity: 0.8;
}

#view_product_modal .modal-header .close:hover,
.view_product_modal .modal-header .close:hover,
.product_modal .modal-header .close:hover {
    opacity: 1;
}

#view_product_modal .modal-title,
.view_product_modal .modal-title,
.product_modal .modal-title {
    font-size: 1rem !important;
    font-weight: 600 !important;
}

#view_product_modal .modal-body,
.view_product_modal .modal-body,
.product_modal .modal-body {
    flex: 1 !important;
    overflow-y: auto !important;
    padding: 1.25rem !important;
    background: var(--white) !important;
}

#view_product_modal .modal-footer,
.view_product_modal .modal-footer,
.product_modal .modal-footer {
    background: var(--gray-50) !important;
    border-top: 1px solid var(--gray-200) !important;
    padding: 0.75rem 1.25rem !important;
    flex-shrink: 0;
}

/* Backdrop for side panel */
#view_product_modal.in+.modal-backdrop,
.view_product_modal.in+.modal-backdrop,
.product_modal.in+.modal-backdrop {
    opacity: 0.4 !important;
}

/* ========================================
   DATATABLES - Enhanced Export & Controls
   ======================================== */

/* DataTables wrapper layout */
.dataTables_wrapper {
    padding: 0.5rem 0;
}

/* Show entries dropdown - larger and more visible */
.dataTables_wrapper .dataTables_length {
    margin-bottom: 1rem;
}

.dataTables_wrapper .dataTables_length label {
    font-size: 0.9rem !important;
    font-weight: 500 !important;
    color: var(--gray-700) !important;
    display: flex !important;
    align-items: center !important;
    gap: 0.5rem !important;
}

.dataTables_wrapper .dataTables_length select {
    padding: 0.35rem 0.6rem !important;
    font-size: 0.9rem !important;
    font-weight: 500 !important;
    border: 2px solid var(--gray-300) !important;
    border-radius: var(--radius) !important;
    background: var(--white) !important;
    color: var(--gray-900) !important;
    width: auto !important;
    min-width: 0 !important;
    cursor: pointer !important;
    transition: border-color 0.15s ease !important;
}

.dataTables_wrapper .dataTables_length select:hover,
.dataTables_wrapper .dataTables_length select:focus {
    border-color: var(--primary) !important;
    outline: none !important;
}

/* Search box styling */
.dataTables_wrapper .dataTables_filter {
    margin-bottom: 1rem;
}

.dataTables_wrapper .dataTables_filter label {
    font-size: 0.9rem !important;
    font-weight: 500 !important;
    color: var(--gray-700) !important;
}

.dataTables_wrapper .dataTables_filter input {
    padding: 0.5rem 0.75rem !important;
    font-size: 0.9rem !important;
    border: 2px solid var(--gray-300) !important;
    border-radius: var(--radius) !important;
    min-width: 200px !important;
    transition: border-color 0.15s ease !important;
}

.dataTables_wrapper .dataTables_filter input:focus {
    border-color: var(--primary) !important;
    outline: none !important;
    box-shadow: 0 0 0 3px var(--primary-light) !important;
}

/* Export buttons - larger, colorful, and clearly visible */
.dt-buttons,
.buttons-html5,
.buttons-print {
    margin-bottom: 1rem !important;
}

.dt-buttons .btn,
.dt-buttons .dt-button,
.dt-button {
    padding: 0.6rem 1.25rem !important;
    font-size: 0.875rem !important;
    font-weight: 600 !important;
    border-radius: var(--radius) !important;
    margin-right: 0.5rem !important;
    margin-bottom: 0.5rem !important;
    border: none !important;
    cursor: pointer !important;
    transition: all 0.15s ease !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 0.375rem !important;
}

/* Excel button - Green */
.dt-buttons .buttons-excel,
.buttons-excel {
    background: #10b981 !important;
    color: var(--white) !important;
}

.dt-buttons .buttons-excel:hover,
.buttons-excel:hover {
    background: #059669 !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3) !important;
}

/* CSV button - Blue */
.dt-buttons .buttons-csv,
.buttons-csv {
    background: #3b82f6 !important;
    color: var(--white) !important;
}

.dt-buttons .buttons-csv:hover,
.buttons-csv:hover {
    background: #2563eb !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3) !important;
}

/* PDF button - Red */
.dt-buttons .buttons-pdf,
.buttons-pdf {
    background: #ef4444 !important;
    color: var(--white) !important;
}

.dt-buttons .buttons-pdf:hover,
.buttons-pdf:hover {
    background: #dc2626 !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3) !important;
}

/* Print button - Purple */
.dt-buttons .buttons-print,
.buttons-print {
    background: #8b5cf6 !important;
    color: var(--white) !important;
}

.dt-buttons .buttons-print:hover,
.buttons-print:hover {
    background: #7c3aed !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3) !important;
}

/* Copy button - Gray */
.dt-buttons .buttons-copy,
.buttons-copy {
    background: var(--gray-700) !important;
    color: var(--white) !important;
}

.dt-buttons .buttons-copy:hover,
.buttons-copy:hover {
    background: var(--gray-900) !important;
    transform: translateY(-1px) !important;
}

/* Column visibility button - Teal */
.dt-buttons .buttons-colvis,
.buttons-colvis {
    background: #14b8a6 !important;
    color: var(--white) !important;
}

.dt-buttons .buttons-colvis:hover,
.buttons-colvis:hover {
    background: #0d9488 !important;
    transform: translateY(-1px) !important;
}

/* Pagination styling */
.dataTables_wrapper .dataTables_paginate {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--gray-200);
}

.dataTables_wrapper .dataTables_paginate .paginate_button {
    padding: 0.5rem 0.875rem !important;
    margin: 0 0.125rem !important;
    border-radius: var(--radius) !important;
    font-size: 0.875rem !important;
    font-weight: 500 !important;
    border: 1px solid var(--gray-300) !important;
    background: var(--white) !important;
    color: var(--gray-700) !important;
    transition: all 0.15s ease !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
    background: var(--gray-100) !important;
    border-color: var(--gray-400) !important;
    color: var(--gray-900) !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current {
    background: var(--primary) !important;
    border-color: var(--primary) !important;
    color: var(--white) !important;
    font-weight: 600 !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.disabled {
    opacity: 0.5 !important;
    cursor: not-allowed !important;
}

/* Info text */
.dataTables_wrapper .dataTables_info {
    font-size: 0.875rem !important;
    color: var(--gray-500) !important;
    padding-top: 1rem !important;
}

/* Table header styling */
.dataTable thead th {
    background: var(--gray-900) !important;
    color: var(--white) !important;
    font-weight: 600 !important;
    font-size: 0.8rem !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
    padding: 0.875rem 1rem !important;
    border-bottom: none !important;
}

.dataTable thead th:first-child {
    border-radius: var(--radius) 0 0 0 !important;
}

.dataTable thead th:last-child {
    border-radius: 0 var(--radius) 0 0 !important;
}

/* Sorting icons */
.dataTable thead .sorting:after,
.dataTable thead .sorting_asc:after,
.dataTable thead .sorting_desc:after {
    opacity: 0.7 !important;
}

/* ========================================
   PRINT
   ======================================== */
@media print {

    .box,
    .card {
        box-shadow: none !important;
        border: 1px solid var(--gray-200) !important;
    }
}