/* MK Software â€” AdminLTE 3 custom styles + MK branding */

:root {
    --mk-primary: #1e3a5f;
    --mk-primary-light: #2c5282;
    --mk-accent: #3182ce;
}

/* Branding */
.brand-link-nav {
    display: flex;
    align-items: center;
    font-weight: 600;
    color: var(--mk-primary) !important;
}

.brand-logo-nav {
    width: 28px;
    height: 28px;
    border-radius: 6px;
}

.mk-sidebar .nav-sidebar > .nav-item > .nav-link.active {
    background-color: var(--mk-accent);
    color: #fff;
}

.sidebar-dark-navy .nav-sidebar > .nav-item > .nav-link.active {
    background-color: rgba(255, 255, 255, 0.15);
    color: #fff;
}

.btn-primary {
    background-color: var(--mk-accent);
    border-color: var(--mk-accent);
}

.btn-primary:hover,
.btn-primary:focus {
    background-color: var(--mk-primary-light);
    border-color: var(--mk-primary-light);
}

.small-box.bg-primary {
    background-color: var(--mk-accent) !important;
}

.content-wrapper {
    background-color: #f4f6f9;
}

.dark-mode .content-wrapper {
    background-color: #454d55;
}

.dark-mode .card,
.dark-mode .modal-content {
    background-color: #343a40;
    color: #f8f9fa;
}

.dark-mode .table {
    color: #e9ecef;
}

.dark-mode .table thead th {
    background-color: #3f474e;
    border-color: #4b545c;
}

.dark-mode .table-bordered,
.dark-mode .table-bordered td,
.dark-mode .table-bordered th {
    border-color: #4b545c;
}

.dark-mode .form-control,
.dark-mode .custom-select,
.dark-mode .custom-file-label {
    background-color: #3f474e;
    border-color: #56606a;
    color: #f8f9fa;
}

.dark-mode .detail-table th {
    background-color: #3f474e;
}

.dark-mode .entry-chat-messages,
.dark-mode .floating-chat-messages {
    background: #2d3339;
}

.dark-mode .chat-message p {
    background: #3f474e;
    border-color: #56606a;
    color: #f8f9fa;
}

.dark-mode .chat-message.mine p {
    background: var(--mk-accent);
    border-color: var(--mk-accent);
}

.dark-mode .login-page {
    background: #343a40;
}

.dark-mode .login-card-body,
.dark-mode .login-logo a {
    color: #f8f9fa;
}

/* DataTables polish */
.dataTables_wrapper .dataTables_filter input {
    border-radius: 0.25rem;
    border: 1px solid #ced4da;
    padding: 0.25rem 0.5rem;
    margin-left: 0.35rem;
}

.dataTables_wrapper .dataTables_length select {
    border-radius: 0.25rem;
    padding: 0.15rem 0.35rem;
    margin: 0 0.35rem;
}

.card .dataTables_wrapper {
    padding: 0 1rem 1rem;
}

/* Toastr above chat widget */
#toast-container {
    z-index: 99999;
}

.field-hint {
    font-size: 0.85rem;
    color: #6c757d;
    margin-top: -0.25rem;
    margin-bottom: 0.75rem;
}

.field-hint ol,
.field-hint ul {
    padding-left: 1.25rem;
    margin-bottom: 0.5rem;
}

.empty-state {
    text-align: center;
    padding: 2rem 1rem;
    color: #6c757d;
}

.muted-text,
.text-muted {
    color: #6c757d !important;
}

/* Analytics charts */
.analytics-bars {
    padding: 1.25rem;
}

.analytics-bar-row {
    display: grid;
    grid-template-columns: 100px 1fr 40px;
    gap: 0.5rem;
    align-items: center;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.analytics-bar-track {
    height: 8px;
    background: #e9ecef;
    border-radius: 4px;
    overflow: hidden;
}

.analytics-bar-fill {
    height: 100%;
    background: #007bff;
    border-radius: 4px;
}

.analytics-bar-fill.analytics-bar-muted { background: #6c757d; }
.analytics-bar-fill.analytics-bar-green { background: #28a745; }

.analytics-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.analytics-list li {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid #dee2e6;
}

.ai-stat-row {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    font-size: 0.9rem;
}

.ai-issue-list {
    padding-left: 1.25rem;
    margin: 0;
}

/* Entry view */
.operator-ip-highlight {
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 0.25rem;
    padding: 0.75rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.detail-table th {
    width: 35%;
    background-color: #f8f9fa;
}

/* Operator add panel */
.operator-add-panel summary {
    list-style: none;
}

.operator-add-panel summary::-webkit-details-marker {
    display: none;
}

/* QR payment */
.qr-frame {
    width: 180px;
    height: 180px;
    border: 2px dashed #dee2e6;
    border-radius: 0.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: #f8f9fa;
}

.qr-frame img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.qr-frame span {
    text-align: center;
    font-size: 0.85rem;
    color: #6c757d;
    display: none;
}

.qr-payment-box,
.qr-admin-box {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    align-items: flex-start;
    margin-bottom: 1.5rem;
}

.wallet-form,
.wallet-request-form {
    max-width: 480px;
}

.wallet-review-form .review-actions {
    display: flex;
    gap: 0.35rem;
    margin-top: 0.35rem;
}

.entry-actions-stack {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.entry-row-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.table-link {
    color: #007bff;
}

.table-link:hover {
    text-decoration: underline;
}

/* Chat */
.entry-chat-messages,
.floating-chat-messages {
    height: 280px;
    overflow-y: auto;
    background: #f4f6f9;
}

.chat-message {
    margin-bottom: 0.75rem;
    max-width: 85%;
}

.chat-message.mine {
    margin-left: auto;
    text-align: right;
}

.chat-message .message-meta {
    font-size: 0.75rem;
    color: #6c757d;
    margin-bottom: 0.15rem;
}

.chat-message.mine .message-meta strong {
    display: none;
}

.chat-message p {
    display: inline-block;
    margin: 0;
    padding: 0.5rem 0.75rem;
    border-radius: 0.5rem;
    background: #fff;
    border: 1px solid #dee2e6;
    text-align: left;
}

.chat-message.mine p {
    background: #007bff;
    color: #fff;
    border-color: #007bff;
}

.entry-chat-form,
.floating-chat-form {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.entry-chat-form input,
.floating-chat-form input {
    flex: 1;
    margin-bottom: 0;
}

.ai-chat-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-top: 0.35rem;
}

/* Floating chat widget */
.floating-chat {
    position: fixed;
    right: 1rem;
    bottom: 1rem;
    z-index: 1040;
}

.floating-chat.is-minimized .floating-chat-box {
    display: none;
}

.floating-chat-box {
    width: 340px;
    max-width: calc(100vw - 2rem);
    overflow: hidden;
}

.floating-chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #fff;
}

.floating-chat-header span {
    display: block;
    font-size: 0.75rem;
    opacity: 0.85;
}

.chat-launcher {
    position: relative;
}

.chat-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    font-size: 0.65rem;
}

.chat-launcher.has-unread,
.nav-link.has-unread {
    animation: pulse-chat 2s infinite;
}

@keyframes pulse-chat {
    0%, 100% { box-shadow: 0 0 0 0 rgba(0, 123, 255, 0.5); }
    50% { box-shadow: 0 0 0 8px rgba(0, 123, 255, 0); }
}

/* Entry notification popup */
.entry-notification {
    position: fixed;
    top: 70px;
    right: 1rem;
    z-index: 1060;
    width: 280px;
    padding: 1rem;
    background: #343a40;
    color: #fff;
    border-radius: 0.25rem;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.3);
    transform: translateX(120%);
    transition: transform 0.3s ease;
}

.entry-notification.is-visible {
    transform: translateX(0);
}

.entry-notification-close {
    position: absolute;
    top: 0.35rem;
    right: 0.5rem;
    background: none;
    border: none;
    color: #fff;
    font-size: 1.25rem;
    cursor: pointer;
    line-height: 1;
}

.entry-notification strong {
    display: block;
    font-size: 0.85rem;
    color: #ffc107;
    margin-bottom: 0.25rem;
}

.entry-notification span {
    display: block;
    font-weight: 600;
}

.entry-notification small {
    display: block;
    opacity: 0.85;
    margin-top: 0.25rem;
    font-size: 0.8rem;
}

/* Login page */
.login-page .login-box {
    width: 400px;
    max-width: 92vw;
}

.login-logo img {
    max-height: 64px;
    margin-bottom: 0.5rem;
}

/* Card tables â€” AdminLTE style */
.card .table thead th {
    border-top: 0;
    background-color: #f8f9fa;
}

.content-header h1 {
    font-size: 1.6rem;
}

@media (max-width: 767.98px) {
    .floating-chat-box {
        width: calc(100vw - 2rem);
    }

    .analytics-bar-row {
        grid-template-columns: 80px 1fr 32px;
        font-size: 0.8rem;
    }
}

.entry-status-highlight {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 140px;
    padding: 0.65rem 1rem;
    border-radius: 999px;
    font-size: 1.15rem;
    font-weight: 800;
    letter-spacing: 0;
    text-transform: uppercase;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.16);
}

.detail-table td .entry-status-highlight {
    margin: 0.15rem 0;
}