/* Modern Property Assistant UI */

*, *::before, *::after { box-sizing: border-box; }

html, body {
    height: 100%;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: #f8fafc;
    color: #1e293b;
}

/* Layout */
.app-container {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* Sidebar */
.sidebar {
    width: 260px;
    min-width: 260px;
    background: #0f172a;
    display: flex;
    flex-direction: column;
    padding: 20px 12px;
    gap: 8px;
}

.sidebar-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px 20px;
    border-bottom: 1px solid #1e293b;
    margin-bottom: 8px;
}

.app-logo {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 20px;
}

.app-name {
    font-size: 18px;
    font-weight: 700;
    color: white;
    letter-spacing: -0.3px;
}

.sidebar-nav {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 10px;
    color: #94a3b8;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.15s;
}

.nav-item:hover {
    background: #1e293b;
    color: #e2e8f0;
}

.nav-item.active {
    background: #1e293b;
    color: white;
}

.nav-item .material-symbols-rounded {
    font-size: 20px;
}

/* Sidebar footer / user profile */
.sidebar-footer {
    border-top: 1px solid #1e293b;
    padding-top: 12px;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: 10px;
    cursor: pointer;
    position: relative;
    transition: background 0.15s;
}

.user-profile:hover { background: #1e293b; }

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #6366f1;
}

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

.user-name-text {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #e2e8f0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role {
    font-size: 11px;
    color: #64748b;
}

.popup-signout {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 0;
    right: 0;
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 10px;
    padding: 4px;
    display: none;
    z-index: 100;
}

.signout-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 8px;
    color: #e2e8f0;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s;
}

.signout-btn:hover { background: #334155; }
.signout-btn .material-symbols-rounded { font-size: 18px; }

.signin-wrapper {
    padding: 8px 12px;
}

.signin-label {
    font-size: 12px;
    color: #64748b;
    margin: 0 0 10px;
}

/* Main content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: #f8fafc;
}

/* Chat header */
.chat-header {
    padding: 16px 24px;
    background: white;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

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

.header-icon {
    font-size: 28px;
    color: #6366f1;
}

.chat-title {
    font-size: 17px;
    font-weight: 700;
    color: #0f172a;
    margin: 0;
}

.chat-subtitle {
    font-size: 12px;
    color: #64748b;
    margin: 2px 0 0;
}

/* Messages area */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.chat-messages::-webkit-scrollbar { width: 4px; }
.chat-messages::-webkit-scrollbar-track { background: transparent; }
.chat-messages::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 2px; }

.inner-content {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Messages */
.message {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    animation: fadeIn 0.2s ease;
}

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

.message.human {
    flex-direction: row-reverse;
}

.message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 20px;
}

.ai-avatar {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: white;
}

.ai-avatar .material-symbols-rounded { font-size: 20px; }

.human-avatar {
    background: #e2e8f0;
    color: #475569;
    overflow: hidden;
}

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

.human-avatar .material-symbols-rounded { font-size: 20px; }

.message-content {
    max-width: 65%;
    min-width: 0;
}

.message.ai .message-content {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 4px 16px 16px 16px;
    padding: 12px 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    font-size: 14px;
    line-height: 1.6;
    color: #1e293b;
    position: relative;
}

.message.human .message-content {
    background: #6366f1;
    color: white;
    border-radius: 16px 4px 16px 16px;
    padding: 12px 16px;
    font-size: 14px;
    line-height: 1.6;
}

.message-content span { display: block; }
.message-content p { margin: 0 0 8px; }
.message-content p:last-child { margin-bottom: 0; }
.message-content code {
    background: #f1f5f9;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 13px;
    font-family: 'JetBrains Mono', monospace;
}

/* Info icon for trace */
.message.ai .message-content .info-icon {
    position: absolute;
    right: 10px;
    top: 10px;
    font-size: 16px;
    color: #94a3b8;
    cursor: pointer;
}
.message.human .message-content .info-icon { display: none; }

/* Reservation confirmation card */
div.ticket-confirmation {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 20px;
    min-width: 320px;
    max-width: 380px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
}

div.ticket-confirmation .confirm-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid #f1f5f9;
}

div.ticket-confirmation .confirm-icon {
    width: 40px;
    height: 40px;
    background: #f0fdf4;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #16a34a;
    font-size: 22px;
}

div.ticket-confirmation .confirm-title {
    font-size: 15px;
    font-weight: 700;
    color: #0f172a;
}

div.ticket-confirmation .confirm-subtitle {
    font-size: 12px;
    color: #64748b;
}

div.ticket-confirmation .confirm-details {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 16px;
}

div.ticket-confirmation .detail-row {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
}

div.ticket-confirmation .detail-label {
    color: #64748b;
    font-weight: 500;
}

div.ticket-confirmation .detail-value {
    color: #0f172a;
    font-weight: 600;
    text-align: right;
}

div.ticket-confirmation .confirm-actions {
    display: flex;
    gap: 8px;
    margin-top: 16px;
}

div.ticket-confirmation .btn-confirm {
    flex: 1;
    padding: 10px;
    background: #6366f1;
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}

div.ticket-confirmation .btn-confirm:hover { background: #4f46e5; }

div.ticket-confirmation .btn-cancel {
    flex: 1;
    padding: 10px;
    background: #f1f5f9;
    color: #475569;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}

div.ticket-confirmation .btn-cancel:hover { background: #e2e8f0; }

/* Loader */
.loader {
    display: flex;
    gap: 5px;
    padding: 4px 0;
}

.loader span {
    width: 8px;
    height: 8px;
    background: #6366f1;
    border-radius: 50%;
    animation: bounce 1.2s infinite ease-in-out;
}

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

@keyframes bounce {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.5; }
    40% { transform: scale(1); opacity: 1; }
}

/* Input area */
.chat-input-area {
    padding: 16px 24px 20px;
    background: white;
    border-top: 1px solid #e2e8f0;
}

.input-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #f8fafc;
    border: 1.5px solid #e2e8f0;
    border-radius: 14px;
    padding: 4px 4px 4px 16px;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.input-wrapper:focus-within {
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
    background: white;
}

.ip-msg {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 14px;
    font-family: 'Inter', sans-serif;
    color: #1e293b;
    padding: 10px 0;
    outline: none;
}

.ip-msg::placeholder { color: #94a3b8; }

.send-button {
    width: 40px;
    height: 40px;
    background: #6366f1;
    border: none;
    border-radius: 10px;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, transform 0.1s;
    flex-shrink: 0;
}

.send-button:hover { background: #4f46e5; }
.send-button:active { transform: scale(0.95); }
.send-button .material-symbols-rounded { font-size: 20px; }

.input-hint {
    font-size: 11px;
    color: #94a3b8;
    text-align: center;
    margin: 8px 0 0;
}

/* Trace panel */
#trace {
    position: fixed;
    width: 400px;
    min-height: 200px;
    max-height: 450px;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 16px;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0,0,0,0.15);
    font-size: 13px;
    z-index: 1000;
}

#trace .header {
    font-weight: 700;
    font-size: 13px;
    color: #0f172a;
    padding-bottom: 10px;
    border-bottom: 1px solid #f1f5f9;
    margin-bottom: 10px;
}

#trace .codeblock {
    background: #f8fafc;
    border-radius: 8px;
    padding: 10px 12px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    color: #16a34a;
    overflow-x: auto;
    white-space: nowrap;
    margin: 8px 0;
}

#trace .results {
    background: #f8fafc;
    border-radius: 8px;
    padding: 10px;
    max-height: 200px;
    overflow: auto;
}

#trace .results table { border: 0; width: 100%; }
#trace .results th, #trace .results td {
    padding: 4px 8px;
    text-align: left;
    border-right: 1px solid #e2e8f0;
    font-size: 12px;
}
#trace .results th:last-child, #trace .results td:last-child { border-right: 0; }

/* Reset button */
#resetButton .material-symbols-rounded { font-size: 20px; }

/* Responsive */
@media (max-width: 768px) {
    .sidebar { display: none; }
    .message-content { max-width: 80%; }
}
