/* ============================================
   Penny Chat Widget Styles
   ============================================ */

/* -- Toggle Button -- */
.penny-toggle {
    position: fixed;
    bottom: 90px;
    right: 20px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #fcb040;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
    z-index: 1100;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s, box-shadow 0.2s;
}

.penny-toggle:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
}

.penny-toggle img {
    width: 34px;
    height: 34px;
    border-radius: 50%;
}

.penny-toggle .penny-close-icon {
    display: none;
    font-size: 22px;
    color: #1e1e1e;
}

.penny-toggle.open img {
    display: block;
    opacity: 0.5;
}

.penny-toggle.open .penny-close-icon {
    display: none;
}

/* -- Chat Panel -- */
.penny-panel {
    position: fixed;
    bottom: 160px;
    right: 20px;
    width: 380px;
    height: 520px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    z-index: 1100;
    display: none;
    flex-direction: column;
    overflow: hidden;
}

.penny-panel.open {
    display: flex;
}

/* -- Header -- */
.penny-header {
    background: #1e1e1e;
    color: #fff;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.penny-header img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
}

.penny-header-info {
    flex: 1;
}

.penny-header-info h3 {
    margin: 0;
    font-family: 'Oswald', sans-serif;
    font-size: 16px;
    font-weight: 500;
    letter-spacing: 0.5px;
}

.penny-header-info span {
    font-size: 11px;
    color: #aaa;
    font-family: 'Roboto', sans-serif;
}

.penny-header-close {
    background: none;
    border: none;
    color: #aaa;
    cursor: pointer;
    font-size: 18px;
    padding: 4px;
}

.penny-header-close:hover {
    color: #fff;
}

/* -- Auth Gate -- */
.penny-auth-gate {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 32px 24px;
    text-align: center;
}

.penny-auth-gate img {
    width: 64px;
    height: 64px;
    margin-bottom: 16px;
}

.penny-auth-gate h4 {
    margin: 0 0 8px;
    font-family: 'Oswald', sans-serif;
    font-size: 18px;
    color: #1e1e1e;
}

.penny-auth-gate p {
    margin: 0 0 20px;
    font-size: 13px;
    color: #666;
    line-height: 1.5;
    font-family: 'Roboto', sans-serif;
}

.penny-google-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: #fff;
    color: #333;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 10px 20px;
    font-size: 14px;
    font-family: 'Roboto', sans-serif;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: box-shadow 0.2s, border-color 0.2s;
}

.penny-google-btn:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
    border-color: #bbb;
}

.penny-google-btn svg {
    width: 18px;
    height: 18px;
}

/* -- Messages Area -- */
.penny-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: #f9f9f9;
}

.penny-msg {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 13px;
    line-height: 1.5;
    font-family: 'Roboto', sans-serif;
    word-wrap: break-word;
}

.penny-msg.user {
    align-self: flex-end;
    background: #fcb040;
    color: #1e1e1e;
    border-bottom-right-radius: 4px;
}

.penny-msg.assistant {
    align-self: flex-start;
    background: #e8e8e8;
    color: #1e1e1e;
    border-bottom-left-radius: 4px;
}

.penny-msg.assistant p {
    margin: 0 0 6px;
}

.penny-msg.assistant p:last-child {
    margin-bottom: 0;
}

.penny-msg.assistant ul,
.penny-msg.assistant ol {
    margin: 4px 0;
    padding-left: 20px;
}

.penny-msg.assistant strong {
    font-weight: 600;
}

.penny-msg.assistant code {
    background: rgba(0, 0, 0, 0.06);
    padding: 1px 4px;
    border-radius: 3px;
    font-size: 12px;
}

/* -- Sources -- */
.penny-sources {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.penny-source-link {
    font-size: 11px;
    color: #1a73e8;
    text-decoration: none;
    background: #e8f0fe;
    padding: 3px 8px;
    border-radius: 10px;
    font-family: 'Roboto', sans-serif;
}

.penny-source-link:hover {
    background: #d2e3fc;
}

/* -- Typing Indicator -- */
.penny-typing {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 10px 14px;
    align-self: flex-start;
}

.penny-typing span {
    width: 7px;
    height: 7px;
    background: #aaa;
    border-radius: 50%;
    animation: pennyBounce 1.2s infinite;
}

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

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

@keyframes pennyBounce {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-6px); }
}

/* -- Input Area -- */
.penny-input-area {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    border-top: 1px solid #e0e0e0;
    background: #fff;
    flex-shrink: 0;
}

.penny-input-area input {
    flex: 1;
    border: 1px solid #ddd;
    border-radius: 20px;
    padding: 8px 14px;
    /* iOS Safari zooms inputs whose font-size is < 16px on focus and
     * leaves the page zoomed. Keep at 16 even though the design wants
     * smaller — the alternative is a janky zoom on every tap. */
    font-size: 16px;
    font-family: 'Roboto', sans-serif;
    outline: none;
    transition: border-color 0.2s;
}

.penny-input-area input:focus {
    border-color: #fcb040;
}

.penny-input-area button {
    background: #fcb040;
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    margin-left: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #1e1e1e;
    font-size: 14px;
    transition: background 0.2s;
    flex-shrink: 0;
}

.penny-input-area button:hover {
    background: #e89e30;
}

.penny-input-area button:disabled {
    background: #ddd;
    cursor: not-allowed;
    color: #999;
}

/* -- Welcome Message -- */
.penny-welcome {
    text-align: center;
    padding: 8px 0;
    font-size: 12px;
    color: #888;
    font-family: 'Roboto', sans-serif;
}

/* -- Error State -- */
.penny-error {
    align-self: center;
    background: #fce4e4;
    color: #c62828;
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 12px;
    text-align: center;
}

/* -- Mobile Responsive -- */
@media (max-width: 480px) {
    .penny-panel {
        bottom: 0;
        right: 0;
        left: 0;
        width: 100%;
        height: 100%;
        border-radius: 0;
    }

    .penny-toggle {
        bottom: 72px;
        right: 16px;
    }
}

/* Ensure chat widget is above bottom tab bar */
@media (max-width: 768px) {
    .penny-toggle {
        bottom: 72px;
        right: 16px;
    }

    .penny-panel {
        bottom: 0;
        right: 0;
        left: 0;
        width: 100%;
        height: calc(100% - 0px);
        border-radius: 12px 12px 0 0;
    }
}

/* [ADDED 2026-06-15] iPad portrait (769–1024px) shows the bottom tab bar too,
   but the launcher's "clear the bar" reposition only fired ≤768px — so the
   navy launcher dot overlapped the tab bar on iPad. Lift the launcher across
   the FULL range where the tab bar is present. Toggle-only (panel layout is
   left to the phone breakpoints above). 60px bar + 16px clearance. */
@media (max-width: 1024px) {
    .penny-toggle {
        bottom: 76px;
        right: 16px;
    }
}
