/**
 * JLS Server Admin - Custom Styles
 * Mobile-first responsive design
 */

/* Base Styles */
body {
    font-size: 16px;
    line-height: 1.6;
}

/* Ensure proper spacing on mobile */
@media (max-width: 767px) {
    body {
        font-size: 14px;
    }

    h1 {
        font-size: 1.75rem;
    }

    h2 {
        font-size: 1.5rem;
    }

    .container-fluid {
        padding-left: 10px;
        padding-right: 10px;
    }
}

/* Touch-friendly buttons */
.btn {
    min-height: 44px;
    padding: 0.5rem 1rem;
}

.btn-sm {
    min-height: 38px;
    padding: 0.375rem 0.75rem;
}

/* Card styling */
.card {
    border-radius: 8px;
    margin-bottom: 1.5rem;
}

.card-header {
    border-radius: 8px 8px 0 0;
}

/* Table responsiveness */
.table-responsive {
    border-radius: 8px;
}

@media (max-width: 767px) {
    .table {
        font-size: 0.875rem;
    }

    .table td,
    .table th {
        padding: 0.5rem;
    }
}

/* Navbar */
.navbar-brand {
    font-weight: bold;
}

@media (max-width: 991px) {
    .navbar-collapse {
        background-color: rgba(0, 0, 0, 0.1);
        padding: 1rem;
        border-radius: 8px;
        margin-top: 0.5rem;
    }
}

/* Statistics Cards */
.opacity-50 {
    opacity: 0.5;
}

/* Forms */
.form-control,
.form-select {
    min-height: 44px;
}

.form-control-sm {
    min-height: 38px;
}

/* Alert styling */
.alert {
    border-radius: 8px;
}

/* Fixed toast notification (shown on AJAX response regardless of scroll position) */
#flash-toast-container {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    min-width: 320px;
    max-width: 540px;
    width: max-content;
    pointer-events: none;
}

#flash-toast-container .alert {
    pointer-events: auto;
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.18);
    animation: flashToastIn 0.25s ease;
    margin-bottom: 0;
}

@keyframes flashToastIn {
    from { opacity: 0; transform: translateY(-12px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Badge styling */
.badge {
    padding: 0.35em 0.65em;
    font-size: 85%;
}

/* Footer */
footer {
    border-top: 1px solid #dee2e6;
    margin-top: 3rem;
}

/* Code blocks */
code {
    padding: 0.2rem 0.4rem;
    background-color: #f8f9fa;
    border-radius: 4px;
}

/* Loading spinner */
.spinner-border-sm {
    width: 1rem;
    height: 1rem;
    border-width: 0.15em;
}

/* Custom utilities */
.bg-opacity-25 {
    background-color: rgba(0, 0, 0, 0.25) !important;
}

/* Ensure dropdown menus are readable on mobile */
@media (max-width: 767px) {
    .dropdown-menu {
        font-size: 0.9rem;
    }
}

/* Status indicators */
.status-active {
    color: #28a745;
}

.status-inactive {
    color: #6c757d;
}

/* Pagination */
.pagination {
    flex-wrap: wrap;
}

.page-link {
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Mobile-friendly list groups */
@media (max-width: 767px) {
    .list-group-item {
        padding: 1rem 0.75rem;
    }
}

/* Responsive text */
.text-md-left {
    text-align: left !important;
}

.text-md-right {
    text-align: right !important;
}

@media (max-width: 767px) {
    .text-md-left,
    .text-md-right {
        text-align: center !important;
    }
}

/* No horizontal scroll */
body {
    overflow-x: hidden;
}

.row {
    margin-left: 0;
    margin-right: 0;
}

/* Accessibility */
a:focus,
button:focus,
input:focus,
select:focus,
textarea:focus {
    outline: 2px solid #007bff;
    outline-offset: 2px;
}

/* Print styles */
@media print {
    .navbar,
    .btn,
    footer {
        display: none;
    }
}

/* Server Stats Bar */
#server-stats-container {
    font-size: 0.9rem;
}

#server-stats-container small {
    font-size: 0.75rem;
    font-weight: normal;
}

#server-stats-container strong {
    font-size: 1rem;
    white-space: nowrap;
}

/* Mobile adjustments for server stats */
@media (max-width: 767px) {
    #server-stats-container {
        font-size: 0.85rem;
    }

    #server-stats-container strong {
        font-size: 0.9rem;
    }

    #server-stats-container small {
        font-size: 0.7rem;
    }
}

/* Server stats color indicators */
#server-stats-container .text-warning {
    color: #ffc107 !important;
}

#server-stats-container .text-danger {
    color: #dc3545 !important;
}

/* ------------------------------------------------------------------
   Admin menu: nested flyout submenus
   Desktop (>=992px): flyout to the right on hover (or click/tap)
   Mobile (collapsed navbar): tap to expand inline as an accordion
   ------------------------------------------------------------------ */
.dropdown-submenu {
    position: relative;
}

.dropdown-submenu > .dropdown-menu {
    display: none;
    top: -0.5rem;
    left: 100%;
    margin-top: 0;
    margin-left: 0;
}

.dropdown-submenu-toggle {
    position: relative;
    padding-right: 2rem;
}

.dropdown-submenu-toggle::after {
    content: "\f054"; /* fa-chevron-right */
    font-family: "Font Awesome 5 Free";
    font-weight: 900;
    font-size: 0.7rem;
    position: absolute;
    right: 0.9rem;
    top: 50%;
    transform: translateY(-50%);
    transition: transform 0.15s ease;
    opacity: 0.6;
}

.dropdown-submenu.show > .dropdown-submenu-toggle,
.dropdown-submenu:hover > .dropdown-submenu-toggle {
    background-color: #e9ecef;
}

@media (min-width: 992px) {
    .dropdown-submenu:hover > .dropdown-menu,
    .dropdown-submenu.show > .dropdown-menu {
        display: block;
    }
}

@media (max-width: 991.98px) {
    .dropdown-submenu > .dropdown-menu {
        position: static;
        float: none;
        border: 0;
        box-shadow: none;
        margin: 0;
        padding: 0 0 0.25rem 1rem;
        background-color: transparent;
    }

    .dropdown-submenu.show > .dropdown-menu {
        display: block;
    }

    .dropdown-submenu-toggle::after {
        transform: translateY(-50%) rotate(90deg);
    }

    .dropdown-submenu.show > .dropdown-submenu-toggle::after {
        transform: translateY(-50%) rotate(-90deg);
    }

    .dropdown-submenu:hover:not(.show) > .dropdown-submenu-toggle {
        background-color: transparent;
    }
}
