/* 
  GoOfferHub Base CSS - Precisely matched to MVC project
  (Relies primarily on Tailwind CSS loaded via CDN)
*/

body { 
    font-family: 'Outfit', sans-serif; 
}

.glass-panel {
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(255, 255, 255, 0.5);
}

/* 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 */
.hide-scrollbar::-webkit-scrollbar {
    display: none;
}
.hide-scrollbar {
    -ms-overflow-style: none; /* IE and Edge */
    scrollbar-width: none; /* Firefox */
}

/* 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); }

/* ── Horizontal deal-row scrollbar — sleek pill on hover ────────────── */
.deal-scroll-row { scrollbar-width: thin; scrollbar-color: transparent transparent; }
.deal-scroll-row::-webkit-scrollbar { height: 4px; }
.deal-scroll-row::-webkit-scrollbar-track { background: transparent; margin: 0 8px; }
.deal-scroll-row::-webkit-scrollbar-thumb {
    background: transparent;
    border-radius: 100px;
    transition: background 0.3s;
}
.deal-scroll-row:hover { scrollbar-color: rgba(99,102,241,0.3) rgba(241,245,249,0.5); }
.deal-scroll-row:hover::-webkit-scrollbar-thumb {
    background: linear-gradient(90deg, #a5b4fc, #818cf8, #a5b4fc);
}
.deal-scroll-row:hover::-webkit-scrollbar-track {
    background: rgba(241, 245, 249, 0.5);
    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; }
}
