/* ============================================
   Ирвэс AI Assistant — Snow Leopard Chat UI
   ============================================ */

:root {
    --bg-deep: #030711;
    --bg-night: #07111f;
    --bg-surface: rgba(6, 16, 30, 0.78);
    --bg-glass: rgba(255, 255, 255, 0.06);
    --bg-glass-hover: rgba(255, 255, 255, 0.12);

    --border-subtle: rgba(214, 239, 255, 0.12);
    --border-glow: rgba(82, 211, 255, 0.45);

    --accent: #38bdf8;
    --accent-bright: #7dd3fc;
    --accent-deep: #0ea5e9;
    --accent-glow: rgba(56, 189, 248, 0.28);
    --accent-surface: rgba(56, 189, 248, 0.14);

    --snow: #f8fbff;
    --silver: #cbd5e1;

    --text-primary: #eef8ff;
    --text-secondary: #a8c3d7;
    --text-muted: #64798d;

    --bot-bg: rgba(255, 255, 255, 0.07);
    --user-bg: linear-gradient(135deg, #0ea5e9 0%, #2563eb 100%);

    --success: #34d399;
    --error-bg: rgba(239, 68, 68, 0.14);
    --error-text: #fca5a5;
    --error-border: rgba(239, 68, 68, 0.25);

    --radius-sm: 10px;
    --radius-md: 16px;
    --radius-lg: 22px;
    --radius-xl: 30px;

    --shadow-card:
        0 24px 80px rgba(0, 0, 0, 0.56),
        0 0 0 1px var(--border-subtle),
        0 0 50px rgba(56, 189, 248, 0.12);

    --shadow-glow: 0 0 36px var(--accent-glow);

    --font-body: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;

    --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-smooth: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-bounce: 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Reset */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-body);
    background: var(--bg-deep);
    color: var(--text-primary);
    min-height: 100vh;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
}

/* ============ App Wrapper ============ */
.app-wrapper {
    position: relative;
    width: 100vw;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px;
    isolation: isolate;
}

/* ============ Ambient Background ============ */
.ambient-bg {
    position: fixed;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
    z-index: 0;
    background:
        radial-gradient(circle at 18% 20%, rgba(56, 189, 248, 0.18), transparent 30%),
        radial-gradient(circle at 80% 35%, rgba(14, 165, 233, 0.12), transparent 30%),
        linear-gradient(180deg, #020617 0%, #07111f 50%, #0b1220 100%);
}

.ambient-bg::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image:
        radial-gradient(circle, rgba(255, 255, 255, 0.72) 1px, transparent 1.5px),
        radial-gradient(circle, rgba(125, 211, 252, 0.42) 1px, transparent 1.4px);
    background-size: 46px 46px, 90px 90px;
    background-position: 0 0, 30px 40px;
    opacity: 0.23;
    animation: snowFall 22s linear infinite;
}

@keyframes snowFall {
    from {
        transform: translateY(-40px);
    }

    to {
        transform: translateY(40px);
    }
}

.mountain {
    position: absolute;
    bottom: -110px;
    width: 70vw;
    height: 46vh;
    background: linear-gradient(135deg, rgba(148, 163, 184, 0.38), rgba(15, 23, 42, 0.1));
    clip-path: polygon(0 100%, 26% 35%, 39% 58%, 55% 20%, 72% 62%, 100% 100%);
    filter: blur(1px);
    opacity: 0.75;
}

.mountain-1 {
    left: -10vw;
}

.mountain-2 {
    right: -18vw;
    transform: scaleX(-1) scale(1.08);
    opacity: 0.5;
}

.snow-layer {
    position: absolute;
    inset: auto 0 0 0;
    height: 26vh;
    background: linear-gradient(180deg, transparent, rgba(226, 244, 255, 0.08));
    filter: blur(16px);
}

.orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.45;
    animation: orbFloat 20s ease-in-out infinite;
}

.orb-1 {
    width: 420px;
    height: 420px;
    background: radial-gradient(circle, rgba(56, 189, 248, 0.68) 0%, transparent 68%);
    top: -14%;
    left: -7%;
    animation-delay: 0s;
}

.orb-2 {
    width: 340px;
    height: 340px;
    background: radial-gradient(circle, rgba(14, 165, 233, 0.58) 0%, transparent 70%);
    bottom: -8%;
    right: -8%;
    animation-delay: -7s;
}

.orb-3 {
    width: 260px;
    height: 260px;
    background: radial-gradient(circle, rgba(186, 230, 253, 0.46) 0%, transparent 70%);
    top: 44%;
    left: 64%;
    animation-delay: -14s;
}

@keyframes orbFloat {
    0%, 100% {
        transform: translate(0, 0) scale(1);
    }

    33% {
        transform: translate(30px, -42px) scale(1.08);
    }

    66% {
        transform: translate(-20px, 24px) scale(0.94);
    }
}

/* ============ Decorative Snow Leopard Icon ============ */
.irves-hero {
    position: fixed;
    right: 6vw;
    bottom: 10vh;
    width: 330px;
    height: 390px;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    pointer-events: none;
    opacity: 0.98;
}

.irves-glow {
    position: absolute;
    width: 310px;
    height: 310px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(56, 189, 248, 0.25), transparent 70%);
    filter: blur(22px);
    animation: glowPulse 4s ease-in-out infinite;
}

.irves-hero-img {
    position: relative;
    width: 260px;
    height: 260px;
    object-fit: cover;
    border-radius: 58px;
    box-shadow:
        0 0 0 1px rgba(125, 211, 252, 0.30),
        0 0 38px rgba(56, 189, 248, 0.30),
        0 24px 60px rgba(0, 0, 0, 0.55);
    animation: iconFloat 4s ease-in-out infinite;
}

.irves-hero p {
    position: relative;
    margin-top: 14px;
    max-width: 280px;
    color: rgba(226, 244, 255, 0.84);
    font-size: 13px;
    line-height: 1.5;
    text-align: center;
    letter-spacing: 0.3px;
    text-shadow: 0 0 14px rgba(56, 189, 248, 0.25);
}

@keyframes glowPulse {
    0%, 100% {
        opacity: 0.6;
        scale: 1;
    }

    50% {
        opacity: 1;
        scale: 1.06;
    }
}

@keyframes iconFloat {
    0%, 100% {
        transform: translateY(0) scale(1);
    }

    50% {
        transform: translateY(-8px) scale(1.03);
    }
}

/* ============ Chat Container ============ */
.chat-container {
    position: relative;
    z-index: 2;
    width: min(980px, calc(100vw - 40px));
    height: min(860px, calc(100vh - 48px));
    max-width: 980px;
    margin-right: 260px;
    background:
        linear-gradient(180deg, rgba(8, 20, 36, 0.84), rgba(3, 7, 18, 0.76)),
        var(--bg-surface);
    backdrop-filter: blur(34px);
    -webkit-backdrop-filter: blur(34px);
    border-radius: var(--radius-xl);
    border: 1px solid var(--border-subtle);
    box-shadow: var(--shadow-card);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: containerIn 0.65s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.chat-container::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        linear-gradient(120deg, transparent 0%, rgba(125, 211, 252, 0.08) 48%, transparent 55%),
        radial-gradient(circle at 15% 0%, rgba(125, 211, 252, 0.10), transparent 34%);
    pointer-events: none;
    opacity: 0.75;
}

@keyframes containerIn {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.97);
    }
}

/* ============ Header ============ */
.chat-header {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 22px;
    background: rgba(255, 255, 255, 0.055);
    border-bottom: 1px solid var(--border-subtle);
    flex-shrink: 0;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.bot-avatar {
    position: relative;
    flex-shrink: 0;
}

.avatar-ring {
    width: 50px;
    height: 50px;
    border-radius: 17px;
    background:
        radial-gradient(circle at 30% 20%, rgba(255, 255, 255, 0.22), transparent 35%),
        var(--accent-surface);
    border: 1px solid var(--border-glow);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-smooth);
    box-shadow: 0 0 20px rgba(56, 189, 248, 0.16);
    overflow: hidden;
}

.avatar-ring:hover {
    background: var(--accent-glow);
    box-shadow: var(--shadow-glow);
    transform: rotate(-3deg) scale(1.03);
}

.irves-logo-img {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    object-fit: cover;
    display: block;
    filter: drop-shadow(0 0 10px rgba(125, 211, 252, 0.55));
}

.status-dot {
    position: absolute;
    bottom: -1px;
    right: -1px;
    width: 13px;
    height: 13px;
    background: var(--success);
    border-radius: 50%;
    border: 2.5px solid var(--bg-deep);
    box-shadow: 0 0 10px rgba(52, 211, 153, 0.75);
}

.header-info h1 {
    font-size: 17px;
    font-weight: 700;
    letter-spacing: -0.3px;
    color: var(--text-primary);
}

.status-text {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--success);
    font-weight: 500;
}

.pulse-dot {
    width: 6px;
    height: 6px;
    background: var(--success);
    border-radius: 50%;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.5;
        transform: scale(0.8);
    }
}

.header-actions {
    display: flex;
    gap: 4px;
}

.icon-btn {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-fast);
}

.icon-btn:hover {
    background: var(--bg-glass-hover);
    border-color: var(--border-subtle);
    color: var(--text-primary);
    box-shadow: 0 0 18px rgba(56, 189, 248, 0.14);
}

/* ============ Brand Strip ============ */
.brand-strip {
    position: relative;
    z-index: 1;
    padding: 14px 22px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border-bottom: 1px solid var(--border-subtle);
    background:
        linear-gradient(90deg, rgba(56, 189, 248, 0.10), rgba(255, 255, 255, 0.03));
}

.brand-kicker {
    display: block;
    color: var(--accent-bright);
    font-size: 10px;
    font-family: var(--font-mono);
    letter-spacing: 1.2px;
    text-transform: uppercase;
    margin-bottom: 4px;
}

.brand-strip h2 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.online-badge {
    flex-shrink: 0;
    font-size: 11px;
    color: #bbf7d0;
    background: rgba(34, 197, 94, 0.10);
    border: 1px solid rgba(34, 197, 94, 0.22);
    padding: 6px 10px;
    border-radius: 999px;
    margin-left: auto;
}

/* ============ Messages Area ============ */
.chat-messages {
    position: relative;
    z-index: 1;
    flex: 1;
    overflow-y: auto;
    padding: 26px 34px;
    display: flex;
    flex-direction: column;
    gap: 9px;
    scroll-behavior: smooth;
}

.chat-messages::-webkit-scrollbar {
    width: 4px;
}

.chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: rgba(125, 211, 252, 0.25);
    border-radius: 4px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: rgba(125, 211, 252, 0.5);
}

/* ============ Welcome Card ============ */
.welcome-card {
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.035));
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 30px 28px;
    text-align: center;
    margin-bottom: 8px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.welcome-irves-icon {
    width: 92px;
    height: 92px;
    border-radius: 28px;
    object-fit: cover;
    margin-bottom: 14px;
    box-shadow:
        0 0 0 1px rgba(125, 211, 252, 0.35),
        0 0 28px rgba(56, 189, 248, 0.28),
        0 14px 34px rgba(0, 0, 0, 0.35);
    animation: welcomeIconFloat 3s ease-in-out infinite;
}

@keyframes welcomeIconFloat {
    0%, 100% {
        transform: translateY(0) scale(1);
    }

    50% {
        transform: translateY(-6px) scale(1.03);
    }
}

.welcome-card h2 {
    font-size: 21px;
    font-weight: 700;
    margin-bottom: 8px;
    letter-spacing: -0.4px;
}

.welcome-card p {
    max-width: 620px;
    margin: 0 auto 22px;
    font-size: 13.5px;
    color: var(--text-secondary);
    line-height: 1.65;
}

.quick-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 9px;
}

.quick-btn {
    display: flex;
    align-items: center;
    gap: 9px;
    width: 100%;
    padding: 12px 14px;
    background: rgba(255, 255, 255, 0.055);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-fast);
    text-align: left;
}

.quick-btn:hover {
    background: var(--accent-surface);
    border-color: var(--border-glow);
    transform: translateY(-2px);
    box-shadow: 0 10px 26px rgba(14, 165, 233, 0.14);
}

.quick-icon {
    font-size: 17px;
    flex-shrink: 0;
}

/* ============ Message Bubbles ============ */
.message-row {
    display: flex;
    flex-direction: column;
    max-width: 72%;
    animation: messageIn 0.35s var(--transition-bounce) both;
}

@keyframes messageIn {
    from {
        opacity: 0;
        transform: translateY(10px) scale(0.97);
    }
}

.message-row.user {
    align-self: flex-end;
    align-items: flex-end;
    margin-left: auto;
}

.message-row.bot,
.message-row.loading,
.message-row.error {
    align-self: flex-start;
    align-items: flex-start;
}

.message-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 4px;
    padding: 0 4px;
    text-transform: uppercase;
    letter-spacing: 0.6px;
}

.message-bubble {
    padding: 12px 16px;
    font-size: 14px;
    line-height: 1.65;
    word-wrap: break-word;
    white-space: pre-wrap;
}

.message-row.user .message-bubble {
    background: var(--user-bg);
    color: #fff;
    border-radius: var(--radius-md) var(--radius-md) 5px var(--radius-md);
    box-shadow: 0 8px 24px rgba(14, 165, 233, 0.28);
}

.message-row.bot .message-bubble {
    max-width: 620px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.075), rgba(255, 255, 255, 0.04));
    border: 1px solid var(--border-subtle);
    color: var(--text-primary);
    border-radius: var(--radius-md) var(--radius-md) var(--radius-md) 5px;
}

.message-time {
    font-size: 10px;
    color: var(--text-muted);
    margin-top: 4px;
    padding: 0 4px;
    font-family: var(--font-mono);
}

/* Loading */
.message-row.loading .message-bubble {
    background: var(--bg-glass);
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    border-radius: var(--radius-md) var(--radius-md) var(--radius-md) 5px;
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 14px 20px;
}

.typing-dots {
    display: flex;
    gap: 4px;
}

.typing-dots span {
    width: 7px;
    height: 7px;
    background: var(--accent);
    border-radius: 50%;
    animation: dotBounce 1.4s ease-in-out infinite;
    box-shadow: 0 0 8px rgba(125, 211, 252, 0.55);
}

.typing-dots span:nth-child(2) {
    animation-delay: 0.15s;
}

.typing-dots span:nth-child(3) {
    animation-delay: 0.3s;
}

@keyframes dotBounce {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.4;
    }

    30% {
        transform: translateY(-6px);
        opacity: 1;
    }
}

/* Error */
.message-row.error .message-bubble {
    background: var(--error-bg);
    border: 1px solid var(--error-border);
    color: var(--error-text);
    border-radius: var(--radius-md) var(--radius-md) var(--radius-md) 5px;
}

/* ============ Input Area ============ */
.chat-input-area {
    position: relative;
    z-index: 1;
    padding: 18px 24px 16px;
    background: rgba(255, 255, 255, 0.045);
    border-top: 1px solid var(--border-subtle);
    flex-shrink: 0;
}

.input-wrapper {
    display: flex;
    align-items: center;
    background: rgba(2, 6, 23, 0.46);
    border: 1px solid var(--border-subtle);
    border-radius: 18px;
    padding: 4px 4px 4px 16px;
    transition: var(--transition-fast);
}

.input-wrapper:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.input-wrapper input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 14px;
    padding: 10px 0;
}

.input-wrapper input::placeholder {
    color: var(--text-muted);
}

.input-wrapper button {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    border: none;
    background: linear-gradient(135deg, var(--accent), var(--accent-deep));
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-fast);
    flex-shrink: 0;
    box-shadow: 0 0 18px rgba(56, 189, 248, 0.28);
}

.input-wrapper button:hover {
    background: linear-gradient(135deg, var(--accent-bright), var(--accent));
    transform: scale(1.05);
}

.input-wrapper button:active {
    transform: scale(0.95);
}

.input-wrapper button:disabled {
    background: var(--text-muted);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.input-footer {
    text-align: center;
    margin-top: 10px;
    font-size: 11px;
    color: var(--text-muted);
    letter-spacing: 0.3px;
}

/* ============ Animations ============ */
.fade-in {
    animation: fadeIn 0.5s ease both;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
}

/* ============ Responsive ============ */
@media (max-width: 1280px) {
    .chat-container {
        margin-right: 0;
    }

    .irves-hero {
        opacity: 0.16;
        right: 2vw;
        bottom: 7vh;
        transform: scale(0.86);
    }
}

@media (max-width: 780px) {
    .app-wrapper {
        padding: 0;
    }

    .chat-container {
        width: 100vw;
        height: 100vh;
        max-width: 100vw;
        border-radius: 0;
        border: none;
        margin-right: 0;
    }

    .brand-strip {
        align-items: flex-start;
    }

    .brand-strip h2 {
        font-size: 13px;
    }

    .online-badge {
        display: none;
    }

    .chat-messages {
        padding: 18px;
    }

    .message-row {
        max-width: 90%;
    }

    .quick-actions {
        grid-template-columns: 1fr;
        gap: 7px;
    }

    .irves-hero {
        display: none;
    }
}