/* Navbar improvements */
.navbar {
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
}

/* Force single line */
.navbar .container-fluid {
    flex-wrap: nowrap !important;
}

/* === Text truncation styles === */
.text-truncate {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Bootstrap has no min-width utility. Flex children default to min-width:auto,
   so a long unbreakable word (file name, note content) pushes the row wider
   than the screen and hides the buttons on mobile. */
.min-width-0 {
    min-width: 0;
}

.tiny-text {
    font-size: 0.75rem;
}

/* ───── Footer ───── */
.footer-link:hover,
.footer-link:focus {
  color: var(--bs-body-color) !important;
  text-decoration: underline !important;
}

/* Safe area for PWA (home indicator on iPhone, Android gesture bar) */
footer {
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

/* === Back button styles === */
/* Hide on pages where history.length <= 1 - nothing to go back to */
.btn-back-mobile {
  transition: opacity 0.2s ease;
}

/* Bottom margin so fixed button doesn't overlap page content */
@media (max-width: 991.98px) {
  #content {
    padding-bottom: calc(80px + env(safe-area-inset-bottom));
  }
}

/* === User/team name styles === */
.context-name {
    display: inline-block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: middle;

    /* On mobile (by default) */
    max-width: 70px;
    font-size: 0.85rem;
}

/* On tablets and desktops */
@media (min-width: 768px) {
    .context-name {
        max-width: 150px;
        font-size: 1rem;
    }
}

/* Additional mobile navbar tweaks */
@media (max-width: 767.98px) {
    /* Prevent navbar from jumping in height */
    .navbar-brand, .navbar-nav .nav-link {
        font-size: 1rem;
    }
}

/* Click areas */
.nav-link, .dropdown-item {
    padding-top: 8px;
    padding-bottom: 8px;
    display: flex;
    align-items: center;
}
.dropdown-item i {
    width: 1.5rem;
    text-align: center;
}
.btn-link:focus, .btn-link:active {
    box-shadow: none;
}

/* === Notification dropdown scroll === */
#notificationDropdown .dropdown-menu {
    max-height: 400px;
    overflow-y: auto;
    overflow-x: hidden;
}

/* Notification list container inside dropdown */
#notificationDropdown .notification-list {
    padding-bottom: 4px;
}

/* Scrollbar styling for Webkit browsers */
#notificationDropdown .dropdown-menu::-webkit-scrollbar {
    width: 6px;
}

#notificationDropdown .dropdown-menu::-webkit-scrollbar-track {
    background: transparent;
}

#notificationDropdown .dropdown-menu::-webkit-scrollbar-thumb {
    background-color: rgba(0, 0, 0, 0.2);
    border-radius: 3px;
}

#notificationDropdown .dropdown-menu::-webkit-scrollbar-thumb:hover {
    background-color: rgba(0, 0, 0, 0.3);
}

/* Increase toolbar button and icon sizes */
.toolbar-left .btn-group .btn {
    min-width: 2.5rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
}

.toolbar-left .btn-group .btn i {
    font-size: 1.2rem;
}

/* === Custom message styles === */
.custom-messages {
    position: fixed;
    top: 80px;
    right: 16px;
    z-index: 1050;
    max-width: 360px;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.custom-message {
    padding: 14px 16px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: flex-start;
    gap: 12px;
    pointer-events: auto;
    animation: slideIn 0.3s ease-out;
    border-left: 4px solid;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideOut {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(100%);
    }
}

.custom-message.fade-out {
    animation: slideOut 0.3s ease-in forwards;
}

/* Message types */
.custom-message.success {
    background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%) !important;
    border-left-color: #28a745 !important;
    color: #155724 !important;
}

.custom-message.success .message-icon {
    color: #28a745 !important;
}

.custom-message.error {
    background: linear-gradient(135deg, #f8d7da 0%, #f5c6cb 100%) !important;
    border-left-color: #dc3545 !important;
    color: #721c24 !important;
}

.custom-message.error .message-icon {
    color: #dc3545 !important;
}

.custom-message.warning {
    background: linear-gradient(135deg, #fff3cd 0%, #ffeeba 100%) !important;
    border-left-color: #ffc107 !important;
    color: #856404 !important;
}

.custom-message.warning .message-icon {
    color: #ffc107 !important;
}

.custom-message.info {
    background: linear-gradient(135deg, #d1ecf1 0%, #bee5eb 100%) !important;
    border-left-color: #17a2b8 !important;
    color: #0c5460 !important;
}

.custom-message.info .message-icon {
    color: #17a2b8 !important;
}

.custom-message .message-icon {
    font-size: 1.25rem;
    flex-shrink: 0;
    margin-top: 2px;
}

.custom-message .message-text {
    flex: 1;
    font-size: 0.9rem;
    line-height: 1.4;
}

.custom-message .btn-close {
    opacity: 0.6;
    flex-shrink: 0;
    padding: 4px 8px;
    background: rgba(0, 0, 0, 0.1);
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    margin-top: -2px;
    transition: all 0.2s ease;
}

.custom-message .btn-close:hover {
    opacity: 1;
    background: rgba(0, 0, 0, 0.2);
}

/* Mobile responsiveness */
@media (max-width: 575.98px) {
    .custom-messages {
        top: 70px;
        right: 8px;
        left: 8px;
        max-width: none;
    }
}

/* === Fix notification dropdown positioning on mobile === */
/* Center the dropdown menu relative to the trigger button on narrow screens */
@media (max-width: 575.98px) {
    #notificationDropdown .dropdown-menu {
        /* Center relative to the button */
        right: auto !important;
        left: 50% !important;
        transform: translateX(-50%) !important;
        
        /* Limit width to fit screen */
        min-width: 240px !important;
        max-width: calc(100vw - 32px) !important;
        
        /* Add top offset from navbar */
        margin-top: 8px !important;
    }
    
    /* Remove translate on hover/focus for desktop (via JS Bootstrap) */
    #notificationDropdown .dropdown-menu.show {
        transform: translateX(-50%) !important;
    }
    
    /* Scroll for notification list */
    #notificationDropdown .dropdown-menu {
        max-height: 400px;
        overflow-y: auto;
        overflow-x: hidden;
    }
    
    /* Container for notification list inside dropdown */
    #notificationDropdown .notification-list {
        padding-bottom: 4px;
    }
    
    /* Scrollbar styling for Webkit browsers */
    #notificationDropdown .dropdown-menu::-webkit-scrollbar {
        width: 6px;
    }
    
    #notificationDropdown .dropdown-menu::-webkit-scrollbar-track {
        background: transparent;
    }
    
    #notificationDropdown .dropdown-menu::-webkit-scrollbar-thumb {
        background-color: rgba(0, 0, 0, 0.2);
        border-radius: 3px;
    }
    
    #notificationDropdown .dropdown-menu::-webkit-scrollbar-thumb:hover {
        background-color: rgba(0, 0, 0, 0.3);
    }
}
/* ===== Status select color indicator (task forms) ===== */

/* Colored dot next to the status select, mirrors .status-dot
   from the task list (12x12px, radius 2px) */
.status-select-dot {
    width: 12px;
    height: 12px;
    border-radius: 2px;
    flex-shrink: 0;
    background-color: #dee2e6;
}

/* ===== Markdown-lite in note lists ===== */

/* Headings are flattened to bold text, not real h1-h6: a list card must
   stay compact, so size grows only slightly over the snippet body. */
.md-lite-h {
    font-weight: 700;
    font-size: 1.05em;
    color: var(--bs-body-color);
}

/* Blockquote keeps the em style and a left rule to read as a quote. */
.md-lite-quote {
    padding-left: 0.4em;
    border-left: 2px solid var(--bs-border-color);
    color: var(--bs-secondary-color);
}

/* Inline code on a muted small snippet needs its own contrast,
   otherwise the pale background disappears in dark theme. */
.md-lite code,
.md-lite-inline code {
    padding: 0.1em 0.3em;
    border-radius: 0.25rem;
    background-color: var(--tm-bg-secondary);
    font-size: 0.9em;
    word-break: break-word;
}

/* Paragraph breaks rendered as <br> must not add empty lines
   when several appear from a truncated block. */
.md-lite br + br {
    display: none;
}
