/* --- Modern Dashboard Styles --- */
body {
    background-color: #f4f7f6;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

nav.navbar {
    background-color: #ffffff;
    border: none;
    box-shadow: 0 2px 4px rgba(0,0,0,0.08);
    margin-bottom: 30px;
}

nav.navbar .navbar-brand {
    padding: 10px 15px;
    height: auto;
}

nav.navbar .navbar-nav > li > a {
    color: #555;
    font-weight: 500;
    transition: all 0.3s ease;
}

nav.navbar .navbar-nav > li > a:hover,
nav.navbar .navbar-nav > li.active > a {
    color: #245580;
    background-color: rgba(36, 85, 128, 0.05) !important;
}

/* Dashboard Cards */
.dashboard-card {
    border-radius: 8px;
    border: none;
    margin-bottom: 25px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    overflow: hidden;
}

.dashboard-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 15px rgba(0,0,0,0.1);
}

.dashboard-card .panel-heading {
    padding: 20px;
    border: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.dashboard-card .panel-heading h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #fff;
}

.dashboard-card .card-value {
    font-size: 32px;
    font-weight: 700;
    color: #fff;
    margin: 10px 0 0 0;
}

.dashboard-card .card-footer {
    background: rgba(0,0,0,0.05);
    padding: 10px 20px;
    font-size: 13px;
    color: rgba(255,255,255,0.8);
}

.bg-success { background: linear-gradient(135deg, #28a745, #218838); color: #fff; }
.bg-danger { background: linear-gradient(135deg, #dc3545, #c82333); color: #fff; }
.bg-info { background: linear-gradient(135deg, #17a2b8, #138496); color: #fff; }
.bg-primary { background: linear-gradient(135deg, #007bff, #0069d9); color: #fff; }
.bg-warning { background: linear-gradient(135deg, #ffc107, #e0a800); color: #fff; }
.bg-dark { background: linear-gradient(135deg, #343a40, #23272b); color: #fff; }

/* Table styling */
.panel-default {
    border-radius: 8px;
    border: none;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
}

.panel-default > .panel-heading {
    background-color: #fff;
    border-bottom: 1px solid #eee;
    padding: 15px 20px;
    font-weight: 600;
    font-size: 16px;
}

.table > certain-thead > tr > th {
    border-bottom: 2px solid #f4f7f6;
    color: #888;
    text-transform: uppercase;
    font-size: 12px;
    letter-spacing: 0.5px;
}

/* Original card overrides */
div.card {
  width: 100%;
  border-radius: 8px;
  box-shadow: 0 4px 6px rgba(0,0,0,0.05);
  text-align: center;
  border: none;
  overflow: hidden;
  margin-bottom: 20px;
}

div.cardHeader {
    background-color: #4CAF50;
    color: white;
    padding: 15px;
    font-size: 36px;
    font-weight: 700;
}

div.cardContainer {
    padding: 15px;
    background: #fff;
}

.div-hide {
	display: none !important;
}

/* Fix Table Borders */
#productTable {
    border: 1px solid #ddd !important;
    border-collapse: collapse !important;
}

#productTable th, #productTable td {
    border: 1px solid #ddd !important;
    padding: 8px !important;
}

#productTable thead th {
    background-color: #f5f5f5;
    border-bottom: 2px solid #ddd !important;
}

/* Quick Search Result Styling */
#searchResultSection {
    box-shadow: 0 10px 25px rgba(0,0,0,0.2) !important;
    border: 1px solid #245580 !important;
}

#searchResultBody tr {
    cursor: pointer;
    transition: background 0.2s;
}

#searchResultBody tr:hover {
    background-color: #f0f7fd !important;
}

/* --- Mobile Responsive Enhancements --- */
@media (max-width: 768px) {
    .container {
        width: 100% !important;
        padding-left: 10px !important;
        padding-right: 10px !important;
    }

    /* Navbar mobile optimization */
    .navbar-brand img {
        height: 30px !important;
    }

    /* Dashboard cards - 2 columns on mobile */
    .col-md-3 {
        width: 50% !important;
        float: left !important;
        padding: 5px !important;
    }

    .dashboard-card {
        margin-bottom: 10px !important;
    }

    .dashboard-card .panel-heading {
        padding: 10px !important;
        flex-direction: column;
        text-align: center;
    }

    .dashboard-card .card-value {
        font-size: 20px !important;
    }

    .dashboard-card .panel-heading h3 {
        font-size: 12px !important;
    }

    .dashboard-card .card-icon {
        display: none !important; /* Hide large icons on mobile cards */
    }

    /* Forms on mobile */
    .form-horizontal .control-label {
        text-align: left !important;
        margin-bottom: 5px;
    }

    /* Tables responsiveness */
    .table-responsive {
        border: none !important;
        margin-bottom: 0;
    }
    
    /* Order Table Specifics */
    #productTable th:nth-child(2), 
    #productTable td:nth-child(2),
    #productTable th:nth-child(3), 
    #productTable td:nth-child(3) {
        display: none; /* Hide Rate and Available Qty on very small screens to save space */
    }
}

/* Make all panels have responsive tables */
.panel-body {
    overflow-x: auto;
}

.kv-file-zoom {
	display: none;
}

div.kv-avatar div.file-input div.file-preview {
	width: 200px;
}

/*login form*/
.vertical {
	padding-top: 50px; /* Reduced for mobile */
	padding-bottom: 50px;
}

/* Mobile Optimizations */
@media (max-width: 768px) {
    .container {
        padding-left: 10px;
        padding-right: 10px;
    }

    .navbar-brand img {
        height: 40px;
    }

    /* Make tables scrollable horizontally on mobile */
    .table-responsive, 
    .dataTables_wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Make buttons easier to tap */
    .btn {
        padding: 10px 15px;
        font-size: 16px;
        margin-bottom: 5px;
    }

    /* Full width buttons in modals */
    .modal-footer .btn {
        width: 100%;
        margin-left: 0 !important;
        margin-bottom: 10px;
    }

    /* Form labels stacking */
    .form-horizontal .control-label {
        text-align: left;
        margin-bottom: 5px;
    }

    /* Breadcrumb visibility */
    .breadcrumb {
        padding: 8px 5px;
        font-size: 12px;
    }

    /* Card adjustments */
    div.cardHeader {
        font-size: 30px;
    }
}

/* Ensure dataTables are scrollable */
table.dataTable {
    width: 100% !important;
}

/* Custom class for mobile scrollable tables */
.mobile-scroll {
    overflow-x: auto;
    display: block;
    width: 100%;
}

/* Fix DataTables pagination button spacing */
/* 强制所有分页按钮显示手指指针 */
.pagination,
.pagination *:not(.disabled),
.dataTables_paginate,
.dataTables_paginate *,
.dataTables_wrapper .dataTables_paginate .paging_bootstrap *,
.dataTables_wrapper .dataTables_paginate .paging_bootstrap > li > a,
.dataTables_wrapper .dataTables_paginate .paging_bootstrap > li > span {
    cursor: pointer !important;
    user-select: none !important;
    -webkit-user-select: none !important;
    -moz-user-select: none !important;
    -ms-user-select: none !important;
}

.dataTables_paginate .pagination {
    margin: 0;
}

/* 每个 li 之间加间距 */
.dataTables_paginate .pagination > li {
    margin: 0 3px !important;
}

.dataTables_paginate .pagination > li > a,
.dataTables_paginate .pagination > li > span {
    padding: 6px 14px !important;
    border-radius: 4px !important;
    min-width: 40px;
    text-align: center;
    display: inline-block !important;
    border: 1px solid #ddd !important;
    background: #fff !important;
    color: #337ab7 !important;
    line-height: 1.5 !important;
}

.dataTables_paginate .pagination > li > a:hover,
.dataTables_paginate .pagination > li > span:hover {
    background: #337ab7 !important;
    color: #fff !important;
    border-color: #337ab7 !important;
}

/* 当前激活页 */
.dataTables_paginate .pagination > li.active > a,
.dataTables_paginate .pagination > li.active > span {
    background: #337ab7 !important;
    color: #fff !important;
    border-color: #2e6da4 !important;
}

.dataTables_paginate .pagination > li.disabled > a,
.dataTables_paginate .pagination > li.disabled > span {
    cursor: not-allowed !important;
    color: #999 !important;
    background: #f5f5f5 !important;
    border-color: #ddd !important;
}

.dataTables_paginate .pagination > li:first-child > a,
.dataTables_paginate .pagination > li:first-child > span {
    margin-left: 0 !important;
}

.dataTables_paginate .pagination > li:last-child > a,
.dataTables_paginate .pagination > li:last-child > span {
    margin-right: 0 !important;
}