/* 
  GoOfferHub Base CSS - Precisely matched to MVC project
  (Relies primarily on Tailwind CSS loaded via CDN)
*/

body { 
    font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; 
}

/* Remove default focus outlines globally */
*:focus, button:focus, a:focus {
    outline: none !important;
}

/* Prevent native long-press tooltips and drag behaviors on links/images/buttons */
/* -webkit-user-drag: none → desktop Safari only */
/* user-drag: none         → standard (limited support) */
/* draggable="false"       → must also be set as HTML attr on each <img> */
a, img, button {
    -webkit-touch-callout: none;   /* iOS: suppress "Save Image" / "Open Link" callout */
    -webkit-user-select: none;
    user-select: none;
    -webkit-user-drag: none;       /* desktop Safari */
    user-drag: none;               /* standard */
}

/* ── Images: comprehensive drag + context-menu prevention ─────────────
   On Android MAUI WebView, the native long-press triggers a drag gesture
   and "Save image" context menu UNLESS we block both:
   1. ondragstart via HTML attr draggable="false" (added to every <img>)
   2. The context-menu / touch-callout via CSS below
   ────────────────────────────────────────────────────────────────────── */
img {
    -webkit-user-drag: none;
    user-drag: none;
    -webkit-touch-callout: none;   /* iOS: no "Save to Photos" on long-press */
    pointer-events: none;          /* Blocks all touch/mouse events on <img> itself */
    /* touch-action: pan-x pan-y → allow page scroll but not drag-to-move */
    touch-action: pan-x pan-y;
    /* Prevent image ghost during drag (iOS/Android WebView) */
    -webkit-user-select: none;
    user-select: none;
}

/* Re-enable pointer events on interactive images (e.g. clickable profile pics) */
/* Add class "interactive-img" to any image that needs click/tap */
img.interactive-img {
    pointer-events: auto;
}


.glass-panel, .app-card {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 1rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
}

/* Edge-to-edge mobile formatting for app-cards */
@media (max-width: 640px) {
    .app-card {
        border-radius: 0;
        border-left: none;
        border-right: none;
        box-shadow: none;
    }
}

/* Native mobile touch interaction */
.active-bounce {
    transition: transform 0.1s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.1s ease;
}
.active-bounce:active {
    transform: scale(0.96);
    opacity: 0.8;
}

/* Liquid Glass Mobile Navigation */
.liquid-glass-nav-container {
    padding-bottom: calc(1.5rem + env(safe-area-inset-bottom));
    pointer-events: none; /* Let clicks pass through the container margin */
}

.liquid-glass-nav {
    pointer-events: auto;
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: 9999px; /* full pill shape */
    box-shadow: 0 10px 40px -10px rgba(0,0,0,0.15);
    margin: 0 1.25rem;
    position: relative;
    overflow: hidden;
}

.liquid-glass-item {
    position: relative;
    z-index: 2;
}

.liquid-glass-active-bg {
    position: absolute;
    inset: 0.35rem 0.75rem;
    background: rgba(99, 102, 241, 0.15); /* light indigo pill */
    border-radius: 9999px;
    z-index: -1;
    animation: liquidScale 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes liquidScale {
    0% { transform: scale(0.5); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

/* Animations from MVC project */
.animate-fade-in {
    animation: fadeIn 0.5s ease-out forwards;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideLeft {
    from { opacity: 0; transform: translateX(-30px); }
    to { opacity: 1; transform: translateX(0); }
}
.animate-slideLeft {
    animation: slideLeft 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}
.animate-slideUp {
    animation: slideUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-4px); }
    75% { transform: translateX(4px); }
}
.animate-shake {
    animation: shake 0.4s ease-in-out infinite;
}

/* Force vertical scrollbar to prevent layout shifts/shaking during animations */
html { overflow-y: scroll; overflow-x: hidden; }

/* ── iOS Safe Area / Notch Support ──────────────────────────────────────── */
/* Ensures env(safe-area-inset-*) variables work correctly.
   The viewport meta tag must have viewport-fit=cover (already set in App.razor). */
@supports (padding-top: env(safe-area-inset-top)) {
    :root {
        --sat: env(safe-area-inset-top);
        --sar: env(safe-area-inset-right);
        --sab: env(safe-area-inset-bottom);
        --sal: env(safe-area-inset-left);
    }
}

/* Hide sidebar scrollbar while maintaining functionality */
#sidebar::-webkit-scrollbar {
    display: none;
}
#sidebar {
    -ms-overflow-style: none; /* IE and Edge */
    scrollbar-width: none; /* Firefox */
}

/* Hide scrollbar for elements while maintaining functionality */
/* Used for horizontally scrollable rows on iOS/Android where native scrollbars look bad */
.hide-scrollbar::-webkit-scrollbar {
    display: none;
    height: 0;
    width: 0;
}
.hide-scrollbar {
    -ms-overflow-style: none;          /* IE and Edge */
    scrollbar-width: none;             /* Firefox */
    -webkit-overflow-scrolling: touch; /* iOS momentum/bounce scrolling */
    scroll-behavior: smooth;
}

/* Mini Sidebar Centering & Cleanup */
.collapsed-text nav a,
.collapsed-text nav button,
.collapsed-text form button {
    justify-content: center !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    gap: 0 !important;
    font-size: 0px !important;
}

.collapsed-text nav a svg,
.collapsed-text nav button svg,
.collapsed-text form button svg {
    opacity: 1 !important;
    margin: 0 !important;
}

.collapsed-text .tracking-widest {
    display: none !important;
}

.collapsed-text .logo-container {
    transform: scale(0.85);
}

/* Shake Animation for Toggle Button */
@keyframes shake-icon {
    0%, 100% { margin-left: 0; }
    25% { margin-left: -5px; }
    75% { margin-left: 5px; }
}

#desktopToggle:hover #toggleIcon {
    animation: shake-icon 0.45s ease-in-out infinite;
}

/* Blazor Error UI */
#blazor-error-ui {
    background: white;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}


#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}

/* Deal card image fallback — when /uploads/ path 404s in MAUI */
.deal-img-wrap { position: relative; overflow: hidden; }
.deal-img-wrap img {
    width: 100%; height: 100%; object-fit: cover;
    transition: transform 0.5s ease;
}
.deal-img-wrap img:not([src]),
.deal-img-wrap img[src=""],
.deal-img-wrap img.img-error {
    display: none;
}
.deal-img-placeholder {
    position: absolute; inset: 0;
    display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, #e0e7ff 0%, #ede9fe 100%);
    font-size: 2.5rem; font-weight: 900; color: #6366f1;
    letter-spacing: -0.05em;
}
.deal-img-wrap:has(img.img-error) .deal-img-placeholder,
.deal-img-wrap:has(img[src=""]) .deal-img-placeholder {
    display: flex;
}

/* ── Beautiful Scrollbar — global default ─────────────────────────────── */
/* Thin, subtle scrollbar for all scrollable elements */
* {
    scrollbar-width: thin;
    scrollbar-color: rgba(99, 102, 241, 0.18) transparent;
}
*::-webkit-scrollbar { width: 6px; height: 6px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, rgba(99,102,241,0.2), rgba(139,92,246,0.2));
    border-radius: 100px;
    border: 1px solid transparent;
    background-clip: padding-box;
}
*::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, rgba(99,102,241,0.45), rgba(139,92,246,0.45));
}
*::-webkit-scrollbar-corner { background: transparent; }

/* ── Custom scrollbar — premium variant for dropdowns & panels ──────── */
.custom-scrollbar { scrollbar-width: thin; scrollbar-color: rgba(99,102,241,0.25) transparent; }
.custom-scrollbar::-webkit-scrollbar { width: 5px; height: 5px; }
.custom-scrollbar::-webkit-scrollbar-track { background: transparent; margin: 4px 0; }
.custom-scrollbar::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #a5b4fc, #818cf8);
    border-radius: 100px;
    transition: background 0.2s;
}
.custom-scrollbar::-webkit-scrollbar-thumb:hover { background: linear-gradient(180deg, #818cf8, #6366f1); }

/* ── Filter bar horizontal scroll strip (Customer deal page) ─────────── */
/*
 * Mobile iOS/Android WebKit does NOT support ::-webkit-scrollbar on touch devices.
 * Strategy:
 *   1. Use -webkit-overflow-scrolling: touch for native momentum/bounce on iOS.
 *   2. Show a subtle gradient fade at right edge to hint "more content to scroll".
 *   3. Hide the native scrollbar track on mobile (it looks wrong in MAUI WebView).
 *   4. On desktop keep the pretty indigo scrollbar from the global * rule.
 */
.filter-scroll-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;                    /* gap-2 */
    overflow-x: auto;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;  /* iOS momentum scroll */
    scroll-behavior: smooth;
    /* Padding: top/bottom for button shadows, left/right so first/last buttons aren't clipped */
    padding: 0.5rem 0.25rem 0.75rem 0.25rem;
    /* Gradient fade at right edge — visual cue that there's more to scroll */
    -webkit-mask-image: linear-gradient(to right, black 85%, transparent 100%);
    mask-image: linear-gradient(to right, black 85%, transparent 100%);
    /* Scroll snap for smooth stop-points on mobile */
    scroll-snap-type: x proximity;
    /* Prevent line-wrap — all filter pills must stay on one row */
    white-space: nowrap;
    flex-wrap: nowrap;
}

/* Ensure each filter button doesn't shrink */
.filter-scroll-row .filter-btn {
    flex-shrink: 0;
    scroll-snap-align: start;
    white-space: nowrap;
}

/* On mobile: hide the scrollbar track entirely (it takes space and looks bad in MAUI) */
@media (max-width: 768px) {
    .filter-scroll-row::-webkit-scrollbar {
        display: none;
        height: 0;
        width: 0;
    }
    .filter-scroll-row {
        -ms-overflow-style: none;   /* IE/Edge */
        scrollbar-width: none;      /* Firefox */
    }
    /* Show full mask so content isn't clipped */
    .filter-scroll-row {
        -webkit-mask-image: none;
        mask-image: none;
        padding-bottom: 0.5rem;
    }
}

/* On desktop: restore the indigo scrollbar and remove mask */
@media (min-width: 769px) {
    .filter-scroll-row {
        scrollbar-width: thin;
        scrollbar-color: rgba(99,102,241,0.3) transparent;
    }
    .filter-scroll-row::-webkit-scrollbar { height: 4px; }
    .filter-scroll-row::-webkit-scrollbar-track { background: transparent; }
    .filter-scroll-row::-webkit-scrollbar-thumb {
        background: linear-gradient(90deg, #a5b4fc, #818cf8);
        border-radius: 100px;
    }
}

/* Animate bounce subtle for favorite heart */
@keyframes bounce-subtle {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-4px); }
}
.animate-bounce-subtle { animation: bounce-subtle 1.2s ease-in-out infinite; }

/* Sidebar nav active item */
aside nav a.nav-active {
    background: #4f46e5;
    color: #fff;
    box-shadow: 0 8px 25px -8px rgba(99,102,241,0.4);
}

/* Audit Info Tooltip — uses JS-driven fixed tooltip (#audit-flyout) to escape overflow clipping */
.audit-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #d1d5db; /* gray-300 */
    transition: color 0.2s;
}
.audit-icon:hover { color: #6366f1; /* indigo-500 */ }

/* The single global flyout rendered outside all overflow containers */
#audit-flyout {
    position: fixed;
    z-index: 9999;
    width: 268px;
    background: rgba(15, 23, 42, 0.96);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 16px;
    padding: 16px;
    color: #fff;
    font-size: 11px;
    line-height: 1.7;
    box-shadow: 0 24px 48px -8px rgba(0,0,0,0.55);
    backdrop-filter: blur(20px);
    pointer-events: none;
    opacity: 0;
    transform: scale(0.95) translateY(8px);
    transition: opacity 0.25s cubic-bezier(0.16,1,0.3,1),
                transform 0.25s cubic-bezier(0.16,1,0.3,1);
}
#audit-flyout.visible {
    opacity: 1;
    transform: scale(1) translateY(0);
}
#audit-flyout::after {
    content: "";
    position: absolute;
    top: var(--arrow-top, 18px); /* dynamically set by JS to track icon position */
    left: 100%;
    border-width: 6px;
    border-style: solid;
    border-color: transparent transparent transparent rgba(15,23,42,0.96);
}

/* Arrow flips to right side when flyout opens to the right of icon */
#audit-flyout.flyout-right::after {
    left: auto;
    right: 100%;
    border-color: transparent rgba(15,23,42,0.96) transparent transparent;
}

/* ── SortableJS drag-to-reorder visual feedback ──────────────────────────── */
/* The placeholder row shown at the drop target position */
.sortable-ghost {
    opacity: 0.35;
    background: rgba(99, 102, 241, 0.08) !important;
    border-top: 2px solid #6366f1 !important;
}

/* The row currently being held/dragged */
.sortable-chosen {
    background: rgba(99, 102, 241, 0.04) !important;
    box-shadow: 0 8px 24px -4px rgba(99, 102, 241, 0.2);
}

/* The floating clone while dragging */
.sortable-drag {
    opacity: 0.95;
    box-shadow: 0 20px 40px -8px rgba(0, 0, 0, 0.25);
    border-radius: 12px;
}


/* Custom styling for Blazor Validation Messages */
.validation-message {
    color: #ef4444; /* rose-500 */
    font-size: 0.65rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 0.25rem;
    animation: fadeInSlideUp 0.3s ease-out forwards;
}

.modified.invalid {
    border-color: #fecdd3 !important; /* rose-200 */
    background-color: #fff1f2 !important; /* rose-50 */
}

@keyframes fadeInSlideUp {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* == PageLoader Component == */
.page-loader-overlay {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
    width: 100%;
    animation: loaderFadeIn 0.3s ease-out;
}

.page-loader-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
    position: relative;
}

.page-loader-ring {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    border: 3px solid rgba(99, 102, 241, 0.1);
    border-top-color: #6366f1;
    animation: loaderSpin 1s cubic-bezier(0.6, 0.15, 0.35, 0.85) infinite;
    position: absolute;
    top: -8px;
    left: 50%;
    transform: translateX(-50%);
}

.page-loader-ring-inner {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 3px solid transparent;
    border-bottom-color: #8b5cf6;
    animation: loaderSpin 1.6s cubic-bezier(0.6, 0.15, 0.35, 0.85) infinite reverse;
}

.page-loader-logo {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    background: linear-gradient(135deg, #6366f1, #8b5cf6, #a78bfa);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 32px -4px rgba(99, 102, 241, 0.4);
    animation: loaderPulse 2s ease-in-out infinite;
}

.page-loader-logo span {
    color: #fff;
    font-size: 22px;
    font-weight: 900;
    letter-spacing: -0.02em;
}

.page-loader-text {
    display: flex;
    align-items: baseline;
    gap: 1px;
    margin-top: 4px;
}

.page-loader-shimmer {
    font-size: 10px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.25em;
    background: linear-gradient(90deg, #9ca3af 0%, #6366f1 50%, #9ca3af 100%);
    background-size: 200% 100%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: loaderShimmer 2s ease-in-out infinite;
}

.page-loader-dots .dot {
    font-size: 14px;
    font-weight: 900;
    color: #6366f1;
    animation: loaderDotBounce 1.4s ease-in-out infinite;
}
.page-loader-dots .dot-1 { animation-delay: 0s; }
.page-loader-dots .dot-2 { animation-delay: 0.2s; }
.page-loader-dots .dot-3 { animation-delay: 0.4s; }

@keyframes loaderFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes loaderSpin {
    to { transform: translateX(-50%) rotate(360deg); }
}

@keyframes loaderPulse {
    0%, 100% { transform: scale(1); box-shadow: 0 8px 32px -4px rgba(99, 102, 241, 0.4); }
    50% { transform: scale(1.06); box-shadow: 0 12px 40px -4px rgba(99, 102, 241, 0.55); }
}

@keyframes loaderShimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

@keyframes loaderDotBounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.3; }
    30% { transform: translateY(-6px); opacity: 1; }
}

/* Force-hide Google Translate banner globally on all platforms */
.goog-te-banner-frame.skiptranslate { display: none !important; }
iframe.skiptranslate { display: none !important; }
iframe[src*="translate"] { display: none !important; }
iframe[id=":1.container"] { display: none !important; }
body { top: 0px !important; position: static !important; }
html { top: 0px !important; position: static !important; margin-top: 0px !important; }
#goog-gt-tt, .goog-te-balloon-frame { display: none !important; }
.goog-text-highlight { background-color: transparent !important; box-shadow: none !important; }
.VIpgJd-ZVi9od-ORHb, .VIpgJd-ZVi9od-aZ2wEe-wOHMyf { display: none !important; }
