/* Aurora-like Theme */
body {
    background-color: #1a1b26; /* Dark background */
    color: #a9b1d6; /* Light text */
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    display: flex;
}

.mobile-topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1040;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    background: rgba(31, 32, 46, 0.96);
    border-bottom: 1px solid rgba(65, 72, 104, 0.9);
    backdrop-filter: blur(12px);
}

.sidebar {
    width: 250px;
    background-color: #1f202e;
    padding: 20px;
    height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
}

.sidebar h2 {
    color: #c0caf5;
    text-align: center;
    margin-bottom: 30px;
}

.sidebar .nav-link {
    color: #a9b1d6;
    font-size: 1.1rem;
    margin-bottom: 10px;
}

.sidebar .nav-link.active, .sidebar .nav-link:hover {
    color: #7aa2f7; /* Blue for active/hover links */
    background-color: #2a2b3d;
    border-radius: 5px;
}

.main-content {
    margin-left: 250px;
    padding: 30px;
    width: calc(100% - 250px);
}

.sidebar .offcanvas-body {
    overflow-y: auto;
}

.card {
    background-color: #24283b;
    border: 1px solid #414868;
}

.card-header {
    background-color: #2a2b3d;
    color: #c0caf5;
    border-bottom: 1px solid #414868;
}

.table {
    color: #a9b1d6;
}

.table thead th {
    border-bottom-color: #414868;
    color: #c0caf5;
}

.table-striped > tbody > tr:nth-of-type(odd) > * {
    --bs-table-accent-bg: #2a2b3d;
    color: #a9b1d6;
}

.service-status-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 6.5rem;
    padding: 0.35rem 0.7rem;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    border: 1px solid transparent;
}

.service-status-running {
    background-color: rgba(115, 218, 202, 0.16);
    border-color: rgba(115, 218, 202, 0.45);
    color: #73daca;
}

.service-status-stopped {
    background-color: rgba(122, 162, 247, 0.14);
    border-color: rgba(122, 162, 247, 0.38);
    color: #9eceff;
}

.service-status-expired {
    background-color: rgba(247, 118, 142, 0.16);
    border-color: rgba(247, 118, 142, 0.42);
    color: #f7768e;
}

.service-status-line-expired {
    background: linear-gradient(135deg, rgba(255, 179, 71, 0.28), rgba(224, 175, 104, 0.44));
    border-color: rgba(255, 179, 71, 0.7);
    color: #ffe1a6;
    box-shadow: 0 0 0 1px rgba(255, 179, 71, 0.18), 0 8px 24px rgba(224, 175, 104, 0.12);
}

.service-status-danger {
    background-color: rgba(247, 118, 142, 0.16);
    border-color: rgba(247, 118, 142, 0.42);
    color: #f7768e;
}

.service-status-secondary {
    background-color: rgba(169, 177, 214, 0.1);
    border-color: rgba(169, 177, 214, 0.28);
    color: #c0caf5;
}

.service-line-expired-row > * {
    background-color: rgba(224, 175, 104, 0.22) !important;
    border-top-color: rgba(255, 179, 71, 0.28) !important;
    border-bottom-color: rgba(255, 179, 71, 0.28) !important;
}

.service-line-expired-row:hover > * {
    background-color: rgba(224, 175, 104, 0.28) !important;
}

.service-line-expired-row > td:first-child {
    box-shadow: inset 4px 0 0 #ffb347;
}

.service-line-expired-row .connectivity-entry-status,
.service-line-expired-row .connectivity-backend-status {
    color: #e0af68 !important;
}

.service-line-expired-badge {
    align-self: flex-start;
    font-weight: 600;
}

.service-line-expired-row td:nth-child(4),
.service-line-expired-row td:nth-child(5) {
    color: #ffe1a6;
}

.form-control {
    background-color: #1f202e;
    color: #a9b1d6;
    border-color: #414868;
}

.form-control:focus {
    background-color: #1f202e;
    color: #a9b1d6;
    border-color: #7aa2f7;
    box-shadow: 0 0 0 0.25rem rgba(122, 162, 247, 0.25);
}

.btn-primary {
    background-color: #7aa2f7;
    border-color: #7aa2f7;
}

.btn-primary:hover {
    background-color: #5d8af0;
    border-color: #5d8af0;
}

.flash-messages .alert-success {
    background-color: #2e4d5d;
    color: #73daca;
    border-color: #3b6b7a;
}

.flash-messages .alert-danger {
    background-color: #5d3a43;
    color: #f7768e;
    border-color: #7a4f59;
}

.flash-messages .alert-warning {
    background-color: #6a5c43;
    color: #e0af68;
    border-color: #8b7959;
}

.services-table td,
.services-table th {
    vertical-align: top;
}

.services-header-actions,
.services-toolbar-meta {
    min-width: 0;
}

.services-toolbar-copy {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
    justify-content: space-between;
}

.services-table .btn-group {
    flex-wrap: nowrap;
}

.stack-mobile-table td,
.stack-mobile-table th {
    vertical-align: top;
}

.mobile-action-cluster {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
    justify-content: space-between;
}

.mobile-quick-actions {
    position: sticky;
    bottom: 0.75rem;
    z-index: 1030;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
    margin-top: 1rem;
    padding: 0.9rem;
    border: 1px solid rgba(122, 162, 247, 0.24);
    border-radius: 1rem;
    background: rgba(26, 27, 38, 0.92);
    backdrop-filter: blur(14px);
    box-shadow: 0 18px 36px rgba(15, 18, 38, 0.28);
}

.mobile-quick-actions .btn {
    width: 100%;
}

.mobile-quick-actions-spacer {
    height: 0.5rem;
}

.ops-summary-card {
    min-height: 100%;
}

.ops-filter-card {
    border-style: dashed;
    border-color: rgba(122, 162, 247, 0.3);
}

.ops-summary-card .card-body {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.ops-mini-stat-card {
    min-height: 100%;
}

.ops-mini-stat-card .card-body {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.ops-summary-label {
    font-size: 0.85rem;
    letter-spacing: 0.03em;
    color: #9aa5ce;
}

.ops-summary-value {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1;
    color: #f6f7ff;
}

.ops-mini-stat-value {
    font-size: 1.45rem;
    font-weight: 700;
    line-height: 1.1;
    color: #f6f7ff;
}

.ops-summary-subtext {
    font-size: 0.88rem;
    color: #c0caf5;
}

.ops-summary-danger {
    border-color: rgba(247, 118, 142, 0.35);
    box-shadow: inset 0 0 0 1px rgba(247, 118, 142, 0.08);
}

.ops-summary-warning {
    border-color: rgba(224, 175, 104, 0.35);
    box-shadow: inset 0 0 0 1px rgba(224, 175, 104, 0.08);
}

.ops-summary-info {
    border-color: rgba(122, 162, 247, 0.35);
    box-shadow: inset 0 0 0 1px rgba(122, 162, 247, 0.08);
}

.ops-summary-secondary {
    border-color: rgba(115, 218, 202, 0.35);
    box-shadow: inset 0 0 0 1px rgba(115, 218, 202, 0.08);
}

.ops-table td,
.ops-table th {
    vertical-align: top;
}

.ops-chip {
    background: rgba(122, 162, 247, 0.16);
    border: 1px solid rgba(122, 162, 247, 0.35);
    color: #c0caf5;
    font-weight: 500;
}

.ops-event-message {
    white-space: pre-wrap;
    word-break: break-word;
    background: rgba(31, 32, 46, 0.8);
    border: 1px solid #414868;
    border-radius: 0.5rem;
    color: #c0caf5;
    padding: 0.75rem;
    margin: 0.5rem 0 0;
    font-size: 0.82rem;
}

@media (max-width: 991.98px) {
    body {
        display: block;
    }

    .sidebar {
        width: min(88vw, 320px);
        height: 100vh;
        padding: 1.25rem 1rem;
        border-right: 1px solid #414868;
    }

    .sidebar h2 {
        display: none;
    }

    .main-content {
        margin-left: 0;
        width: 100%;
        padding: 5rem 1rem 1.25rem;
    }

    .flash-messages {
        left: 0;
        right: 0;
        width: min(100%, 30rem);
        margin: 0 auto;
    }
}

@media (max-width: 767.98px) {
    .main-content h1 {
        font-size: 1.65rem;
        line-height: 1.2;
    }

    .card-header,
    .card-body {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .services-header-actions,
    .services-toolbar-meta,
    .services-toolbar-copy {
        width: 100%;
    }

    .services-header-actions .btn,
    .services-toolbar-copy .btn,
    .services-toolbar-meta .btn-group {
        width: 100%;
    }

    .services-toolbar-meta .btn-group {
        display: grid;
        grid-template-columns: 1fr 1fr;
    }

    .services-table {
        border-collapse: separate;
        border-spacing: 0 0.85rem;
    }

    .services-table thead {
        display: none;
    }

    .services-table tbody,
    .services-table tr,
    .services-table td {
        display: block;
        width: 100%;
    }

    .services-table tr {
        border: 1px solid #414868;
        border-radius: 1rem;
        overflow: hidden;
        background: #24283b;
        box-shadow: 0 12px 28px rgba(15, 18, 38, 0.28);
    }

    .services-table tr + tr {
        margin-top: 0.75rem;
    }

    .services-table td {
        border: 0;
        padding: 0.75rem 0.9rem;
    }

    .services-table td[data-label]::before {
        content: attr(data-label);
        display: block;
        margin-bottom: 0.35rem;
        color: #7aa2f7;
        font-size: 0.78rem;
        font-weight: 700;
        letter-spacing: 0.03em;
        text-transform: uppercase;
    }

    .services-table td:first-child::before {
        margin-bottom: 0;
    }

    .services-table td:last-child {
        padding-bottom: 1rem;
    }

    .services-table .btn-group {
        display: grid;
        grid-template-columns: repeat(4, minmax(0, 1fr));
        width: 100%;
    }

    .services-table .toggle-line-expired-btn {
        width: 100%;
    }

    .services-table .connectivity-status-cell .d-flex.flex-wrap.gap-1 {
        display: grid !important;
        grid-template-columns: 1fr 1fr;
    }

    .services-table .connectivity-status-cell .btn {
        width: 100%;
    }

    .mobile-page-header,
    .mobile-action-cluster {
        width: 100%;
    }

    .mobile-page-header .btn,
    .mobile-action-cluster .btn,
    .mobile-action-cluster form,
    .mobile-action-cluster .btn-group {
        width: 100%;
    }

    .mobile-action-cluster form .btn {
        width: 100%;
    }

    .mobile-quick-actions {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .stack-mobile-table {
        border-collapse: separate;
        border-spacing: 0 0.85rem;
    }

    .stack-mobile-table thead {
        display: none;
    }

    .stack-mobile-table tbody,
    .stack-mobile-table tr,
    .stack-mobile-table td {
        display: block;
        width: 100%;
    }

    .stack-mobile-table tr {
        border: 1px solid #414868;
        border-radius: 1rem;
        overflow: hidden;
        background: #24283b;
        box-shadow: 0 12px 28px rgba(15, 18, 38, 0.28);
    }

    .stack-mobile-table td {
        border: 0;
        padding: 0.75rem 0.9rem;
    }

    .stack-mobile-table td[data-label]::before {
        content: attr(data-label);
        display: block;
        margin-bottom: 0.35rem;
        color: #7aa2f7;
        font-size: 0.78rem;
        font-weight: 700;
        letter-spacing: 0.03em;
        text-transform: uppercase;
    }

    .stack-mobile-table td:last-child {
        padding-bottom: 1rem;
    }
}

.dashboard-card-meta {
    word-break: break-word;
}

.dashboard-metric-card .card-header {
    gap: 0.75rem;
}

.dashboard-metric-card .dash-status {
    white-space: nowrap;
}

.ops-table td,
.ops-table th {
    vertical-align: top;
}

.login-page {
    background:
        radial-gradient(circle at top left, rgba(122, 162, 247, 0.18), transparent 32%),
        radial-gradient(circle at bottom right, rgba(158, 206, 106, 0.14), transparent 30%),
        #1a1b26;
    padding: 1.5rem 0;
}

.login-card {
    background: rgba(36, 40, 59, 0.92);
    backdrop-filter: blur(12px);
}

@media (max-width: 767.98px) {
    .login-shell {
        max-width: 100% !important;
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .login-card .card-body {
        padding: 1.5rem 1.15rem !important;
    }

    .modal-dialog {
        margin: 0.75rem;
    }

    .modal-content {
        border-radius: 1rem;
    }
}
