/* VERSION: 1.8.0 */
/* css/ui-base.css */
/* Common UI Elements: Buttons, Badges, Inputs, Context Menu, Toast */

/* --- Focus Accessibility --- */
:focus-visible {
    outline: 2px solid var(--highlight);
    outline-offset: 2px;
}

/* High Contrast Mode Support */
@media (forced-colors: active) {
    :focus-visible {
        outline: 2px solid CanvasText;
    }
}

/* --- Modern Greyscale Icon Buttons --- */
.icon-btn {
    background: transparent;
    border: 1px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    color: var(--icon-base, rgba(240, 246, 252, 0.72));
    width: 36px;
    height: 36px;
    min-width: 40px;
    min-height: 40px;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    transition: color 0.18s ease, background 0.18s ease, transform 0.18s ease, border-color 0.18s ease, filter 0.18s ease;
    position: relative;
    flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}
.icon-btn:hover {
    color: var(--icon-hover, #ffffff);
    background: var(--bg-hover, rgba(255, 255, 255, 0.08));
    border-color: rgba(255, 255, 255, 0.15);
    filter: var(--icon-glow, drop-shadow(0 0 6px rgba(255, 255, 255, 0.45)));
    transform: translateY(-1px);
}
.icon-btn:active {
    transform: translateY(0px) scale(0.96);
    background: rgba(255, 255, 255, 0.12);
}
.icon-btn.active {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.28);
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.15);
}
.icon-btn.small {
    width: 30px;
    height: 30px;
    min-width: 36px;
    min-height: 36px;
}

.icon-btn svg {
    width: 20px;
    height: 20px;
    pointer-events: none;
    transition: transform 0.18s ease;
}

.badge {
    font-size: 0.65rem;
    font-weight: 700;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.25);
    color: #fff;
    padding: 1px 4px;
    border-radius: 4px;
    position: absolute;
    bottom: 4px;
    right: 4px;
    pointer-events: none;
    backdrop-filter: blur(4px);
}

/* --- Select Dropdowns --- */
.select-wrapper {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.select-wrapper select {
    background: var(--bg-surface-glass, rgba(14, 18, 28, 0.85));
    color: var(--text-main, #f8fafc);
    border: 1px solid var(--border-color, var(--glass-border, rgba(255, 255, 255, 0.14)));
    border-radius: 6px;
    padding: 5px 24px 5px 10px;
    font-size: 0.8rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    outline: none;
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    color-scheme: dark;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.select-wrapper select:hover {
    background-color: var(--bg-surface-elevated, rgba(24, 30, 44, 0.9));
    border-color: var(--accent, rgba(255, 255, 255, 0.28));
    color: var(--text-main, #fff);
}

.select-wrapper select:focus,
.select-wrapper select:focus-visible {
    border-color: var(--accent, rgba(255, 255, 255, 0.4));
    box-shadow: 0 0 0 2px var(--accent-glow, rgba(99, 102, 241, 0.25));
}

.select-wrapper select option {
    background: var(--bg-panel, #0f121a);
    color: var(--text-main, #f8fafc);
    padding: 8px;
}

.select-wrapper select option:checked {
    background-color: var(--accent, #6366f1) !important;
    color: #ffffff !important;
}

/* --- Context Menu (Polished Glassmorphism) --- */
#context-menu {
    position: absolute;
    display: none;
    background: rgba(16, 20, 30, 0.88);
    backdrop-filter: blur(24px) saturate(190%);
    -webkit-backdrop-filter: blur(24px) saturate(190%);
    border: 1px solid var(--glass-border, rgba(255, 255, 255, 0.14));
    border-radius: 10px;
    z-index: 1000;
    min-width: 170px;
    padding: 6px;
    box-shadow: 0 18px 45px rgba(0, 0, 0, 0.85), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}
#context-menu.visible { display: block; }
.menu-item {
    padding: 8px 12px;
    color: var(--text-main, #f8fafc);
    cursor: pointer;
    display: flex;
    gap: 10px;
    font-size: 0.85rem;
    font-weight: 500;
    border-radius: 6px;
    align-items: center;
    transition: background 0.15s ease, color 0.15s ease;
}
.menu-item:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}
.menu-item svg { fill: none; stroke: currentColor; stroke-width: 1.75; }

/* --- Drop Overlay --- */
#drop-overlay { position: absolute; top:0; left:0; width:100%; height:100%; background:rgba(0,0,0,0.85); z-index:20; display:flex; justify-content:center; align-items:center; opacity:0; pointer-events:none; transition:opacity 0.2s; }
#drop-overlay.active { opacity: 1; }
.drop-message { color:#fff; display:flex; flex-direction:column; align-items:center; font-size:1.2rem; }

/* --- Toast --- */
#notification-toast { 
    position:absolute; 
    top:30px; 
    background:rgba(229,57,53,0.95); 
    color:#fff; 
    padding:14px 24px; 
    border-radius:6px; 
    opacity:0; 
    transform:translateY(-20px); 
    transition:all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275); 
    z-index: 20000; 
    box-shadow: 0 4px 12px rgba(0,0,0,0.5);
    font-weight: 500;
    pointer-events: none;
}
#notification-toast.visible { opacity:1; transform:translateY(0); pointer-events: auto; }
#notification-toast.high-priority { border-left: 4px solid #fff; }

@media (max-width: 768px) {
    #notification-toast { top: 10px; left: 50%; transform: translateX(-50%) translateY(-20px); width: 90%; text-align: center; }
    #notification-toast.visible { transform: translateX(-50%) translateY(0); }
}