/* ============================================
   MEDIKINDO THEME - Brand Colors Override
   Based on Medikindo Logo Colors
   ============================================ */

:root {
    /* Primary Color - Medikindo Navy Blue */
    --bs-primary: #1b4b7f;
    --bs-primary-rgb: 27, 75, 127;
    --bs-primary-light: #e8f0f8;
    --bs-primary-inverse: #ffffff;
    --bs-primary-active: #153a63;

    /* Secondary Color - Medikindo Teal/Cyan */
    --bs-secondary: #00a3a3;
    --bs-secondary-rgb: 0, 163, 163;
    --bs-secondary-light: #e6f7f7;
    --bs-secondary-inverse: #ffffff;

    /* Accent Color - Medikindo Gold/Yellow */
    --bs-warning: #f5a623;
    --bs-warning-rgb: 245, 166, 35;
    --bs-warning-light: #fef5e7;

    /* Keep other colors */
    --bs-success: #50cd89;
    --bs-danger: #f1416c;
    --bs-info: #7239ea;
}

/* ============================================
   PRIMARY COLOR OVERRIDES
   ============================================ */

/* Buttons */
.btn-primary {
    background-color: #1b4b7f !important;
    border-color: #1b4b7f !important;
    color: #ffffff !important;
}

.btn-primary:hover,
.btn-primary:focus,
.btn-primary:active {
    background-color: #153a63 !important;
    border-color: #153a63 !important;
    color: #ffffff !important;
}

.btn-light-primary {
    background-color: #e8f0f8 !important;
    border-color: #e8f0f8 !important;
    color: #1b4b7f !important;
}

.btn-light-primary:hover {
    background-color: #1b4b7f !important;
    border-color: #1b4b7f !important;
    color: #ffffff !important;
}

/* Badges */
.badge-primary {
    background-color: #1b4b7f !important;
    color: #ffffff !important;
}

.badge-light-primary {
    background-color: #e8f0f8 !important;
    color: #1b4b7f !important;
}

/* Text Colors */
.text-primary {
    color: #1b4b7f !important;
}

.text-hover-primary:hover {
    color: #1b4b7f !important;
}

/* Background Colors */
.bg-primary {
    background-color: #1b4b7f !important;
}

.bg-light-primary {
    background-color: #e8f0f8 !important;
}

/* Border Colors */
.border-primary {
    border-color: #1b4b7f !important;
}

/* Links */
a.text-primary:hover {
    color: #153a63 !important;
}

/* Active Menu Items */
.menu-link.active {
    background-color: #e8f0f8 !important;
    color: #1b4b7f !important;
}

.menu-link.active .menu-icon i {
    color: #1b4b7f !important;
}

/* Tabs */
.nav-tabs .nav-link.active {
    color: #1b4b7f !important;
    border-bottom-color: #1b4b7f !important;
}

.nav-line-tabs .nav-link.active {
    color: #1b4b7f !important;
    border-bottom-color: #1b4b7f !important;
}

/* Pagination */
.page-link:hover {
    color: #1b4b7f !important;
    background-color: #e8f0f8 !important;
    border-color: #1b4b7f !important;
}

.page-item.active .page-link {
    background-color: #1b4b7f !important;
    border-color: #1b4b7f !important;
}

/* Forms */
.form-control:focus,
.form-select:focus {
    border-color: #1b4b7f !important;
    box-shadow: 0 0 0 0.25rem rgba(27, 75, 127, 0.1) !important;
}

.form-check-input:checked {
    background-color: #1b4b7f !important;
    border-color: #1b4b7f !important;
}

/* Dropdown */
.dropdown-item:hover,
.dropdown-item:focus {
    background-color: #e8f0f8 !important;
    color: #1b4b7f !important;
}

/* Alerts */
.alert-primary {
    background-color: #e8f0f8 !important;
    border-color: #d1e2f0 !important;
    color: #1b4b7f !important;
}

/* Progress Bar */
.progress-bar {
    background-color: #1b4b7f !important;
}

/* Spinner */
.spinner-border-primary {
    color: #1b4b7f !important;
}

/* Symbol/Avatar */
.symbol-label.bg-light-primary {
    background-color: #e8f0f8 !important;
    color: #1b4b7f !important;
}

/* ============================================
   SIDEBAR LOGO STYLING - CONSISTENT ACROSS ALL LAYOUTS
   ============================================ */

/* Logo Container - Standardized */
#kt_app_sidebar_logo,
.app-sidebar-logo {
    padding: 1.25rem 1.5rem !important;
}

/* Logo Image - Fixed Size for Consistency */
#kt_app_sidebar_logo img,
.app-sidebar-logo img,
.app-sidebar-logo-default {
    width: auto !important;
    height: auto !important;
    max-height: 70px !important;
    max-width: 100% !important;
    object-fit: contain !important;
}

/* Responsive Logo */
@media (max-width: 991px) {
    #kt_app_sidebar_logo,
    .app-sidebar-logo {
        padding: 1rem 1.25rem !important;
    }

    #kt_app_sidebar_logo img,
    .app-sidebar-logo img,
    .app-sidebar-logo-default {
        max-height: 70px !important;
    }
}

@media (max-width: 767px) {
    #kt_app_sidebar_logo,
    .app-sidebar-logo {
        padding: 0.875rem 1rem !important;
    }

    #kt_app_sidebar_logo img,
    .app-sidebar-logo img,
    .app-sidebar-logo-default {
        max-height: 70px !important;
    }
}

/* ============================================
   SIDEBAR MENU STYLING
   ============================================ */

/* Active Menu Item with Brand Color */
.app-sidebar .menu .menu-item .menu-link.active {
    background-color: #e8f0f8;
    color: #1b4b7f;
}

.app-sidebar .menu .menu-item .menu-link.active .menu-icon {
    color: #1b4b7f;
}

.app-sidebar .menu .menu-item .menu-link.active .menu-title {
    color: #1b4b7f;
    font-weight: 600;
}

/* Hover State */
.app-sidebar .menu .menu-item .menu-link:hover:not(.active) {
    background-color: #f5f8fa;
    color: #1b4b7f;
}

.app-sidebar .menu .menu-item .menu-link:hover:not(.active) .menu-icon {
    color: #1b4b7f;
}

/* ============================================
   HEADER STYLING
   ============================================ */

/* Notification Badge */
.badge.badge-circle.badge-danger {
    background-color: #f1416c !important;
}

/* User Avatar in Header */
.app-navbar .symbol-label {
    background-color: #e8f0f8 !important;
    color: #1b4b7f !important;
    font-weight: 600;
}

/* ============================================
   DASHBOARD CARDS
   ============================================ */

/* Card with Primary Accent */
.card-primary-accent {
    border-left: 4px solid #1b4b7f;
}

.card-primary-accent .card-header {
    background-color: #e8f0f8;
}

/* ============================================
   CHARTS & ANALYTICS
   ============================================ */

/* Chart Primary Color */
.chart-primary {
    color: #1b4b7f;
}

/* ============================================
   TABLES
   ============================================ */

/* Table Row Hover (opt-in only) */
.table.table-hover-soft tbody tr:hover {
    background-color: #f8fafb;
}

/* Table Active Row */
.table tbody tr.table-active {
    background-color: #e8f0f8 !important;
}

/* ============================================
   MODALS
   ============================================ */

/* Modal Header with Primary */
.modal-header.bg-primary {
    background-color: #1b4b7f !important;
    color: #ffffff !important;
}

/* ============================================
   PRINT STYLES
   ============================================ */

@media print {
    .app-sidebar-logo img {
        max-height: 40px;
    }
}

/* ============================================
   ACTION DROPDOWN MENU - Table Row Actions
   ============================================ */

.action-menu-wrapper {
    position: relative;
    display: inline-flex;
    justify-content: flex-end;
}

.action-dropdown-menu {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    z-index: 9999;
    min-width: 180px;
    background: #ffffff;
    border: 1px solid #e4e6ef;
    border-radius: 0.475rem;
    padding: 0.5rem 0;
    /* Critical: must NOT be in document flow */
    float: none;
}

.action-dropdown-menu.show {
    display: block !important;
}

.action-dropdown-menu a,
.action-dropdown-menu button[type="submit"] {
    display: flex;
    align-items: center;
    padding: 0.65rem 1rem;
    color: #3f4254;
    font-size: 0.85rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    width: 100%;
    background: none;
    border: none;
    text-align: left;
    transition: background-color 0.15s;
    white-space: nowrap;
}

/* Form wrapper inside dropdown must not add spacing */
.action-dropdown-menu form {
    margin: 0;
    padding: 0;
    display: block;
}

.action-dropdown-menu a:hover,
.action-dropdown-menu button[type="submit"]:hover {
    background-color: #f1f3f8;
    color: #1b4b7f;
}

.action-dropdown-menu button.text-danger:hover {
    background-color: #fff5f8;
    color: #f1416c !important;
}

.action-dropdown-menu button.text-warning:hover {
    background-color: #fff8dd;
    color: #ffc700 !important;
}

.action-dropdown-menu button.text-success:hover {
    background-color: #e8fff3;
    color: #17c653 !important;
}

.action-dropdown-menu .separator {
    border-top: 1px solid #e4e6ef;
    margin: 0.25rem 0;
}

.action-dropdown-menu .menu-item {
    padding: 0;
}

/* ============================================
   DARK COLOR OVERRIDES
   Replace black/dark with Medikindo brand colors
   ============================================ */

/* badge-dark → Medikindo Deep Red (for 90+ aging) */
.badge-dark,
.badge.badge-dark {
    background-color: #b5001e !important;
    color: #ffffff !important;
}

.badge-light-dark {
    background-color: #fde8ec !important;
    color: #b5001e !important;
}

/* bg-dark cards → Medikindo Navy gradient */
.card.bg-dark,
.bg-dark {
    background: linear-gradient(135deg, #1b4b7f 0%, #153a63 100%) !important;
    color: #ffffff !important;
}

/* bg-gray-900 → Medikindo Navy */
.bg-gray-900 {
    background-color: #1b4b7f !important;
}

/* text-dark → Medikindo Navy (for headings) */
.text-dark {
    color: #1b4b7f !important;
}

/* Aging bucket: 90+ days — deep red */
.aging-critical {
    background-color: #b5001e !important;
    color: #ffffff !important;
}

/* Invoice total card — navy gradient */
.card-invoice-total {
    background: linear-gradient(135deg, #1b4b7f 0%, #153a63 100%) !important;
}

/* AR Aging grand total bar */
.ar-aging-total-bar {
    background: linear-gradient(135deg, #1b4b7f 0%, #153a63 100%) !important;
}
