/* Landing Screen and Chat Container Animations */

/* Landing container is always visible, no transitions */
.landing-container {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100vh;
    z-index: 1;
}

/* Chat container slides over landing screen */
.chat-container {
    position: fixed;
    top: env(safe-area-inset-top);
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: calc(100vh - env(safe-area-inset-top));
    transition: transform 0.4s ease-in-out;
    will-change: transform;
    clip-path: url(#chat-clip-path);
    -webkit-clip-path: url(#chat-clip-path);
}

/* Glassy blur overlay for chat container */
.chat-container::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
    pointer-events: none;
    z-index: 0;
}

/* Chat Interface States */
.chat-container.chat-visible {
    transform: translateY(0);
    z-index: 10;
}

.chat-container.chat-hidden {
    transform: translateY(100vh);
    z-index: 5;
    pointer-events: none;
}

/* Landing Screen Layout */
.landing-screen {
    display: flex;
    flex-direction: column;
    height: 100vh;
    background-color: white;
    background-image: url('/_content/UIOne.Shared/img/desktopBackground.png');
    background-position: top right;
    background-size: cover;
    background-repeat: no-repeat;
    overflow: hidden;
    padding: env(safe-area-inset-top) env(safe-area-inset-right) calc(env(safe-area-inset-bottom) + 5px) env(safe-area-inset-left);
}

.landing-content {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 20px;
    padding-bottom: calc(100px + env(safe-area-inset-bottom));
    display: flex;
    flex-direction: column;
}

.landing-header {
    margin-bottom: 30px;
    padding-top: 100px; /* Space for profile button */
}

.landing-greeting {
    color: #212529;
    font-size: 32px;
    font-weight: 700;
    margin: 0 0 10px 0;
    text-align: center;
}

.landing-subtitle {
    color: #6c757d;
    font-size: 18px;
    font-weight: 400;
    margin: 0;
    text-align: center;
}

/* Landing Cards Grid */
.landing-cards {
    display: grid;
    gap: 16px;
    margin-bottom: 20px;
    margin-top: 90px;
    opacity: 1;
    transition: opacity 0.3s ease;
    pointer-events: auto;
}

.landing-cards.fade-out {
    opacity: 0;
    pointer-events: none;
}

@media (min-width: 768px) {
    .landing-cards {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    .landing-cards {
        grid-template-columns: repeat(3, 1fr);
    }
}

.landing-card-wrapper {
    border-radius: 12px;
    overflow: visible;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    cursor: pointer;
}

.landing-card-wrapper:hover {
    transform: translateY(-4px);
}

.landing-card-wrapper:active {
    transform: translateY(-2px);
}

.landing-card-wrapper .message-content {
    margin: 0;
    padding: 0;
    background-color: white;
    color: #212529;
    border-radius: 12px;
    position: relative;
    pointer-events: none; /* Prevent adaptive card from blocking clicks */
}

.landing-card-wrapper .message-content * {
    pointer-events: none; /* Prevent all children from blocking clicks */
}

/* Create gradient border using a pseudo-element (matching AI messages) */
.landing-card-wrapper:first-of-type .message-content::before {
    background: linear-gradient(45deg, #00965A, #26C485) border-box;
    -webkit-mask:
      linear-gradient(#26C485 0 0) content-box,
      linear-gradient(#00965A 0 0);
    mask:
      linear-gradient(#26C485 0 0) content-box,
      linear-gradient(#00965A 0 0);
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 12px;
    border: 1px solid transparent;
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
}

.landing-card-wrapper:not(:first-of-type) .message-content::before {
    background: linear-gradient(45deg, #4A90E2, #78A9F1) border-box;
    -webkit-mask:
      linear-gradient(#78A9F1 0 0) content-box,
      linear-gradient(#4A90E2 0 0);
    mask:
      linear-gradient(#78A9F1 0 0) content-box,
      linear-gradient(#4A90E2 0 0);
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 12px;
    border: 1px solid transparent;
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
}


/* Loading State */
.landing-loading {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 60px 20px;
}

.landing-loading .typing-indicator {
    display: flex;
    gap: 8px;
}

.landing-loading .typing-indicator .dot {
    width: 12px;
    height: 12px;
    background-color: var(--orion-50);
    border-radius: 50%;
    animation: dot-flashing 1.4s infinite linear;
}

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

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

@keyframes dot-flashing {
    0%, 50%, 100% {
        opacity: 0.3;
        transform: scale(0.8);
    }
    25% {
        opacity: 1;
        transform: scale(1);
    }
}

/* Error State */
.landing-error {
    padding: 40px 20px;
    text-align: center;
}

.landing-error p {
    color: white;
    font-size: 16px;
    margin: 0;
}

/* Responsive adjustments */
@media (max-width: 767px) {
    .landing-header {
        padding-top: 90px; /* Keep space for profile button on mobile */
    }

    .landing-greeting {
        font-size: 28px;
    }

    .landing-subtitle {
        font-size: 16px;
    }
}

/* iOS specific adjustments */
@supports (-webkit-touch-callout: none) {
    .landing-screen {
        /* height: -webkit-fill-available; */
    }
}

/* Ensure smooth scrolling on mobile */
.landing-content {
    scroll-behavior: smooth;
}

/* Accessibility improvements */
@media (prefers-reduced-motion: reduce) {
    .chat-container,
    .landing-card-wrapper {
        transition: none;
    }
}

.landing-screen .landing-card-wrapper:first-of-type .message-content {
    background-color: #F0FFF9;
}

div#landing-card-0 div.ac-adaptiveCard div.ac-textBlock:first-of-type {
    font-family: 'Syne' !important;
    font-size: 3em !important;
    line-height: normal !important;
}

div#landing-card-0 div.ac-adaptiveCard div.ac-textBlock:not(:first-of-type) {
    font-size: 1.1em !important;
    line-height: 1.4em !important;
    margin-top: 1em;
}
