/* --- עיצוב זהה למקור --- */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: #f0f2f5;
    margin: 0; padding: 0;
    display: flex; justify-content: center;
    height: 100dvh; overflow: hidden;
}

.app-container {
    width: 100%; max-width: 800px; background: #fff;
    display: flex; flex-direction: column; height: 100%;
    box-shadow: 0 0 20px rgba(0,0,0,0.05); position: relative;
}

#auth-screen {
    position: fixed; inset: 0; background: #e3f2fd; z-index: 2000;
    display: none; flex-direction: column; justify-content: center; align-items: center;
    text-align: center; padding: 20px;
}
.google-btn {
    background: #fff; border: 1px solid #ddd; padding: 12px 24px;
    border-radius: 30px; cursor: pointer; font-size: 1.1rem;
    display: flex; align-items: center; gap: 10px; font-weight: bold;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1); color: #333;
}
.google-btn:hover { background: #f9f9f9; transform: translateY(-2px); transition: 0.2s; }

header { padding: 1.5rem; border-bottom: 1px solid #eee; flex-shrink: 0; }
header h1 { margin: 0; font-size: 1.4rem; }
header p { display: none; }

#chat-window {
    flex-grow: 1; overflow-y: auto; padding: 1.5rem;
    display: flex; flex-direction: column; gap: 1rem;
    scroll-behavior: smooth; -webkit-overflow-scrolling: touch;
}

#input-area {
    padding: 1rem; border-top: 1px solid #eee; display: flex; gap: 10px; background: #fff;
    flex-shrink: 0; padding-bottom: max(1rem, env(safe-area-inset-bottom));
}

#user-input {
    flex-grow: 1; padding: 14px 20px; border-radius: 30px;
    border: 1px solid #ddd; outline: none; font-size: 16px;
}
#user-input:focus { border-color: #999; }

button {
    padding: 0 24px; border-radius: 30px; border: none; color: white;
    cursor: pointer; font-weight: bold; font-size: 1rem;
    transition: opacity 0.2s; white-space: nowrap;
}
button:hover { opacity: 0.9; }
button:disabled { background-color: #ccc !important; cursor: not-allowed; }

#legal-footer {
    text-align: center; font-size: 0.75rem; color: #999; padding: 8px;
    background: #fcfcfc; border-top: 1px solid #f0f0f0; flex-shrink: 0;
    padding-bottom: max(8px, env(safe-area-inset-bottom));
}

.message { padding: 12px 18px; border-radius: 18px; max-width: 85%; line-height: 1.5; white-space: pre-wrap; animation: fadeIn 0.3s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }

.user { align-self: flex-end; background-color: #333; color: white; border-bottom-right-radius: 4px; }
.assistant { align-self: flex-start; background-color: #f0f0f0; color: #333; border-bottom-left-radius: 4px; }
.error-msg { align-self: center; background-color: #ffebee; color: #c62828; font-size: 0.9rem; border-radius: 8px; text-align: center; padding: 10px; border: 1px solid #ffcdd2; width: 90%; }

.typing-indicator { background-color: #f0f0f0; padding: 15px 20px; border-radius: 18px; border-bottom-left-radius: 4px; align-self: flex-start; display: flex; align-items: center; width: fit-content; gap: 5px; }
.dot { width: 8px; height: 8px; background-color: #90949c; border-radius: 50%; animation: bounce 1.4s infinite ease-in-out both; }
.dot:nth-child(1) { animation-delay: -0.32s; } .dot:nth-child(2) { animation-delay: -0.16s; }
@keyframes bounce { 0%, 80%, 100% { transform: scale(0); } 40% { transform: scale(1); } }

#init-loader { position: fixed; top:0; left:0; right:0; bottom:0; background: white; z-index: 3000; display: flex; justify-content: center; align-items: center; flex-direction: column; }
#loading-overlay { position: fixed; top:0; left:0; right:0; bottom:0; background: rgba(255,255,255,0.9); z-index: 1500; display: none; justify-content: center; align-items: center; flex-direction: column; }
.loader { border: 4px solid #f3f3f3; border-top: 4px solid #3498db; border-radius: 50%; width: 40px; height: 40px; animation: spin 1s linear infinite; }
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

#legal-modal, #password-modal {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.85); z-index: 9999;
    display: none; justify-content: center; align-items: center;
    padding: 20px; box-sizing: border-box; backdrop-filter: blur(5px);
}
.legal-box, .password-box {
    background: white; max-width: 500px; width: 100%;
    padding: 30px; border-radius: 20px; text-align: center;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    border-top: 6px solid #2e7d32;
}
.password-box { border-top-color: #1565c0; }
.legal-icon { font-size: 4rem; margin-bottom: 10px; display: block; line-height: 1; }
.legal-title { font-size: 1.4rem; font-weight: bold; margin-bottom: 15px; color: #2e7d32; }
.legal-text { font-size: 1rem; line-height: 1.6; color: #444; margin-bottom: 25px; text-align: right; }
.legal-btn {
    background: #2e7d32; color: white; border: none;
    padding: 12px 40px; border-radius: 30px; font-weight: bold;
    cursor: pointer; font-size: 1.1rem; width: 100%;
    transition: background 0.2s, transform 0.1s;
}
.password-input { width: 80%; padding: 12px; margin: 15px 0; border: 1px solid #ccc; border-radius: 8px; font-size: 1rem; text-align: center; }
.pass-btn { background: #1565c0; color: white; border: none; padding: 12px 40px; border-radius: 30px; cursor: pointer; font-size: 1.1rem; }
