body {
    font-family: Arial, sans-serif;
    background: #f9f9f9;
    margin: 0;
    display: flex;
    align-items: center;
    /* Mobile fixes */
    overflow-x: hidden;
}

/* iOS Safari specific fixes */
@supports (-webkit-touch-callout: none) {
    body {
        height: -webkit-fill-available;
    }

    #container-main {
        height: -webkit-fill-available;
    }
}

#container-main {
    display: flex;
    width: 100vw;
    height: 100vh;
    height: 100dvh; /* Dynamic viewport height for mobile browsers */
    justify-content: center;
}

#panel {
    width: 100%;
    max-width: 800px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    box-sizing: border-box;
    background-color: #FAFAFA;
    height: 100%;
}

#chat-container {
    width: 100%;
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    padding: 1.5rem 1rem;
    box-sizing: border-box;
    gap: 1.2rem;
}

.start-screen {
    width: 100%;
    padding: 2.5rem 1.5rem 2rem;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 1.75rem;
    justify-content: center;
    flex: 1;
}

.start-screen.hidden {
    display: none;
}

.brand-identity {
    width: 128px;
    height: 128px;
    border-radius: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(180deg, #FFFFFF 0%, #F3F5F8 100%);
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.12);
    overflow: hidden;
}

.brand-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.brand-image.hidden {
    display: none;
}

.brand-icon {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #1976D2;
    font-size: 48px;
}

.start-copy .welcome-title {
    font-size: 26px;
    font-weight: 600;
    margin: 0;
    color: #212121;
}

.start-copy .welcome-subtitle {
    margin: 0;
    color: #5F6368;
    line-height: 1.6;
    font-size: 16px;
}

.start-form-wrapper {
    width: 100%;
    max-width: 480px;
}

.message-form {
    width: 100%;
    box-sizing: border-box;
}

.message-form .input-group {
    display: flex;
    align-items: center;
    background: #FFFFFF;
    border-radius: 24px;
    padding: 4px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.25);
    border: 1px solid #9E9E9E;
    position: relative;
}

#message-input {
    flex: 1;
    padding: 16px 18px;
    font-size: 16px;
    background: transparent;
    border: none;
    outline: none;
    color: #212121;
    min-height: 40px;
}

#message-input::placeholder {
    color: #9aa0a6;
}

#message-input:disabled {
    color: #999;
    cursor: not-allowed;
}

.input-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: 10px;
}

.icon-button {
    color: #343434;
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 18px;
    padding: 10px 12px;
    border-radius: 16px;
    transition: background 0.2s ease, color 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.attachment-button {
    font-size: 20px;
    padding: 10px 14px;
    margin-right: 6px;
    border-radius: 16px;
}

.attachment-button:hover {
    background: rgba(0, 0, 0, 0.05);
}

.icon-button:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

.icon-button:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

.mic-button {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.04);
    margin-right: 2px;
}

.mic-button:hover {
    background: rgba(0, 0, 0, 0.08);
}

.mic-button.listening {
    background: rgba(25, 118, 210, 0.12);
    color: #1976D2;
}

.mic-button.mic-unavailable {
    background: rgba(0, 0, 0, 0.04);
    color: #9AA0A6;
    cursor: not-allowed;
}

.send-button {
    background: #E0E0E0;
    color: #212121;
    border: 1px solid rgba(0,0,0,0.05);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    cursor: pointer;
    transition: background 0.2s ease;
    justify-self: end;
}

.send-button i {
    transform: translateX(1px);
}

.send-button:hover:not(:disabled) {
    background: #C7C7C7;
}

.send-button:disabled {
    background: #E0E0E0;
    cursor: not-allowed;
}

.suggestions-list {
    list-style: none;
    padding: 0;
    margin: 0;
    width: 100%;
    max-width: 460px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.suggestion-item {
    background: #FFFFFF;
    border-radius: 20px;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    border: 1px solid rgba(25, 118, 210, 0.1);
    box-shadow: 0 8px 18px rgba(16, 53, 120, 0.08);
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.suggestion-item:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 24px rgba(16, 53, 120, 0.14);
}

.suggestion-item i {
    color: #1976D2;
}

.suggestion-item span {
    font-size: 15px;
    color: #37474F;
    text-align: left;
}

.suggestions-list.hidden {
    display: none;
}

.chat-input-wrapper {
    width: 100%;
    padding: 1rem;
    padding-bottom: max(1rem, env(safe-area-inset-bottom));
    box-sizing: border-box;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
}

.chat-input-wrapper.hidden {
    display: none;
}

.chat-input-wrapper .message-form .input-group {
    box-shadow: 0 8px 18px rgba(16, 53, 120, 0.12);
}

#powered-by {
    text-align: center;
    font-size: 13px;
    color: #9AA0A6;
    padding: 0 0 max(1.2rem, env(safe-area-inset-bottom, 1.2rem));
}

#powered-by span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

#chat-container {
    gap: 1rem;
}

.message-row {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    margin: 0 1rem;
    width: auto;
    max-width: calc(100% - 2rem);
}

.message-row.user {
    align-items: flex-end;
}

.message-header {
    display: flex;
    align-items: center;
    gap: 12px;
}

.message-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: #F1F3F4;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: #5F6368;
    overflow: hidden;
    flex-shrink: 0;
}

.message-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.message-author {
    font-weight: 600;
    color: #202124;
    font-size: 14px;
}

.message-row.typing-indicator .message-author {
    color: #5F6368;
    font-weight: 500;
}

.message-row.typing-indicator .message-avatar {
    opacity: 0.7;
}

.chat-message {
    padding: 14px 18px;
    border-radius: 18px;
    word-wrap: break-word;
    box-sizing: border-box;
    font-size: 15px;
    line-height: 1.5;
    max-width: clamp(55%, 420px, 75%);
    animation: slideIn 0.2s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chat-message p {
    margin: 0;
    padding: 0;
    word-wrap: break-word;
}

.chat-message.user-message {
    background: #FFFFFF;
    border: 1px solid rgba(0, 0, 0, 0.08);
    color: #202124;
    border-radius: 64px 4px 64px 64px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.08);
    max-width: 100%;
}

.chat-message.bot-message {
    background: transparent;
    color: inherit;
    padding: 0;
    border: none;
    box-shadow: none;
}

.chat-message.bot-message .bot-bubble {
    background: transparent;
    padding: 12px 16px;
    color: #202124;
    line-height: 1.55;
    max-width: 100%;
}

.chat-message.bot-message p {
    margin: 0;
}

.chat-message.user-message p {
    margin: 0;
}

.writing-indicator-bubble {
    background: #FFFFFF;
    border: 1px solid rgba(0,0,0,0.08);
    border-radius: 16px 16px 16px 4px;
    padding: 12px 16px;
    max-width: 220px;
    box-shadow: 0 6px 18px rgba(0,0,0,0.06);
}

.status-chip {
    margin-top: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0.2px;
    transition: opacity 0.2s ease;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.04);
}

.status-chip-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: currentColor;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.5);
}

.status-chip.is-hidden {
    display: none !important;
}

.status-chip[data-variant="processing"],
.status-chip[data-variant="info"] {
    background: #E3F2FD;
    color: #0D47A1;
}

.status-chip[data-variant="processing"] .status-chip-dot,
.status-chip[data-variant="info"] .status-chip-dot {
    background-color: #1976D2;
}

.status-chip[data-variant="error"] {
    background: #FDECEA;
    color: #B71C1C;
}

.status-chip[data-variant="error"] .status-chip-dot {
    background-color: #D32F2F;
}

.status-chip[data-variant="warning"] {
    background: #FFF4E5;
    color: #E65100;
}

.status-chip[data-variant="warning"] .status-chip-dot {
    background-color: #FB8C00;
}

.typing-animation {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    height: 20px;
}

.typing-animation span {
    width: 8px;
    height: 8px;
    background-color: #999;
    border-radius: 50%;
    animation: bounce 1.4s ease-in-out infinite;
}

.typing-animation span:nth-child(1) {
    animation-delay: 0s;
}

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

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

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes bounce {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.4;
    }
    30% {
        transform: translateY(-8px);
        opacity: 1;
    }
}

/* Scrollbar styling */
#chat-container::-webkit-scrollbar {
    width: 6px;
}

#chat-container::-webkit-scrollbar-track {
    background: #f1f1f1;
}

#chat-container::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

#chat-container::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Links in messages */
.chat-message a {
    color: inherit;
    text-decoration: underline;
}

.chat-message.user-message a {
    color: #1976D2;
}

.chat-message.bot-message a {
    color: #1976D2;
}

/* Code blocks in messages */
.chat-message pre {
    background: rgba(0, 0, 0, 0.1);
    padding: 8px 12px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 8px 0;
}

.chat-message.user-message pre {
    background: rgba(0, 0, 0, 0.05);
}

.chat-message code {
    background: rgba(0, 0, 0, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
}

.chat-message.user-message code {
    background: rgba(0, 0, 0, 0.05);
}

/* Mobile responsive */
@media (max-width: 768px) {
    #panel {
        max-width: none;
    }

    .message-row {
        padding: 0 0.75rem;
    }

    .chat-message.user-message,
    .chat-message.bot-message .bot-bubble {
        max-width: 85%;
        padding: 12px 16px;
    }

    #message-input {
        font-size: 16px; /* Prevent zoom on iOS */
        padding: 14px 16px; /* Larger touch target */
    }

    #chat-container {
        padding-bottom: 7rem;
        margin-bottom: env(safe-area-inset-bottom, 0);
    }

    .chat-input-wrapper {
        box-shadow: 0 -6px 16px rgba(0, 0, 0, 0.08);
    }

    .suggestions-list {
        gap: 10px;
    }
}
.message-row.typing-indicator {
    animation: fadeIn 0.3s ease;
}

/* Place Cards Container */
.places-container {
    width: 100%;
    max-width: 100%;
    margin: 16px 0;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.places-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 4px;
}

.places-header-text {
    font-size: 14px;
    color: #5F6368;
    font-weight: 500;
}

.view-toggle {
    display: flex;
    gap: 4px;
    background: #F1F3F4;
    border-radius: 20px;
    padding: 4px;
}

.view-toggle-btn {
    background: transparent;
    border: none;
    padding: 6px 12px;
    border-radius: 16px;
    cursor: pointer;
    font-size: 14px;
    color: #5F6368;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}

.view-toggle-btn:hover {
    background: rgba(0, 0, 0, 0.05);
}

.view-toggle-btn.active {
    background: #FFFFFF;
    color: #202124;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

.view-toggle-btn i {
    font-size: 14px;
}

.view-toggle-btn span {
    font-size: 13px;
    font-weight: 500;
}

/* Grid View */
.places-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
    width: 100%;
}

/* List View */
.places-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
}

/* Place Card */
.place-card {
    background: #FFFFFF;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: all 0.2s ease;
    animation: slideIn 0.3s ease;
}

.place-card:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    transform: translateY(-2px);
}

.place-card-image {
    width: 100%;
    height: 160px;
    background: linear-gradient(135deg, #E3F2FD 0%, #F1F3F4 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.place-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.place-card-image-placeholder {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: #FFFFFF;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #9AA0A6;
    font-size: 28px;
}

.place-card-content {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.place-card-header {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.place-card-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #F1F3F4;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: #5F6368;
    font-size: 18px;
}

.place-card-info {
    flex: 1;
    min-width: 0;
}

.place-card-title {
    font-size: 16px;
    font-weight: 600;
    color: #202124;
    margin: 0 0 4px 0;
    line-height: 1.3;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.place-card-logo-badge {
    height: 20px;
    width: auto;
    max-width: 40px;
    object-fit: contain;
    flex-shrink: 0;
}

.place-card-location {
    font-size: 13px;
    color: #5F6368;
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 2px;
}

.place-card-location i {
    font-size: 12px;
}

.place-card-category {
    font-size: 12px;
    color: #1976D2;
    background: #E3F2FD;
    padding: 4px 10px;
    border-radius: 12px;
    display: inline-block;
    margin-top: 4px;
}

.place-card-description {
    font-size: 14px;
    color: #5F6368;
    line-height: 1.5;
    margin: 4px 0 0 0;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.place-card-actions {
    display: flex;
    gap: 8px;
    margin-top: 8px;
    padding-top: 12px;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
}

.place-card-btn {
    flex: 1;
    padding: 10px 16px;
    border-radius: 20px;
    border: none;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    text-decoration: none;
}

.place-card-btn i {
    font-size: 14px;
}

.place-card-btn-primary {
    background: #000000;
    color: #FFFFFF;
}

.place-card-btn-primary:hover {
    background: #2C2C2C;
}

.place-card-btn-secondary {
    background: #F1F3F4;
    color: #202124;
}

.place-card-btn-secondary:hover {
    background: #E8EAED;
}

/* List View Specific Styles */
.places-list .place-card {
    display: flex;
    flex-direction: row;
}

.places-list .place-card-image {
    width: 120px;
    height: auto;
    min-height: 120px;
    flex-shrink: 0;
}

.places-list .place-card-content {
    flex: 1;
    padding: 12px 16px;
}

.places-list .place-card-actions {
    margin-top: 12px;
    padding-top: 0;
    border-top: none;
}

/* Collapse button for place cards */
.places-collapse-btn {
    background: transparent;
    border: none;
    color: #1976D2;
    font-size: 14px;
    padding: 8px 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 8px auto 0;
    transition: all 0.2s ease;
    border-radius: 16px;
}

.places-collapse-btn:hover {
    background: rgba(25, 118, 210, 0.08);
}

.places-collapse-btn i {
    transition: transform 0.2s ease;
}

.places-collapse-btn.collapsed i {
    transform: rotate(180deg);
}

/* Mobile responsive for place cards */
@media (max-width: 768px) {
    .places-grid {
        grid-template-columns: 1fr;
    }

    .places-list .place-card {
        flex-direction: column;
    }

    .places-list .place-card-image {
        width: 100%;
        height: 140px;
    }

    .place-card-actions {
        flex-direction: column;
    }

    .place-card-btn {
        width: 100%;
    }
}

/* Route Card */
.route-card {
    background: #FFFFFF;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 16px;
    padding: 20px;
    margin: 16px 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    animation: slideIn 0.3s ease;
    max-width: 600px;
}

.route-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.route-card-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: #F1F3F4;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #5F6368;
    font-size: 20px;
    flex-shrink: 0;
}

.route-card-title {
    font-size: 16px;
    font-weight: 600;
    color: #202124;
    margin: 0;
}

.route-path {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: #F8F9FA;
    border-radius: 12px;
    margin-bottom: 16px;
}

.route-location {
    flex: 1;
    min-width: 0;
}

.route-location-label {
    font-size: 11px;
    font-weight: 500;
    color: #5F6368;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.route-location-name {
    font-size: 15px;
    font-weight: 500;
    color: #202124;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.route-arrow {
    font-size: 20px;
    color: #1976D2;
    flex-shrink: 0;
}

.route-stats {
    display: flex;
    gap: 16px;
    margin-bottom: 16px;
}

.route-stat {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: #F1F3F4;
    border-radius: 8px;
    flex: 1;
}

.route-stat i {
    color: #5F6368;
    font-size: 14px;
}

.route-stat-value {
    font-size: 14px;
    font-weight: 600;
    color: #202124;
}

.route-stat-label {
    font-size: 12px;
    color: #5F6368;
}

.route-card-action {
    width: 100%;
    padding: 12px 20px;
    border-radius: 24px;
    border: none;
    background: #000000;
    color: #FFFFFF;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-decoration: none;
    box-sizing: border-box;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.route-card-action:hover {
    background: #2C2C2C;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.route-card-action i {
    font-size: 16px;
}

/* Mobile responsive for route card */
@media (max-width: 768px) {
    .route-path {
        flex-direction: column;
        gap: 8px;
    }

    .route-arrow {
        transform: rotate(90deg);
    }

    .route-stats {
        flex-direction: column;
        gap: 8px;
    }
}
