/**
 * OwnTrack Custom CSS Extensions
 *
 * Custom extensions for Pico CSS 2.1.1 framework.
 *
 * @license MIT
 */

/* =============================================
   UTILITIES
   ============================================= */
.hidden { display: none !important; }

/* =============================================
   TABLE VERTICAL ALIGNMENT
   ============================================= */
/* Buttons in tables: remove margin that causes misalignment */
figure table button,
figure table [type="submit"],
figure table [type="button"] {
    margin-top: 0;
    margin-bottom: 0;
}

/* =============================================
   STICKY FOOTER
   ============================================= */
html, body {
    height: 100vh;
}

body > footer {
    position: sticky;
    top: 100vh;
}

/* =============================================
   NAVIGATION
   ============================================= */
.main-nav {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--pico-background-color);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* =============================================
   TOAST NOTIFICATIONS
   ============================================= */
#toast-container {
    position: fixed;
    top: 80px;
    right: 1rem;
    z-index: 1000;
    max-width: 400px;
    width: calc(100% - 2rem);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    pointer-events: none;
}

#toast-container:empty {
    display: none;
}

.toast {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-left: 4px solid var(--pico-primary);
    border-radius: var(--pico-border-radius);
    background: var(--pico-card-background-color);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    pointer-events: auto;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.toast.toast-fadeout {
    opacity: 0;
    transform: translateX(100%);
}

.toast span {
    flex: 1;
}

.toast-close {
    background: none;
    border: none;
    padding: 0.25rem;
    margin: 0;
    font-size: 1.25rem;
    line-height: 1;
    cursor: pointer;
    color: var(--pico-muted-color);
    width: auto;
}

.toast-close:hover {
    color: var(--pico-color);
}

[data-theme="dark"] .toast {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

/* =============================================
   ALERT COLOR VARIANTS (used by .toast)
   ============================================= */
.alert-success {
    border-left-color: var(--pico-ins-color);
}

.alert-danger {
    border-left-color: var(--pico-del-color);
}

.alert-warning {
    border-left-color: #f0ad4e;
}

.alert-info {
    border-left-color: var(--pico-primary);
}

/* =============================================
   TEXT COLOR VARIANTS (used by <mark> error indicators)
   ============================================= */
mark.text-danger {
    background-color: var(--pico-del-color);
    color: var(--pico-background-color);
}

/* =============================================
   FORM VALIDATION ERRORS
   ============================================= */
/* Error messages inside labels should be red when field is invalid */
label [aria-invalid="true"] ~ small,
label:has([aria-invalid="true"]) > small:last-child,
fieldset[aria-invalid="true"] > small {
    color: var(--pico-del-color);
}
