/* assets/css/custom.css */

/* Global Colors (Corporate) */
:root {
    --corporate-red: #E81E2B;
    --corporate-blue: #0055DD;
}

/* Minimalist Sidebar Active State */
.sidebar-dark-primary .nav-sidebar>.nav-item>.nav-link.active,
.sidebar-light-primary .nav-sidebar>.nav-item>.nav-link.active,
.sidebar-dark-danger .nav-sidebar>.nav-item>.nav-link.active,
.sidebar-light-danger .nav-sidebar>.nav-item>.nav-link.active {
    background-color: transparent !important;
    color: var(--corporate-red) !important;
    box-shadow: none !important;
    font-weight: bold;
}

/* Icon Color in Active State */
.nav-sidebar>.nav-item>.nav-link.active>i {
    color: var(--corporate-red) !important;
}

/* Hover State */
.nav-sidebar .nav-item>.nav-link:hover {
    color: var(--corporate-red) !important;
}

/* Minimalist Network Dot */
.status-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 5px;
    vertical-align: middle;
}

.status-online {
    background-color: #28a745;
    box-shadow: 0 0 5px #28a745;
}

.status-offline {
    background-color: #dc3545;
    box-shadow: 0 0 5px #dc3545;
}

.network-banner {
    display: none;
    background-color: #dc3545;
    color: white;
    text-align: center;
    padding: 5px;
    font-weight: bold;
    position: sticky;
    top: 0;
    z-index: 1050;
}

/* ======================================
   MOBILE OPTIMIZATIONS
   ====================================== */

/* Touch-friendly buttons */
@media (max-width: 768px) {
    .btn {
        padding: 0.5rem 1rem;
        font-size: 0.95rem;
        min-height: 44px;
        /* iOS recommendation for touch targets */
    }

    /* Responsive tables */
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Stack small boxes vertically on mobile */
    .small-box {
        margin-bottom: 15px;
    }

    /* Make form inputs larger for mobile */
    .form-control {
        font-size: 16px;
        /* Prevents zoom on iOS */
        min-height: 44px;
    }

    /* Adjust modal padding */
    .modal-body {
        padding: 1rem;
    }

    /* Better chart sizing on mobile */
    canvas {
        max-width: 100% !important;
        height: auto !important;
    }

    /* Adjust card padding */
    .card-body {
        padding: 0.75rem;
    }

    /* Network banner more prominent on mobile */
    .network-banner {
        font-size: 0.85rem;
        padding: 8px;
    }
}

/* Extra small devices (phones) */
@media (max-width: 576px) {

    /* Hide widget icons on very small screens */
    .small-box .icon {
        font-size: 50px;
    }

    /* Reduce heading sizes */
    h1 {
        font-size: 1.5rem !important;
    }

    h3 {
        font-size: 1.2rem !important;
    }

    /* Stack action buttons */
    .content-header .text-right {
        text-align: left !important;
        margin-top: 10px;
    }

    .content-header .btn {
        display: block;
        width: 100%;
        margin-bottom: 5px;
    }

    /* Mobile-friendly table: Convert to cards */
    .table-responsive {
        border: none;
    }

    .table thead {
        display: none;
        /* Hide table headers on mobile */
    }

    .table tbody tr {
        display: block;
        margin-bottom: 15px;
        border: 1px solid #dee2e6;
        border-radius: 5px;
        background: white;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    }

    .table tbody td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 12px 15px;
        border: none;
        border-bottom: 1px solid #f4f4f4;
    }

    .table tbody td:last-child {
        border-bottom: none;
    }

    /* Add labels for mobile */
    .table tbody td::before {
        content: attr(data-label);
        font-weight: bold;
        margin-right: 10px;
        color: #6c757d;
        min-width: 80px;
    }

    .table tbody td:last-child {
        justify-content: flex-end;
    }

    .table tbody td:last-child::before {
        content: '';
        margin: 0;
    }
}

/* Notifications UI Refinement */
.dropdown-menu-lg {
    max-width: 320px !important;
}

.navbar-badge {
    top: 5px !important;
    right: 5px !important;
}

#notif-list .dropdown-item {
    white-space: normal !important;
    padding-top: 10px !important;
    padding-bottom: 10px !important;
}

#notif-list .dropdown-item-title {
    font-size: 0.95rem !important;
    white-space: normal !important;
    line-height: 1.2;
    margin-bottom: 3px;
    display: block !important;
    word-break: break-word !important;
}

#notif-list .media-body {
    overflow: hidden;
    max-width: 100% !important;
}

#notif-list .text-sm {
    white-space: normal !important;
    color: #6c757d;
    word-break: break-word !important;
}

/* Larger screens - normal table */
@media (min-width: 577px) {
    .table thead {
        display: table-header-group !important;
    }

    .table tbody tr {
        display: table-row !important;
    }

    .table tbody td {
        display: table-cell !important;
    }

    .table tbody td::before {
        display: none !important;
    }
}