/* 
  Liquid Glass UI Design System
  Vibe: Apple Vision Pro / iOS 26 High-end Glassmorphism
*/

:root {
    /* Brand & Accent Colors */
    --lg-accent-primary: #007aff;
    --lg-accent-glow: rgba(0, 122, 255, 0.4);
    --lg-accent-hover: #0066d6;
    --lg-text-main: #1D1D1F;
    --lg-text-muted: #86868B;
    --lg-text-dim: #A1A1A6;

    /* Backgrounds & Glass */
    --lg-bg-base: #FBFBFD;
    --lg-glass-bg: rgba(255, 255, 255, 0.65);
    --lg-glass-bg-hover: rgba(255, 255, 255, 0.85);
    --lg-glass-border: rgba(255, 255, 255, 0.6);
    --lg-glass-border-highlight: rgba(200, 200, 205, 0.4);

    /* Status Colors */
    --status-open: #34c759;
    --status-pending: #ff9f0a;
    --status-in-progress: #0a84ff;
    --status-closed: #ff453a;

    /* Effects */
    --lg-blur: blur(24px);
    --lg-saturate: saturate(180%);
    --lg-shadow: 0 12px 32px rgba(0, 0, 0, 0.06);
    --lg-shadow-glow: 0 0 20px rgba(0, 122, 255, 0.1);

    /* Radii */
    --radius-sm: 8px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --radius-pill: 9999px;

    /* Transitions */
    --transition-fast: 0.15s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    --transition-smooth: 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

body {
    background-color: var(--lg-bg-base);
    color: var(--lg-text-main);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    -webkit-font-smoothing: antialiased;
}

/* Base Liquid Glass Card */
.lg-glass-card {
    background: var(--lg-glass-bg);
    backdrop-filter: var(--lg-blur) var(--lg-saturate);
    -webkit-backdrop-filter: var(--lg-blur) var(--lg-saturate);
    border: 1px solid var(--lg-glass-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--lg-shadow);
    transition: all var(--transition-smooth);
    position: relative;
    overflow: hidden;
}

.lg-glass-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--lg-glass-border-highlight), transparent);
    opacity: 0.5;
}

.lg-glass-card:hover {
    background: var(--lg-glass-bg-hover);
    border-color: var(--lg-glass-border-highlight);
    transform: translateY(-2px);
    box-shadow: var(--lg-shadow), var(--lg-shadow-glow);
}

/* Glass Buttons */
.lg-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius-pill);
    font-weight: 500;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all var(--transition-fast);
    border: none;
    outline: none;
    backdrop-filter: var(--lg-blur);
    -webkit-backdrop-filter: var(--lg-blur);
}

.lg-btn:focus-visible {
    box-shadow: 0 0 0 2px var(--lg-bg-base), 0 0 0 4px var(--lg-accent-primary);
}

.lg-btn:active {
    transform: scale(0.96);
}

.lg-btn-primary {
    background: linear-gradient(135deg, var(--lg-accent-primary), #005bb5);
    color: #fff;
    box-shadow: 0 4px 15px var(--lg-accent-glow);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.lg-btn-primary:hover {
    box-shadow: 0 6px 20px var(--lg-accent-glow), inset 0 0 0 1px rgba(0, 0, 0, 0.05);
    filter: brightness(1.1);
}

.lg-btn-glass {
    background: rgba(255, 255, 255, 0.8);
    color: var(--lg-text-main);
    border: 1px solid var(--lg-glass-border);
    box-shadow: var(--lg-shadow);
}

.lg-btn-glass:hover {
    background: rgba(255, 255, 255, 0.95);
    border-color: var(--lg-glass-border-highlight);
}

/* Tag Chips */
.lg-tag {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: var(--radius-pill);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    backdrop-filter: blur(8px);
    border: 1px solid transparent;
}

.lg-tag-open,
.lg-tag-active {
    background: rgba(52, 199, 89, 0.15);
    color: var(--status-open);
    border-color: rgba(52, 199, 89, 0.3);
}

.lg-tag-pending {
    background: rgba(255, 159, 10, 0.15);
    color: var(--status-pending);
    border-color: rgba(255, 159, 10, 0.3);
}

.lg-tag-progress {
    background: rgba(10, 132, 255, 0.15);
    color: var(--status-in-progress);
    border-color: rgba(10, 132, 255, 0.3);
}

.lg-tag-closed {
    background: rgba(255, 69, 58, 0.15);
    color: var(--status-closed);
    border-color: rgba(255, 69, 58, 0.3);
}

/* Badge (Unread) */
.lg-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--status-closed);
    color: white;
    font-size: 0.7rem;
    font-weight: bold;
    min-width: 18px;
    height: 18px;
    border-radius: var(--radius-pill);
    padding: 0 5px;
    box-shadow: 0 0 10px rgba(255, 69, 58, 0.5);
}

/* Inputs */
.lg-input {
    width: 100%;
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid var(--lg-glass-border-highlight);
    border-radius: var(--radius-md);
    padding: 12px 16px;
    color: var(--lg-text-main);
    font-family: inherit;
    font-size: 0.95rem;
    transition: all var(--transition-fast);
    backdrop-filter: blur(10px);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.02);
}

.lg-input:focus {
    outline: none;
    border-color: var(--lg-accent-primary);
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 0 0 3px var(--lg-accent-glow), inset 0 2px 4px rgba(0, 0, 0, 0.02);
}

.lg-input::placeholder {
    color: var(--lg-text-dim);
}

/* Animations */
@keyframes lg-fade-in {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.lg-animate-fade-in {
    animation: lg-fade-in 0.4s ease-out forwards;
}

/* Toast Container */
#lg-toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 9999;
    pointer-events: none;
}

.lg-toast {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: var(--lg-blur) var(--lg-saturate);
    border: 1px solid var(--lg-glass-border);
    border-radius: var(--radius-md);
    padding: 12px 20px;
    color: var(--lg-text-main);
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: var(--lg-shadow);
    animation: lg-toast-enter 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
    pointer-events: auto;
}

@keyframes lg-toast-enter {
    from {
        transform: translateX(100%) scale(0.9);
        opacity: 0;
    }

    to {
        transform: translateX(0) scale(1);
        opacity: 1;
    }
}

@keyframes lg-toast-exit {
    from {
        transform: translateX(0) scale(1);
        opacity: 1;
    }

    to {
        transform: translateX(100%) scale(0.9);
        opacity: 0;
    }
}

/* Post-purchase Ring Pulse */
@keyframes lg-ring-pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(0, 122, 255, 0.7);
    }

    70% {
        box-shadow: 0 0 0 15px rgba(0, 122, 255, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(0, 122, 255, 0);
    }
}

.lg-ring-active {
    animation: lg-ring-pulse 1.5s infinite;
    border-color: var(--lg-accent-primary) !important;
}

/* Allow selection globally on text */
.lg-selectable {
    user-select: text !important;
    -webkit-user-select: text !important;
}

/* --- Systematic CSS Polish Layer --- */

/* 1. Z-index mapping fixes */
.modal-overlay {
    z-index: 9999 !important;
}

#lg-toast-container {
    z-index: 10000 !important;
}

.admin-chat-input-area,
.ticket-chat-form {
    z-index: 100;
    position: relative;
}

/* 2. Word wrapping & bubble width for long URLs / words */
.ticket-msg-inner,
.admin-chat-message .msg-content,
.ticket-msg-text,
.admin-chat-text {
    word-break: break-word !important;
    overflow-wrap: break-word !important;
    white-space: pre-wrap !important;
    max-width: 100%;
}

/* 3. Ensure Chat Parents don't scroll horizontally */
.ticket-chat-messages,
.admin-chat-messages {
    overflow-x: hidden;
}

/* 4. Less harsh borders for glass cards (Override) */
.lg-glass-card {
    border: 1px solid var(--lg-glass-border) !important;
}

.lg-glass-card:hover {
    border-color: rgba(255, 255, 255, 0.9) !important;
}