/**
 * ConfigSentry - Global Styles
 * Shared across all authenticated and public pages
 */
 
/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    margin: 0;
    scrollbar-gutter: stable;
    overflow-x: hidden; /* needed so header doesn't move on scroll in mobile */
}

:root {
    --top-header-height: 54px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, Arial, Helvetica, sans-serif;
    background-color: #f8f9fa;
    color: #333;
    min-width: 340px;
    
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    padding-top: var(--top-header-height); /* holds main header only */
}

/* Header */
.top-header {
    Xbackground-color: rgba(255, 255, 255, 0.95);
    background-color: #0f172a;
    border-bottom: 1px solid #e0e0e0;
    padding: 0 10px;
    display: flex;
    justify-content: flex-start;
    align-items: center;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    width: auto;
    min-height: 54px;
    z-index: 1000;
}

.header-branding {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    flex-wrap: nowrap;
    min-width: 0;
    flex: 1 1 auto;
}

main {
    flex: 1 0 auto;
}

footer {
    flex-shrink: 0;
    position: static;
    
    width: 100%;
    padding: 20px;
    text-align: center;
    line-height: 1.5em;
}

input[readonly], input[readonly]:focus,
textarea[readonly], textarea[readonly]:focus,
textarea:disabled, textarea:disabled:focus,
.form-control[readonly], .form-control[readonly]:focus,
.form-control:disabled,
.form-select:disabled {
    background-color: #e9ecef !important;
    color: #212529 !important;
    opacity: 1 !important;
}

.dropdown button {
    border-radius: var(--bs-border-radius) !important;
}

.dropdown .btn-outline-secondary.dropdown-toggle:not([disabled]):not([data-readonly-dropdown="true"]),
.dropdown .btn-outline-secondary.dropdown-toggle:not([disabled]):not([data-readonly-dropdown="true"]):focus,
.dropdown .btn-outline-secondary.dropdown-toggle:not([disabled]):not([data-readonly-dropdown="true"]):hover,
.dropdown .btn-outline-secondary.dropdown-toggle:not([disabled]):not([data-readonly-dropdown="true"]):active {
    color: #212529 !important;
}

.dropdown button[disabled],
.dropdown .dropdown-toggle[data-readonly-dropdown="true"],
.dropdown .dropdown-toggle[data-readonly-dropdown="true"]:focus,
.dropdown .dropdown-toggle[data-readonly-dropdown="true"]:hover {
    background-color: #e9ecef !important;
    color: #212529 !important;
    border-color: #ced4da !important;
    opacity: 1 !important;
    box-shadow: none !important;
    background-image: none !important;
}

.dropdown .dropdown-toggle[data-readonly-dropdown="true"] {
    cursor: pointer;
}

.dropdown .dropdown-toggle[data-readonly-dropdown="true"]::after {
    opacity: 1;
}

.dropdown-menu[data-readonly-dropdown-menu="true"] {
    pointer-events: none !important;
    --bs-dropdown-link-hover-bg: transparent !important;
    --bs-dropdown-link-active-bg: transparent !important;
    --bs-dropdown-link-hover-color: #212529 !important;
    --bs-dropdown-link-active-color: #212529 !important;
}

.dropdown-menu[data-readonly-dropdown-menu="true"] .dropdown-item,
.dropdown-menu[data-readonly-dropdown-menu="true"] .form-check-label,
.dropdown-menu[data-readonly-dropdown-menu="true"] .dropdown-item:hover,
.dropdown-menu[data-readonly-dropdown-menu="true"] .dropdown-item:focus,
.dropdown-menu[data-readonly-dropdown-menu="true"] .dropdown-item:active,
.dropdown-menu[data-readonly-dropdown-menu="true"] .dropdown-item.active,
.dropdown-menu[data-readonly-dropdown-menu="true"] .dropdown-item:focus-visible,
.dropdown-menu[data-readonly-dropdown-menu="true"] label.dropdown-item:hover,
.dropdown-menu[data-readonly-dropdown-menu="true"] label.dropdown-item:focus,
.dropdown-menu[data-readonly-dropdown-menu="true"] label.dropdown-item:active {
    background-color: transparent !important;
    color: #212529 !important;
    text-decoration: none !important;
    cursor: default !important;
}

.dropdown-menu[data-readonly-dropdown-menu="true"] .dropdown-item,
.dropdown-menu[data-readonly-dropdown-menu="true"] .dropdown-divider,
.dropdown-menu[data-readonly-dropdown-menu="true"] .form-check-input,
.dropdown-menu[data-readonly-dropdown-menu="true"] .form-control,
.dropdown-menu[data-readonly-dropdown-menu="true"] .form-select,
.dropdown-menu[data-readonly-dropdown-menu="true"] .form-check-label,
.dropdown-menu[data-readonly-dropdown-menu="true"] span,
.dropdown-menu[data-readonly-dropdown-menu="true"] label {
    pointer-events: none !important;
}

.textarea-minimal {
    border: 0;
    width: 100%;
    resize: none;
}

.topbarlogo {
    margin-top: auto;
    margin-bottom: auto;
    margin-left: 0;
    margin-right: 0;
}

/* Responsive Logo Classes */
.show_when_small {
    display: none;
}

.show_when_very_small {
    display: none;
}

/* Links */
a {
    color: #0066cc;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

.logo-title {
    display: flex;
    align-items: center;
    gap: 12px;
    white-space: nowrap;
    flex-wrap: nowrap;
    text-decoration: none;
    color: #f8f9fa;
    
    font-size: 18px;
    font-weight: 600;
    margin-left: 8px;
    margin-right: 8px;
}

.logo-title:hover {
    color: #d4dbe2;
    text-decoration: none;
}

.header-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: flex-end;
    flex-wrap: nowrap;
}

@media (max-width: 768px) {
  .hide-if-small {
    display: none;
  }
}

.btn-top-header {
  height: 36px;
  border-radius: 4px;
  font-size: 14px;
  padding: 4px 12px;
  font-weight: 600;
  align-content: center;
  overflow: hidden;
}

/* Account Dropdown */
.account-dropdown {
    min-width: 200px;
    position: relative;
    overflow: visible;
}

.account-selector-trigger {
    cursor: pointer;
    padding: 6px 12px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    gap: 8px;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    min-width: 200px;
    justify-content: space-between;
    height: 36px;
    padding-bottom: 6px;
    border: 0;
    background: #fff;
}

.account-selector-trigger:hover {
    background: #e9ecef;
}

.account-selector-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 4px;
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    min-width: 200px;
    max-height: 400px;
    overflow-y: auto;
    z-index: 1001;
}

.account-selector-dropdown.show {
    display: block;
}

.account-selector-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    cursor: pointer;
    transition: background 0.15s;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    font-size: 14px;
    text-decoration: none;
    color: #333;
}

.account-selector-item:hover {
    background: #f8f9fa;
    color: #0066cc;
    text-decoration: none;
}

.account-selector-item.active {
    background: #e3f2fd;
    font-weight: 600;
    text-decoration: none;
}

.account-logo {
    width: 24px;
    height: 24px;
    object-fit: cover;
    border: 1px solid #ddd;
    border-radius: 4px;
    flex-shrink: 0;
}

.account-logo-placeholder {
    width: 24px;
    height: 24px;
    background: #f0f0f0;
    border: 1px solid #ddd;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: #999;
    flex-shrink: 0;
}

/* User Menu */
.user-menu {
    position: relative;
    cursor: default;
}

.notification-menu {
    position: relative;
}

.notification-menu-trigger {
    cursor: pointer;
    padding: 6px 12px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    gap: 6px;
    height: 36px;
    padding-bottom: 6px;
    border: 0;
    background: #fff;
    position: relative;
}

.notification-menu-trigger:hover {
    background: #e9ecef;
}

.notification-count {
    min-width: 16px;
    height: 16px;
    padding: 0 5px;
    border-radius: 999px;
    background: #dc3545;
    color: #fff;
    font-size: 10px;
    line-height: 16px;
    text-align: center;
    font-weight: 700;
    margin-left: -13px;
    margin-top: -12px;
}

.notification-menu-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 4px;
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    min-width: 320px;
    max-width: 360px;
    max-height: calc(100vh - 92px);
    overflow: hidden;
    z-index: 1001;
    flex-direction: column;
}

.notification-menu-dropdown.show {
    display: flex;
}

.notification-menu-list {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
}

.notification-menu-item {
    display: flex;
    align-items: flex-start;
    border-bottom: 1px solid #f0f0f0;
    transition: background 0.15s;
}

.notification-menu-item:last-of-type {
    border-bottom: none;
}

.notification-menu-item:hover {
    background: #f8f9fa;
}

.notification-dismiss-btn {
    flex-shrink: 0;
    align-self: flex-start;
    width: 24px;
    height: 24px;
    margin: 10px 10px 0 4px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    border-radius: 50%;
    color: #adb5bd;
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    outline: none;
    box-shadow: none;
    -webkit-appearance: none;
    appearance: none;
}

.notification-dismiss-btn:hover {
    background: #e9ecef;
    color: #495057;
}

.notification-dismiss-btn:focus,
.notification-dismiss-btn:active,
.notification-dismiss-btn:focus-visible {
    outline: none !important;
    box-shadow: none !important;
}

.notification-item-link {
    display: flex;
    flex: 1;
    min-width: 0;
    gap: 12px;
    padding: 12px 14px;
    color: #333;
    text-decoration: none;
    transition: color 0.15s;
}

a.notification-item-link:hover {
    color: #0066cc;
    text-decoration: none;
}

.notification-menu-icon {
    width: 32px;
    height: 32px;
    border-radius: 999px;
    background: #fff3cd;
    color: #856404;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.notification-menu-copy {
    min-width: 0;
}

.notification-menu-title {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 2px;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.notification-menu-message {
    font-size: 13px;
    color: #555;
    line-height: 1.4;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.notification-menu-action {
    font-size: 12px;
    font-weight: 600;
    color: #0066cc;
    margin-top: 6px;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.notification-menu-footer {
    padding: 10px 14px;
    border-top: 1px solid #dee2e6;
    text-align: center;
}

.notification-menu-footer a {
    font-size: 13px;
    color: #0066cc;
    text-decoration: none;
}

.notification-menu-footer a:hover {
    text-decoration: underline;
}

.notification-empty {
    padding: 14px;
    color: #666;
    font-size: 13px;
}

.user-menu-trigger {
    cursor: pointer;
    padding: 6px 12px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    gap: 6px;
    height: 36px;
    padding-bottom: 6px;
    border: 0;
    background: #fff;
}

.user-menu-trigger:hover {
    background: #e9ecef;
}

.user-menu-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 4px;
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    min-width: 200px;
    z-index: 1001;
}

.user-menu-dropdown.show {
    display: block;
}

.user-menu-item {
    display: block;
    padding: 10px 16px;
    color: #333;
    text-decoration: none;
    transition: background 0.15s;
}

.user-menu-item:hover {
    background: #f8f9fa;
    color: #0066cc;
    text-decoration: none;
}

.user-menu-item i {
    margin-right: 8px;
    width: 16px;
}

.user-menu-email-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    color: #555;
    font-size: 14px;
    max-width: 260px;
}

.user-menu-name-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 16px 4px;
    color: #1f2937;
    font-size: 15px;
    max-width: 260px;
}

.user-menu-name-row i {
    width: 16px;
    flex: 0 0 16px;
}

.user-menu-name-text {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 210px;
    font-weight: 700;
}

.user-menu-email-row i {
    width: 16px;
    flex: 0 0 16px;
}

.user-menu-email-text {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 210px;
    font-weight: 500;
}

/* Layout */
.layout-container {
    display: flex;
    min-height: calc(100vh - var(--top-header-height));
}

/* Mobile Responsive */
@media (max-width: 450px) {
  /* Layout */
  .layout-container {
      margin-top: 0;
  }  
}

/* Sidebar */
.sidebar {
    width: 240px;
    background: white;
    border-right: 1px solid #e0e0e0;
    padding: 3px 0;
}

    @media (max-width: 768px) {
        .sidebar {
            top: var(--top-header-height);
            height: calc(100vh - var(--top-header-height));
        }
    }

.sidebarfiller {
    /* needed because sidebar doesn't go down to the buttom of the page */
    position: fixed;
    top: var(--top-header-height);
    bottom: 0px;
    height: calc(100vh - var(--top-header-height));
    z-index: -1;
}

.sidebar-nav {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-nav li {
    margin: 0;
}

.sidebar-nav a {
    display: block;
    padding: 12px 24px;
    color: #333;
    text-decoration: none;
    transition: all 0.15s;
}

.sidebar-nav a:hover {
    background: #f8f9fa;
    color: #0066cc;
}

.sidebar-nav a.active {
    background: #e3f2fd;
    color: #0066cc;
    border-right: 3px solid #0066cc;
}

.sidebar-nav a i {
    margin-right: 8px;
    width: 20px;
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 24px;
    overflow-x: auto;
}

/* Account Links Bold No Underline */
.account-link {
    font-weight: 600;
    text-decoration: none !important;
}

.account-link:hover {
    color: #0066cc;
    text-decoration: none !important;
}

/* Password Requirements */
.password-requirements {
    font-size: 0.85em;
    color: #666;
    margin-top: 6px;
}

/* Honeypot Field */
.form-field--trap {
    position: absolute;
    left: -9999px;
    top: -9999px;
    width: 1px;
    height: 1px;
    opacity: 0;
}

/* Mobile Responsive */
@media (max-width: 340px) {
    .hide_when_very_small {
        display: none !important;
    }
    
    .show_when_very_small {
        display: inline-block !important;
    }
}

@media (max-width: 768px) {
    .hide_when_small {
        display: none !important;
    }
    
    .show_when_small {
        display: inline-block !important;
    }

    .user-menu-email-row {
        display: none !important;
    }
    
    /* Stack header items */
    .top-header {
        padding: 8px 12px;
        flex-wrap: wrap;
        gap: 8px;
        justify-content: flex-start;
        align-items: center;
    }

    .mobile-menu-toggle {
        order: 1;
        flex: 0 0 auto;
    }

    .header-branding {
        order: 2;
        flex: 1 1 0;
        min-width: 0;
        justify-content: flex-start;
    }
        
    /* Smaller account dropdown */
    .account-dropdown {
        min-width: 60px;
    }
    
    .account-selector-trigger {
        min-width: 60px;
        padding: 6px 8px;
        font-size: 13px;
    }

    .header-right {
        order: 3;
        width: 100%;
        flex: 1 1 100%;
        margin-left: 0;
        justify-content: flex-end;
        align-items: center;
        flex-wrap: wrap;
    }
    
    /* Hide sidebar on mobile, make it collapsible */
    .sidebar {
        position: fixed;
        left: -240px;
        top: var(--top-header-height);
        height: calc(100vh - var(--top-header-height));
        z-index: 9999999;
        transition: left 0.3s;
    }
    
    .sidebar.show {
        left: 0;
    }
    
    /* Add menu toggle button */
    .mobile-menu-toggle {
        display: block;
        background: none;
        color: #fff;
        border: none;
        font-size: 24px;
        cursor: pointer;
        padding: 4px;
    }
    
    /* Main content full width on mobile */
    .main-content {
        width: 100%;
        padding: 16px;
    }

    .appliance-collector-group {
        width: 100%;
        flex-direction: column;
        align-items: stretch !important;
    }

    .appliance-collector-group .btn {
        width: 100%;
    }

    .appliance-compact-actions {
        width: 100%;
    }

    .appliance-compact-actions .btn {
        width: 100%;
    }

    .appliance-license-select {
        width: 100%;
        min-width: 0 !important;
    }
}

@media (max-width: 480px) {
    .account-dropdown {
        min-width: 60px;
    }
    
    .account-selector-trigger {
        min-width: 60px;
        font-size: 12px;
    }
    
    .main-content {
        padding: 12px;
    }
}

/* Desktop - hide mobile menu toggle */
@media (min-width: 769px) {
    .mobile-menu-toggle {
        display: none;
    }
}

/* Overwrite some bootstrap css default, for all */
.btn {
    text-decoration: none;
    border-radius: var(--bs-border-radius) !important;
}

.btn:hover {
    text-decoration: none;
}

.btn-primary, .btn-outline-primary {
    --bs-btn-color: #fff;
    --bs-btn-bg: #FF6B35;
    --bs-btn-border-color: #FF6B35;
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: #FF8555;
    --bs-btn-hover-border-color: #FF8555;
    --bs-btn-active-color: #fff;
    --bs-btn-active-bg: #FF8555;
    --bs-btn-active-border-color: #FF8555;
    --bs-btn-disabled-color: #fff;
    --bs-btn-disabled-bg: #6c757d;
    --bs-btn-disabled-border-color: #61666b;
}

.btn-group-sm a.btn, .btn-group-sm button.btn {
    border-radius:0px !important;
}
.btn-group-sm a.btn:first-child, .btn-group-sm button.btn:first-child {
    border-radius:6px 0 0 6px !important;
}

.btn-group-sm a.btn:last-child, .btn-group-sm button.btn:last-child {
    border-radius:0 6px 6px 0 !important;
}

.btn-group-sm a.btn:only-child, .btn-group-sm button.btn:only-child {
    border-radius: 6px !important;
}

.container {
    margin-bottom: 80px !important;
}

/* Overwrite some bootstrap css default, for small displays */
@media (max-width: 450px) {
  .container, .container-fluid, .container-lg, .container-md, .container-sm, .container-xl, .container-xxl
    {
        padding-right: 0px !important;
        padding-left: 0px !important;
    }
    
    .shadow {
        box-shadow: none !important;
    }

    .card {
        border: 0px !important;
    }
    
    body {
        background: #fff !important;
    }
    
    /* view-audit */
    #shareLinksTable thead {
      display: none;
    }
    
    #shareLinksBody tr td {
      display: block;
    }
}

.ajax-submit-spinner {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.ajax-submit-spinner::before {
  content: "";
  width: 14px;
  height: 14px;
  border-radius: 999px;
  border: 2px solid rgba(255,255,255,.35);
  border-top-color: currentColor;
  animation: configsentry-spin .8s linear infinite;
}

.configsentry-tooltip {
  position: fixed;
  z-index: 10000001;
  max-width: 320px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(0, 0, 0, .75);
  color: #fff;
  font-size: 12px;
  line-height: 1.45;
  white-space: normal;
  box-shadow: 0 12px 32px rgba(0,0,0,.28);
  pointer-events: none;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity .12s ease, transform .12s ease;
}

.configsentry-tooltip.show {
  opacity: 1;
  transform: translateY(0);
}

.configsentry-tooltip-anchor {
  cursor: help;
}

.configsentry-help-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  margin-left: 6px;
  border-radius: 999px;
  background: #111827;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  vertical-align: middle;
}

@keyframes configsentry-spin {
  to {
    transform: rotate(360deg);
  }
}
