/**
 * F360 Floating UI - Front-end Styles
 * Version: 1.0.0
 */

/* CSS Variables (overridden by inline styles) */
:root {
    --f360-offset-x: 24px;
    --f360-offset-y: 24px;
    --f360-z-index: 2147481000;
    --f360-pill-width-collapsed: 56px;
    --f360-pill-height: 56px;
    --f360-pill-spacing: 12px;
    --f360-pill-padding: 16px;
    --f360-pill-gap: 12px;
    --f360-radius: 24px;
    --f360-icon-size: 24px;
    --f360-font-family: inherit;
    --f360-font-size: 16px;
    --f360-font-weight: 600;
    --f360-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    --f360-collapse-delay: 150ms;
    --f360-transition: all 0.3s ease;
}

/* Root Container */
.f360-fui-root {
    position: fixed;
    z-index: var(--f360-z-index);
    pointer-events: none;
}

.f360-fui-root * {
    box-sizing: border-box;
}

/* Desktop Pills Container */
.f360-fui-desktop {
    display: flex;
    flex-direction: column;
    gap: var(--f360-pill-spacing);
    position: fixed;
    pointer-events: auto;
    align-items: flex-end;
    right: 0; /* Default to right edge */
}

/* Hide desktop on mobile */
@media (max-width: 1024px) {
    .f360-fui-desktop {
        display: none !important;
    }
}

/* Individual Pill */
.f360-fui-pill {
    display: flex;
    align-items: stretch;
    height: var(--f360-pill-height);
    border-radius: 0;
    box-shadow: var(--f360-shadow);
    text-decoration: none;
    font-family: var(--f360-font-family);
    cursor: pointer;
    transition: var(--f360-transition);
    overflow: hidden;
    position: relative;
}

.f360-fui-pill:focus-visible {
    outline: 2px solid rgba(0, 0, 0, 0.3);
    outline-offset: 2px;
}

/* Icon Section - Always visible, square */
.f360-fui-icon-section {
    display: flex;
    align-items: center;
    justify-content: center;
    width: var(--f360-pill-height);
    min-width: var(--f360-pill-height);
    height: var(--f360-pill-height);
    flex-shrink: 0;
}

/* Label Section - Hidden by default, appears on hover */
.f360-fui-label-section {
    display: flex;
    align-items: center;
    padding: 0;
    max-width: 0;
    opacity: 0;
    overflow: hidden;
    transition: max-width 0.3s ease, opacity 0.3s ease, padding 0.3s ease;
    white-space: nowrap;
}

.f360-fui-pill:hover .f360-fui-label-section,
.f360-fui-pill:focus-visible .f360-fui-label-section {
    max-width: 250px;
    opacity: 1;
    padding: 0 24px 0 16px;
}

/* Pill Icon */
.f360-fui-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    flex-shrink: 0;
    width: 24px;
    height: 24px;
}

/* SVG Icon Styling */
.f360-fui-icon svg {
    width: 24px;
    height: 24px;
    display: block;
    color: inherit;
    fill: currentColor;
}

/* Ensure icons don't break layout */
.f360-fui-icon-section .f360-fui-icon {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Pill Label */
.f360-fui-pill .f360-fui-label {
    font-size: var(--f360-font-size);
    font-weight: var(--f360-font-weight);
    white-space: nowrap;
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .f360-fui-pill,
    .f360-fui-label-section {
        transition: none !important;
    }
    
    .f360-fui-pill:hover .f360-fui-label-section,
    .f360-fui-pill:focus-visible .f360-fui-label-section {
        max-width: 200px;
        opacity: 1;
    }
}

/* Mobile Bar */
.f360-fui-mobile {
    display: none;
}

@media (max-width: 1024px) {
    .f360-fui-mobile {
        display: block;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: var(--f360-z-index);
        padding-bottom: env(safe-area-inset-bottom);
        pointer-events: auto;
    }
}

/* Mobile Bar Container */
.f360-fui-bar {
    display: flex;
    width: 100%;
    background: transparent;
    gap: 0;
}

/* Two Equal (50/50) */
.f360-fui-bar.f360-bar-two-equal .f360-fui-btn {
    flex: 1;
}

/* Three Equal (33/33/33) */
.f360-fui-bar.f360-bar-three-equal .f360-fui-btn {
    flex: 1;
}

/* Dominant + Smaller (70/30) */
.f360-fui-bar.f360-bar-dominant-smaller .f360-fui-btn.f360-dominant {
    flex: 7;
}

.f360-fui-bar.f360-bar-dominant-smaller .f360-fui-btn:not(.f360-dominant) {
    flex: 3;
}

/* Single + FAB */
.f360-fui-bar.f360-bar-single-fab {
    position: relative;
}

.f360-fui-bar.f360-bar-single-fab .f360-fui-btn:not(.f360-fab) {
    flex: 1;
}

.f360-fui-bar.f360-bar-single-fab .f360-fab {
    position: fixed;
    bottom: calc(80px + env(safe-area-inset-bottom));
    right: 20px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    padding: 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.f360-fui-bar.f360-bar-single-fab .f360-fab .f360-fui-label {
    display: none;
}

/* Mobile Button Base */
.f360-fui-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    text-decoration: none;
    font-family: var(--f360-font-family);
    font-size: var(--f360-font-size);
    font-weight: var(--f360-font-weight);
    cursor: pointer;
    border: none;
    min-height: 64px;
    transition: opacity 0.2s ease;
}

.f360-fui-btn:active {
    opacity: 0.8;
}

.f360-fui-btn .f360-fui-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    line-height: 1;
}

.f360-fui-btn .f360-fui-icon svg {
    width: 24px;
    height: 24px;
    display: block;
}

.f360-fui-btn .f360-fui-label {
    font-size: var(--f360-font-size);
    font-weight: var(--f360-font-weight);
}

/* Horizontal Style (icon + text side-by-side) */
.f360-fui-btn.f360-style-horizontal {
    flex-direction: row;
    gap: 10px;
}

.f360-fui-btn.f360-style-horizontal .f360-fui-icon {
    width: var(--f360-icon-size);
    height: var(--f360-icon-size);
}

/* Vertical Style (icon on top, text below) */
.f360-fui-btn.f360-style-vertical {
    flex-direction: column;
    gap: 6px;
}

.f360-fui-btn.f360-style-vertical .f360-fui-icon {
    width: var(--f360-icon-size);
    height: var(--f360-icon-size);
}

.f360-fui-btn.f360-style-vertical .f360-fui-label {
    font-size: 14px;
}

/* Overflow Menu */
.f360-overflow-menu {
    position: fixed;
    bottom: calc(64px + env(safe-area-inset-bottom));
    left: 0;
    right: 0;
    background: white;
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.15);
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.f360-overflow-menu.is-open {
    max-height: 300px;
}

.f360-overflow-menu .f360-fui-btn {
    width: 100%;
    justify-content: flex-start;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

/* Overflow Trigger */
.f360-overflow-trigger {
    background: #f5f5f5 !important;
    color: #333 !important;
}

/* Mobile Bar Borders (optional) */
.f360-fui-mobile.has-borders .f360-fui-bar {
    border-top: 1px solid rgba(0, 0, 0, 0.1);
}

.f360-fui-mobile.has-borders .f360-fui-btn:not(:last-child) {
    border-right: 1px solid rgba(0, 0, 0, 0.1);
}

/* Mobile Bar Top Shadow (optional) */
.f360-fui-mobile.has-shadow .f360-fui-bar {
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.15);
}

/* Visibility Control */
.f360-fui-root[data-show="false"] {
    opacity: 0;
    pointer-events: none;
}

/* Loading State */
.f360-fui-root.is-loading {
    opacity: 0;
}

/* Accessibility: Focus Styles */
.f360-fui-pill:focus-visible,
.f360-fui-btn:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 2px;
}

/* Remove focus outline on touch devices */
.f360-fui-pill:focus:not(:focus-visible),
.f360-fui-btn:focus:not(:focus-visible) {
    outline: none;
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .f360-fui-pill,
    .f360-fui-btn {
        border: 2px solid currentColor;
    }
}