* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-primary: #202124;
    --bg-secondary: #303134;
    --bg-input: #303134;
    --text-primary: #e8eaed;
    --text-secondary: #9aa0a6;
    --border-color: #5f6368;
    --accent-blue: #8ab4f8;
    --accent-blue-hover: #aecbfa;
    --shadow: rgba(0, 0, 0, 0.3);
}

body {
    font-family: 'Google Sans', arial, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

/* Google-style centered layout */
.google-layout {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.centered-container {
    width: 100%;
    max-width: 584px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 30px;
}

/* Welcome Section */
.welcome-section {
    text-align: center;
    padding: 40px 20px;
}

.welcome-section h1 {
    font-size: 48px;
    font-weight: 400;
    margin-bottom: 16px;
    color: var(--text-primary);
    letter-spacing: -0.5px;
}

.subtitle {
    font-size: 16px;
    color: var(--text-secondary);
    margin-bottom: 0;
}

/* Input Form */
.input-form {
    width: 100%;
    padding: 0 20px;
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    background: var(--bg-input);
    border-radius: 24px;
    border: 1px solid var(--border-color);
    padding: 12px 16px;
    box-shadow: 0 2px 5px 1px var(--shadow);
    transition: box-shadow 0.2s;
}

.input-wrapper:hover {
    box-shadow: 0 2px 8px 1px var(--shadow);
    border-color: transparent;
}

.input-wrapper:focus-within {
    box-shadow: 0 2px 8px 1px var(--shadow);
    border-color: transparent;
    background: var(--bg-secondary);
}

.chat-input,
#userQuestion {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-size: 16px;
    font-family: inherit;
    resize: none;
    min-height: 24px;
    max-height: 200px;
    padding: 0;
    line-height: 24px;
}

.chat-input::placeholder,
#userQuestion::placeholder {
    color: var(--text-secondary);
}

.send-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--accent-blue);
    cursor: pointer;
    border-radius: 50%;
    transition: all 0.2s;
    flex-shrink: 0;
    margin-left: 8px;
}

.send-btn:hover:not(:disabled) {
    background: rgba(138, 180, 248, 0.1);
}

.send-btn.active {
    color: var(--accent-blue);
}

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

/* Chat Messages */
.chat-messages {
    width: 100%;
    padding: 20px;
    padding-bottom: 0;
    max-height: 60vh;
    overflow-y: auto;
}

.message {
    display: flex;
    margin-bottom: 24px;
    padding: 16px 0;
}

.user-message {
    justify-content: flex-end;
}

.message-content {
    max-width: 75%;
    padding: 12px 16px;
    border-radius: 18px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 16px;
    line-height: 1.5;
    word-wrap: break-word;
    white-space: pre-wrap;
    border: 1px solid var(--border-color);
}

.user-message .message-content {
    background: var(--accent-blue);
    color: var(--bg-primary);
    border-color: var(--accent-blue);
}

/* Loading Screen */
.loading-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
    min-height: 60vh;
}

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

.loading-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--border-color);
    border-top-color: var(--accent-blue);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

#statusText {
    font-size: 16px;
    color: var(--text-secondary);
}

.hidden {
    display: none !important;
}

/* Result Section */
.result {
    width: 100%;
    padding: 0 20px;
    animation: fadeIn 0.3s;
}

.result-box {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 24px;
    border: 1px solid var(--border-color);
}

.result-label {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 12px;
}

.link-container {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
}

.link-input {
    flex: 1;
    padding: 10px 12px;
    font-size: 14px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
}

.copy-button {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    font-size: 14px;
    background: var(--accent-blue);
    color: var(--bg-primary);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
    white-space: nowrap;
    font-weight: 500;
}

.copy-button:hover {
    background: var(--accent-blue-hover);
}

.copy-feedback {
    color: var(--accent-blue);
    font-size: 14px;
    margin-top: 8px;
}

.copy-feedback.hidden {
    display: none;
}

/* Footer */
.site-footer {
    margin-top: 40px;
    padding-top: 20px;
    text-align: center;
    border-top: 1px solid var(--border-color);
}

.site-footer p {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 8px;
}

.site-footer a {
    color: var(--accent-blue);
    text-decoration: none;
    transition: color 0.2s;
}

.site-footer a:hover {
    color: var(--accent-blue-hover);
    text-decoration: underline;
}

/* Action Section */
.action-section {
    width: 100%;
    padding: 0 20px;
    margin-top: 20px;
    animation: fadeIn 0.5s;
}

.action-box {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 24px;
    border: 1px solid var(--border-color);
    text-align: center;
}

.action-title {
    font-size: 18px;
    color: var(--text-primary);
    margin-bottom: 20px;
    font-weight: 500;
}

.question-display {
    background: var(--bg-input);
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 16px;
    border: 1px solid var(--border-color);
}

.question-text {
    color: var(--text-primary);
    font-size: 16px;
    line-height: 1.6;
    margin-bottom: 12px;
    word-wrap: break-word;
    white-space: pre-wrap;
}

.copy-question-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    font-size: 14px;
    background: var(--accent-blue);
    color: var(--bg-primary);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
    font-weight: 500;
}

.copy-question-btn:hover {
    background: var(--accent-blue-hover);
}

.action-instruction {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 16px;
}

.open-perplexity-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    font-size: 16px;
    background: var(--accent-blue);
    color: var(--bg-primary);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
    font-weight: 500;
    text-decoration: none;
}

.open-perplexity-btn:hover {
    background: var(--accent-blue-hover);
}

/* Mouse Cursor Animation */
.mouse-cursor {
    position: fixed;
    width: 24px;
    height: 24px;
    pointer-events: none;
    z-index: 10000;
    color: var(--text-primary);
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5));
    transition: all 0.1s linear;
}

.mouse-cursor.hidden {
    display: none;
}

.mouse-cursor.clicking {
    transform: translate(-50%, -50%) scale(0.9);
}

.mouse-cursor svg {
    width: 100%;
    height: 100%;
}

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

/* Responsive Design */
@media (max-width: 768px) {
    .google-layout {
        padding: 16px;
    }
    
    .centered-container {
        max-width: 100%;
    }
    
    .welcome-section {
        padding: 20px 0;
    }
    
    .welcome-section h1 {
        font-size: 32px;
    }
    
    .input-form {
        padding: 0;
    }
    
    .chat-messages {
        padding: 16px 0;
    }
    
    .message-content {
        max-width: 85%;
    }
    
    .result {
        padding: 0;
    }
    
    .link-container {
        flex-direction: column;
    }
}

/* Scrollbar Styling */
.chat-messages::-webkit-scrollbar {
    width: 8px;
}

.chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

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

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}
