/* GPS Lighthouse Chat - v2.0.0 */
/* All classes prefixed with lh- to avoid conflicts with GeneratePress theme */

:root {
    --lh-bg-primary: #f8f9fa;
    --lh-bg-secondary: #ffffff;
    --lh-bg-tertiary: #f1f3f5;
    --lh-bg-input: #ffffff;
    --lh-text-primary: #1a1a2e;
    --lh-text-secondary: #4a4a5a;
    --lh-text-muted: #8a8a9a;
    --lh-accent: #dc2626;
    --lh-accent-hover: #b91c1c;
    --lh-accent-light: #fef2f2;
    --lh-border: #e5e7eb;
    --lh-user-msg: #dc2626;
    --lh-user-msg-text: #ffffff;
    --lh-ai-msg: #f1f3f5;
    --lh-success: #22c55e;
    --lh-shadow-sm: 0 1px 3px rgba(0,0,0,0.1);
    --lh-shadow: 0 4px 12px rgba(0,0,0,0.1);
    --lh-shadow-lg: 0 8px 24px rgba(0,0,0,0.15);
    --lh-header-height: 0px;
}

/* Reset page wrapper styles from GeneratePress */
.lh-page-wrap .site-content,
.lh-page-wrap .content-area,
.lh-page-wrap .inside-article,
.lh-page-wrap .entry-content {
    padding: 0 !important;
    margin: 0 !important;
    max-width: 100% !important;
}
.lh-page-wrap article.page {
    padding: 0 !important;
    margin: 0 !important;
}
.lh-page-wrap #primary {
    margin: 0 !important;
    padding: 0 !important;
    width: 100% !important;
}

/* Main Layout */
.lh-chat-app {
    display: flex;
    height: calc(100vh - var(--lh-header-height, 0px));
    height: calc(100dvh - var(--lh-header-height, 0px));
    background: var(--lh-bg-primary);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    color: var(--lh-text-primary);
    line-height: 1.5;
}

/* Sidebar */
.lh-sidebar {
    width: 300px;
    background: var(--lh-bg-secondary);
    border-right: 1px solid var(--lh-border);
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
    box-shadow: var(--lh-shadow-sm);
    overflow: hidden;
}

.lh-sidebar-header {
    padding: 20px;
    border-bottom: 1px solid var(--lh-border);
    display: flex;
    align-items: center;
    gap: 12px;
}

.lh-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: var(--lh-text-primary);
}

.lh-logo-icon {
    width: 40px;
    height: 40px;
    background: var(--lh-accent);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 14px;
    color: white;
}

.lh-logo-text {
    font-size: 18px;
    font-weight: 700;
    color: var(--lh-text-primary);
}

.lh-logo-sub {
    font-size: 12px;
    color: var(--lh-text-muted);
    font-weight: normal;
}

/* Notifications area */
.lh-notifications {
    padding: 0 16px;
    max-height: 200px;
    overflow-y: auto;
}

.lh-notification {
    background: var(--lh-accent-light);
    border: 1px solid rgba(220, 38, 38, 0.2);
    border-radius: 8px;
    margin-bottom: 8px;
    overflow: hidden;
}

.lh-notification-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    color: var(--lh-accent);
    user-select: none;
}

.lh-notification-header svg {
    flex-shrink: 0;
}

.lh-notification-toggle {
    margin-left: auto;
    transition: transform 0.2s;
    flex-shrink: 0;
}

.lh-notification.open .lh-notification-toggle {
    transform: rotate(180deg);
}

.lh-notification-body {
    display: none;
    padding: 0 12px 10px;
    font-size: 13px;
    color: var(--lh-text-secondary);
    line-height: 1.5;
    border-top: 1px solid rgba(220, 38, 38, 0.1);
}

.lh-notification.open .lh-notification-body {
    display: block;
}

.lh-new-chat-btn {
    width: calc(100% - 32px);
    padding: 14px 20px;
    margin: 16px;
    background: var(--lh-accent);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.2s;
    box-shadow: var(--lh-shadow-sm);
}

.lh-new-chat-btn:hover {
    background: var(--lh-accent-hover);
    transform: translateY(-1px);
    box-shadow: var(--lh-shadow);
}

.lh-conversations-label {
    padding: 12px 20px;
    font-size: 12px;
    text-transform: uppercase;
    color: var(--lh-text-muted);
    font-weight: 700;
    letter-spacing: 0.5px;
}

.lh-conversations-list {
    flex: 1;
    overflow-y: auto;
    padding: 0 12px;
}

.lh-conversation-item {
    padding: 14px 12px;
    margin: 4px 0;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.2s;
    position: relative;
    border: 1px solid transparent;
}

.lh-conversation-item:hover {
    background: var(--lh-bg-tertiary);
}

.lh-conversation-item.active {
    background: var(--lh-accent-light);
    border-color: var(--lh-accent);
}

.lh-conversation-icon {
    width: 36px;
    height: 36px;
    background: var(--lh-bg-tertiary);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}

.lh-conversation-item.active .lh-conversation-icon {
    background: var(--lh-accent);
    color: white;
}

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

.lh-conversation-title {
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--lh-text-primary);
}

.lh-conversation-date {
    font-size: 12px;
    color: var(--lh-text-muted);
    margin-top: 2px;
}

.lh-conversation-delete {
    opacity: 0;
    background: none;
    border: none;
    color: var(--lh-text-muted);
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    transition: all 0.2s;
}

.lh-conversation-item:hover .lh-conversation-delete {
    opacity: 1;
}

.lh-conversation-delete:hover {
    color: var(--lh-accent);
    background: var(--lh-accent-light);
}

.lh-sidebar-footer {
    margin-bottom: 10px;
    padding: 16px 20px;
    border-top: 1px solid var(--lh-border);
    background: var(--lh-bg-tertiary);
}

.lh-footer-links {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    font-size: 13px;
}

.lh-footer-links a {
    color: var(--lh-text-secondary);
    text-decoration: none;
    transition: color 0.2s;
}

.lh-footer-links a:hover {
    color: var(--lh-accent);
}

/* Main Chat Area */
.lh-chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: var(--lh-bg-primary);
}

.lh-chat-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--lh-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--lh-bg-secondary);
    box-shadow: var(--lh-shadow-sm);
}

.lh-mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    color: var(--lh-text-primary);
    font-size: 24px;
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
}

.lh-mobile-menu-btn:hover {
    background: var(--lh-bg-tertiary);
}

.lh-chat-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--lh-text-primary);
    margin: 0;
    padding: 0;
}

.lh-chat-actions {
    display: flex;
    gap: 10px;
}

.lh-action-btn {
    background: var(--lh-bg-secondary);
    border: 1px solid var(--lh-border);
    color: var(--lh-text-secondary);
    padding: 10px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
    font-weight: 500;
}

.lh-action-btn:hover {
    background: var(--lh-bg-tertiary);
    color: var(--lh-text-primary);
    border-color: var(--lh-text-muted);
}

/* Messages Area */
.lh-messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
}

.lh-welcome-screen {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 40px 20px;
    max-width: 700px;
    margin: 0 auto;
}

.lh-welcome-icon {
    width: 88px;
    height: 88px;
    background: linear-gradient(135deg, var(--lh-accent), #f97316);
    border-radius: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 40px;
    margin-bottom: 28px;
    color: white;
    box-shadow: var(--lh-shadow);
}

.lh-welcome-title {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 16px;
    color: var(--lh-text-primary);
}

.lh-welcome-subtitle {
    color: var(--lh-text-secondary);
    font-size: 17px;
    max-width: 500px;
    margin-bottom: 36px;
    line-height: 1.6;
}

.lh-suggested-prompts {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    width: 100%;
    max-width: 600px;
}

.lh-prompt-btn {
    background: var(--lh-bg-secondary);
    border: 1px solid var(--lh-border);
    color: var(--lh-text-primary);
    padding: 16px 18px;
    border-radius: 12px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
    text-align: left;
    line-height: 1.4;
    box-shadow: var(--lh-shadow-sm);
}

.lh-prompt-btn:hover {
    border-color: var(--lh-accent);
    background: var(--lh-accent-light);
    transform: translateY(-2px);
    box-shadow: var(--lh-shadow);
}

/* Message Bubbles */
.lh-message {
    max-width: 80%;
    margin-bottom: 20px;
    display: flex;
    gap: 14px;
}

.lh-message.user {
    flex-direction: row-reverse;
    margin-left: auto;
}

.lh-message-avatar {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 15px;
    font-weight: 600;
    box-shadow: var(--lh-shadow-sm);
}

.lh-message.user .lh-message-avatar {
    background: var(--lh-accent);
    color: white;
}

.lh-message.assistant .lh-message-avatar {
    background: var(--lh-bg-secondary);
    border: 1px solid var(--lh-border);
    color: var(--lh-accent);
}

.lh-message-content {
    padding: 16px 20px;
    border-radius: 16px;
    line-height: 1.7;
    box-shadow: var(--lh-shadow-sm);
}

.lh-message.user .lh-message-content {
    background: var(--lh-user-msg);
    color: var(--lh-user-msg-text);
    border-bottom-right-radius: 6px;
}

.lh-message.assistant .lh-message-content {
    background: var(--lh-bg-secondary);
    border: 1px solid var(--lh-border);
    border-bottom-left-radius: 6px;
}

.lh-message-content p {
    margin: 0 0 12px 0;
}

.lh-message-content p:last-child {
    margin-bottom: 0;
}

.lh-message-content pre {
    background: var(--lh-bg-tertiary);
    padding: 14px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 12px 0;
    border: 1px solid var(--lh-border);
}

.lh-message-content code {
    font-family: 'SF Mono', Monaco, 'Courier New', monospace;
    font-size: 13px;
}

.lh-message-content ul, .lh-message-content ol {
    margin: 10px 0;
    padding-left: 24px;
}

.lh-message-content li {
    margin: 6px 0;
}

.lh-typing-indicator {
    display: inline-flex;
    gap: 5px;
    padding: 8px 0;
}

.lh-typing-dot {
    width: 10px;
    height: 10px;
    background: var(--lh-accent);
    border-radius: 50%;
    animation: lh-typing 1.4s infinite;
}

.lh-typing-dot:nth-child(2) { animation-delay: 0.2s; }
.lh-typing-dot:nth-child(3) { animation-delay: 0.4s; }

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

/* Copy button for assistant messages */
.lh-message-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--lh-border);
}

.lh-copy-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: var(--lh-bg-tertiary);
    border: 1px solid var(--lh-border);
    border-radius: 6px;
    color: var(--lh-text-secondary);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.lh-copy-btn:hover {
    background: var(--lh-bg-secondary);
    color: var(--lh-text-primary);
    border-color: var(--lh-accent);
}

.lh-copy-btn.copied {
    background: var(--lh-accent);
    color: white;
    border-color: var(--lh-accent);
}

.lh-copy-btn svg {
    width: 14px;
    height: 14px;
}

/* Streaming state */
.lh-message-content.streaming {
    min-height: 40px;
    min-width: 100px;
    max-width: 100%;
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-word;
    display: block;
}

.lh-streaming-cursor {
    display: inline-block;
    width: 3px;
    height: 1.1em;
    background: var(--lh-accent);
    margin-left: 2px;
    vertical-align: text-bottom;
    animation: lh-blink 0.7s infinite step-end;
}

@keyframes lh-blink {
    0%, 50% { opacity: 1; }
    50.01%, 100% { opacity: 0; }
}

.lh-message.assistant .lh-message-content.streaming {
    flex: 1 1 auto;
    width: auto;
}

/* Input Area */
.lh-input-container {
    padding: 20px;
    background: var(--lh-bg-secondary);
    border-top: 1px solid var(--lh-border);
    box-shadow: 0 -4px 12px rgba(0,0,0,0.05);
}

.lh-input-wrapper {
    display: flex;
    gap: 14px;
    max-width: 900px;
    margin: 0 auto;
}

.lh-message-input {
    flex: 1;
    background: var(--lh-bg-primary);
    border: 2px solid var(--lh-border);
    border-radius: 14px;
    padding: 16px 20px;
    color: var(--lh-text-primary);
    font-size: 16px;
    resize: none;
    min-height: 56px;
    max-height: 200px;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.lh-message-input:focus {
    border-color: var(--lh-accent);
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
}

.lh-message-input::placeholder {
    color: var(--lh-text-muted);
}

.lh-send-btn {
    background: var(--lh-accent);
    border: none;
    border-radius: 14px;
    width: 56px;
    height: 56px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
    box-shadow: var(--lh-shadow-sm);
}

.lh-send-btn:hover:not(:disabled) {
    background: var(--lh-accent-hover);
    transform: translateY(-1px);
    box-shadow: var(--lh-shadow);
}

.lh-send-btn:active:not(:disabled) {
    transform: scale(0.95);
}

.lh-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.lh-send-btn svg {
    width: 24px;
    height: 24px;
    fill: white;
}

.lh-input-hint {
    text-align: center;
    font-size: 12px;
    color: var(--lh-text-muted);
    margin-top: 10px;
}

/* Mobile Overlay */
.lh-sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.4);
    z-index: 99;
}

/* Export Modal */
.lh-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s;
    padding: 20px;
}

.lh-modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.lh-modal {
    background: var(--lh-bg-secondary);
    border-radius: 20px;
    width: 100%;
    max-width: 400px;
    padding: 28px;
    transform: translateY(20px);
    transition: transform 0.2s;
    box-shadow: var(--lh-shadow-lg);
}

.lh-modal-overlay.active .lh-modal {
    transform: translateY(0);
}

.lh-modal-title {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 20px;
    color: var(--lh-text-primary);
}

.lh-export-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.lh-export-btn {
    padding: 16px 18px;
    background: var(--lh-bg-tertiary);
    border: 1px solid var(--lh-border);
    border-radius: 12px;
    color: var(--lh-text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 14px;
    transition: all 0.2s;
    font-size: 15px;
    font-weight: 500;
}

.lh-export-btn:hover {
    background: var(--lh-accent-light);
    border-color: var(--lh-accent);
}

.lh-modal-close {
    margin-top: 20px;
    width: 100%;
    padding: 14px;
    background: transparent;
    border: 1px solid var(--lh-border);
    border-radius: 12px;
    color: var(--lh-text-secondary);
    cursor: pointer;
    font-size: 15px;
    font-weight: 500;
    transition: all 0.2s;
}

.lh-modal-close:hover {
    background: var(--lh-bg-tertiary);
}

/* Responsive */
@media (max-width: 768px) {
    .lh-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        z-index: 100;
        transform: translateX(-100%);
        width: 85%;
        max-width: 320px;
    }

    .lh-sidebar.open {
        transform: translateX(0);
    }

    .lh-sidebar-overlay.active {
        display: block;
    }

    .lh-mobile-menu-btn {
        display: block;
    }

    .lh-message {
        max-width: 92%;
    }

    .lh-action-btn span {
        display: none;
    }

    .lh-action-btn {
        padding: 12px;
    }

    .lh-welcome-title {
        font-size: 26px;
    }

    .lh-welcome-subtitle {
        font-size: 15px;
    }

    .lh-suggested-prompts {
        grid-template-columns: 1fr;
    }

    .lh-prompt-btn {
        font-size: 14px;
    }

    .lh-chat-header {
        padding: 14px 16px;
    }

    .lh-messages-container {
        padding: 16px;
    }

    .lh-input-container {
        padding: 14px 16px;
    }
}

/* Scrollbar */
.lh-chat-app ::-webkit-scrollbar {
    width: 8px;
}

.lh-chat-app ::-webkit-scrollbar-track {
    background: var(--lh-bg-tertiary);
}

.lh-chat-app ::-webkit-scrollbar-thumb {
    background: var(--lh-border);
    border-radius: 4px;
}

.lh-chat-app ::-webkit-scrollbar-thumb:hover {
    background: var(--lh-text-muted);
}
