/* ─── MuseAIInviteCode.com Premium Style System ─── */
:root {
    --primary-indigo: #6366f1;
    --primary-indigo-hover: #4f46e5;
    --primary-violet: #8b5cf6;
    --primary-cyan: #06b6d4;
    --primary-emerald: #10b981;
    --dark-bg: #090d16;
    --dark-card: #0f172a;
    --dark-card-border: #1e293b;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
}

/* Base resets & typography */
html {
    scroll-behavior: smooth;
    scroll-padding-top: 84px;
    -webkit-text-size-adjust: 100%;
}

body {
    background-color: var(--dark-bg);
    color: var(--text-primary);
    font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    overflow-x: hidden;
    width: 100%;
}

/* Image resets & CLS layout shift prevention */
img {
    max-width: 100%;
    height: auto;
    display: block;
}

figure {
    margin: 0;
}

figure img {
    width: 100%;
    height: auto;
    aspect-ratio: 1200 / 630;
    object-fit: cover;
}

/* Author image aspect ratio */
img[src*="author.jpg"] {
    aspect-ratio: 1 / 1;
    object-fit: cover;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}
::-webkit-scrollbar-track {
    background: #090d16;
}
::-webkit-scrollbar-thumb {
    background: #1e293b;
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: #334155;
}

/* Custom Glow Animations */
.pulse-glow-purple {
    animation: purplePulse 2.8s infinite;
}

@keyframes purplePulse {
    0% {
        box-shadow: 0 0 0 0 rgba(139, 92, 246, 0.45);
    }
    70% {
        box-shadow: 0 0 0 14px rgba(139, 92, 246, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(139, 92, 246, 0);
    }
}

.pulse-glow-emerald {
    animation: emeraldPulse 2.5s infinite;
}

@keyframes emeraldPulse {
    0% {
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.45);
    }
    70% {
        box-shadow: 0 0 0 12px rgba(16, 185, 129, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
    }
}

/* Touch fixes for iOS Safari */
.copy-btn {
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    user-select: none;
}
#mobile-menu-btn {
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

/* ─── Copy Toast Notification (Top Center) ─── */
.toast-container {
    position: fixed;
    top: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(-24px);
    z-index: 9999;
    opacity: 0;
    pointer-events: none;
    transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.toast-container.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
    pointer-events: auto;
}

.toast-content {
    background: linear-gradient(135deg, #1e1b4b 0%, #0f172a 100%);
    border: 1px solid rgba(139, 92, 246, 0.3);
    color: #f8fafc;
    padding: 12px 26px;
    border-radius: 9999px;
    font-size: 14px;
    font-weight: 700;
    box-shadow: 0 20px 35px -5px rgba(0, 0, 0, 0.5), 0 0 20px rgba(139, 92, 246, 0.2);
    display: flex;
    align-items: center;
    gap: 10px;
}

.toast-checkmark {
    color: #34d399;
    font-size: 16px;
}

/* ─── Live Social Proof Toast (Bottom Left) ─── */
.social-proof-toast {
    position: fixed;
    bottom: 96px;
    left: 20px;
    z-index: 900;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 12px 18px;
    border-radius: 16px;
    box-shadow: 0 20px 35px -10px rgba(0, 0, 0, 0.5), 0 0 15px rgba(99, 102, 241, 0.15);
    display: flex;
    align-items: center;
    gap: 12px;
    max-width: 320px;
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    pointer-events: none;
}

@media (min-width: 768px) {
    .social-proof-toast {
        bottom: 24px;
        max-width: 360px;
    }
}

.social-proof-toast.show {
    transform: translateY(0);
    opacity: 1;
}

.sp-avatar {
    width: 34px;
    height: 34px;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 800;
    flex-shrink: 0;
    box-shadow: 0 0 12px rgba(139, 92, 246, 0.4);
}

.sp-text {
    font-size: 12px;
    color: #cbd5e1;
    line-height: 1.45;
    font-weight: 500;
}

.sp-text strong {
    color: #ffffff;
    font-weight: 700;
}

/* ─── Muse AI Floating Chat Widget ─── */
.ai-chat-container {
    position: fixed;
    bottom: 84px;
    right: 20px;
    z-index: 1000;
}

@media (min-width: 768px) {
    .ai-chat-container {
        bottom: 24px;
    }
}

.ai-chat-toggle {
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    padding: 12px 20px;
    border-radius: 9999px;
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
    box-shadow: 0 10px 25px -5px rgba(79, 70, 229, 0.5), 0 0 15px rgba(124, 58, 237, 0.3);
    display: flex;
    align-items: center;
    gap: 8px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.ai-chat-toggle:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 30px -5px rgba(79, 70, 229, 0.6), 0 0 20px rgba(124, 58, 237, 0.4);
}

.ai-chat-toggle:active {
    transform: translateY(0);
}

.ai-icon {
    width: 18px;
    height: 18px;
    color: #a7f3d0;
}

.ai-chat-box {
    display: none;
    flex-direction: column;
    position: absolute;
    bottom: 70px;
    right: 0;
    width: 330px;
    height: 460px;
    background: #0f172a;
    border-radius: 20px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.65), 0 0 30px rgba(99, 102, 241, 0.2);
    border: 1px solid #1e293b;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    transform-origin: bottom right;
}

@media (max-width: 480px) {
    .ai-chat-box {
        position: fixed;
        bottom: 80px;
        left: 16px;
        right: 16px;
        width: auto;
        height: calc(100vh - 130px);
        max-height: 480px;
    }
}

@media (min-width: 480px) {
    .ai-chat-box {
        width: 370px;
        height: 500px;
    }
}

.ai-chat-box.open {
    display: flex;
    animation: scaleInChat 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes scaleInChat {
    0% {
        transform: scale(0.8) translateY(30px);
        opacity: 0;
    }
    100% {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
}

.ai-chat-header {
    background: linear-gradient(135deg, #1e1b4b 0%, #0f172a 100%);
    color: white;
    padding: 14px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.ai-chat-header-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.ai-chat-title {
    font-weight: 800;
    font-size: 14px;
    letter-spacing: -0.01em;
}

.ai-chat-subtitle {
    font-size: 11px;
    color: #94a3b8;
    display: flex;
    align-items: center;
    gap: 5px;
    font-weight: 500;
}

.ai-chat-online {
    display: inline-block;
    width: 6px;
    height: 6px;
    background-color: #10b981;
    border-radius: 50%;
    box-shadow: 0 0 8px #10b981;
}

.ai-chat-close {
    background: transparent;
    border: none;
    color: #94a3b8;
    font-size: 16px;
    cursor: pointer;
    padding: 4px;
    transition: color 0.15s ease;
}

.ai-chat-close:hover {
    color: white;
}

.ai-chat-messages {
    flex-grow: 1;
    padding: 16px;
    overflow-y: auto;
    background-color: #0b1120;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.ai-message {
    max-width: 82%;
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 13px;
    line-height: 1.5;
    word-wrap: break-word;
}

.ai-message-received {
    align-self: flex-start;
    background-color: #1e293b;
    color: #f1f5f9;
    border-bottom-left-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.ai-message-sent {
    align-self: flex-end;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: white;
    border-bottom-right-radius: 4px;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.25);
}

.ai-chat-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
    margin-bottom: 2px;
}

.ai-chip {
    background-color: #1e293b;
    border: 1px solid #334155;
    color: #e2e8f0;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
}

.ai-chip:hover {
    border-color: #8b5cf6;
    color: #a78bfa;
    background-color: #2e1065;
}

.ai-typing-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 12px 16px;
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 16px;
    border-bottom-left-radius: 4px;
    align-self: flex-start;
    width: fit-content;
}

.ai-typing-dot {
    width: 6px;
    height: 6px;
    background-color: #94a3b8;
    border-radius: 50%;
    animation: typingPulse 1.2s infinite ease-in-out;
}

.ai-typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.ai-typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typingPulse {
    0%, 100% {
        transform: translateY(0);
        opacity: 0.4;
    }
    50% {
        transform: translateY(-4px);
        opacity: 1;
    }
}

.ai-chat-input-area {
    padding: 10px 14px;
    background-color: #0f172a;
    border-top: 1px solid #1e293b;
    display: flex;
    gap: 8px;
    align-items: center;
}

.ai-chat-input-area input {
    flex-grow: 1;
    border: 1px solid #334155;
    border-radius: 12px;
    padding: 8px 14px;
    font-size: 13px;
    outline: none;
    background-color: #0b1120;
    color: #f8fafc;
    transition: all 0.15s ease;
    font-weight: 500;
}

.ai-chat-input-area input:focus {
    border-color: #8b5cf6;
    box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.2);
}

.ai-chat-send {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: white;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.15s ease, transform 0.1s active;
    flex-shrink: 0;
}

.ai-chat-send:hover {
    opacity: 0.9;
}

.ai-chat-send:active {
    transform: scale(0.95);
}

.ai-chat-footer {
    font-size: 10px;
    color: #64748b;
    text-align: center;
    padding: 6px;
    background-color: #0b1120;
    border-top: 1px solid #1e293b;
    font-weight: 500;
}

/* Accordion details/summary polish */
details summary::-webkit-details-marker {
    display: none;
}
details summary {
    list-style: none;
}
details[open] summary svg {
    transform: rotate(180deg);
}

/* Custom styled badge gradients */
.badge-gradient {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.15) 0%, rgba(139, 92, 246, 0.15) 100%);
    border: 1px solid rgba(139, 92, 246, 0.3);
}

/* Card hover glow */
.card-hover-glow {
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.card-hover-glow:hover {
    transform: translateY(-4px);
    border-color: rgba(139, 92, 246, 0.4);
    box-shadow: 0 20px 30px -10px rgba(0, 0, 0, 0.5), 0 0 20px rgba(99, 102, 241, 0.15);
}

/* ─── Touch Targets, Scrollbars & Responsive Polish ─── */
button,
.copy-btn,
#mobile-menu-btn,
summary {
    min-height: 44px;
    touch-action: manipulation;
}

/* Responsive Table Styling */
.overflow-x-auto {
    -webkit-overflow-scrolling: touch;
}
.overflow-x-auto::-webkit-scrollbar {
    height: 6px;
}
.overflow-x-auto::-webkit-scrollbar-thumb {
    background: #334155;
    border-radius: 9999px;
}

/* Content visibility for below-the-fold speed */
.content-visibility-auto {
    content-visibility: auto;
    contain-intrinsic-size: 1px 600px;
}

/* Extra mobile layout polish for screens <= 640px */
@media (max-width: 640px) {
    /* Safe container padding */
    main, section {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    /* Copy toast positioning on mobile */
    .toast-container {
        top: 14px;
        width: calc(100% - 24px);
    }
    .toast-content {
        padding: 10px 18px;
        font-size: 13px;
        justify-content: center;
        text-align: center;
    }

    /* Social proof toast mobile positioning */
    .social-proof-toast {
        bottom: 74px;
        left: 10px;
        right: 10px;
        max-width: calc(100vw - 20px);
        padding: 10px 14px;
        border-radius: 14px;
    }
    .sp-text {
        font-size: 11px;
    }
    .sp-avatar {
        width: 28px;
        height: 28px;
        font-size: 11px;
    }

    /* Floating Chat widget mobile sizing */
    .ai-chat-container {
        bottom: 74px;
        right: 12px;
    }
    .ai-chat-toggle {
        padding: 10px 16px;
        font-size: 12px;
    }
    .ai-chat-box {
        bottom: 70px;
        left: 8px;
        right: 8px;
        width: auto;
        height: calc(100vh - 110px);
        max-height: 520px;
    }

    /* Ensure tables have comfortable padding on mobile */
    table th, table td {
        padding: 12px 14px !important;
        font-size: 12px !important;
    }
}


/* ─── Compact Mobile Display & Typography Scaling ─── */
@media (max-width: 640px) {
    html {
        font-size: 15px;
    }
    h1 {
        line-height: 1.25 !important;
        letter-spacing: -0.02em !important;
    }
    h2 {
        line-height: 1.3 !important;
        letter-spacing: -0.01em !important;
    }
    h3 {
        line-height: 1.35 !important;
    }
    p, li {
        line-height: 1.55 !important;
    }
}

@media (max-width: 380px) {
    html {
        font-size: 14px;
    }
}
