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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: #f5f5f5;
    height: 100vh;
    overflow: hidden;
}

#app {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    background: #2c3e50;
    color: white;
}

header h1 {
    font-size: 1.5rem;
    font-weight: 600;
}

#user-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

#user-email {
    font-size: 0.9rem;
    opacity: 0.9;
}

#logout-btn {
    padding: 0.5rem 1rem;
    background: transparent;
    border: 1px solid rgba(255,255,255,0.5);
    color: white;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
}

#logout-btn:hover {
    background: rgba(255,255,255,0.1);
}

main {
    display: flex;
    flex: 1;
    overflow: hidden;
}

#chat-pane {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: white;
    border-right: 1px solid #ddd;
}

#chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
}

.message {
    margin-bottom: 1rem;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    max-width: 90%;
}

.message.user {
    background: #3498db;
    color: white;
    margin-left: auto;
}

.message.assistant {
    background: #ecf0f1;
    color: #2c3e50;
}

.message.assistant pre {
    background: #2c3e50;
    color: #ecf0f1;
    padding: 0.5rem;
    border-radius: 4px;
    overflow-x: auto;
    margin: 0.5rem 0;
}

.message.assistant code {
    font-family: 'Monaco', 'Menlo', monospace;
    font-size: 0.9em;
}

#chat-input-container {
    display: flex;
    gap: 0.5rem;
    padding: 1rem;
    border-top: 1px solid #ddd;
    background: #fafafa;
}

#chat-input {
    flex: 1;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
    font-family: inherit;
    resize: none;
}

#chat-input:focus {
    outline: none;
    border-color: #3498db;
}

#send-btn {
    padding: 0.75rem 1.5rem;
    background: #3498db;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
}

#send-btn:hover {
    background: #2980b9;
}

#send-btn:disabled {
    background: #bdc3c7;
    cursor: not-allowed;
}

#plan-pane {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: white;
}

#plan-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid #ddd;
    background: #fafafa;
}

#plan-header h2 {
    font-size: 1.2rem;
    font-weight: 600;
    color: #2c3e50;
}

#new-plan-btn {
    padding: 0.5rem 1rem;
    background: #27ae60;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
}

#new-plan-btn:hover {
    background: #219a52;
}

#plan-content {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    line-height: 1.6;
}

#plan-content h1, #plan-content h2, #plan-content h3 {
    margin-top: 1rem;
    margin-bottom: 0.5rem;
    color: #2c3e50;
}

#plan-content h1:first-child {
    margin-top: 0;
}

#plan-content ul, #plan-content ol {
    padding-left: 1.5rem;
    margin: 0.5rem 0;
}

#plan-content li {
    margin: 0.25rem 0;
}

#plan-content p {
    margin: 0.5rem 0;
}

#plan-content pre {
    background: #2c3e50;
    color: #ecf0f1;
    padding: 0.75rem;
    border-radius: 4px;
    overflow-x: auto;
    margin: 0.5rem 0;
}

#plan-content code {
    font-family: 'Monaco', 'Menlo', monospace;
    font-size: 0.9em;
}

/* Loading view */
#loading-view {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    font-size: 1.2rem;
    color: #7f8c8d;
}

/* Login view */
#login-view {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    background: linear-gradient(135deg, #2c3e50 0%, #3498db 100%);
}

.login-container {
    background: white;
    padding: 2.5rem;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    width: 100%;
    max-width: 400px;
}

.login-container h1 {
    text-align: center;
    color: #2c3e50;
    margin-bottom: 0.5rem;
    font-size: 1.75rem;
}

.login-subtitle {
    text-align: center;
    color: #7f8c8d;
    margin-bottom: 2rem;
    font-size: 0.95rem;
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: #2c3e50;
    font-weight: 500;
    font-size: 0.9rem;
}

.form-group input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.2s;
}

.form-group input:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.primary-btn {
    width: 100%;
    padding: 0.875rem;
    background: #3498db;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}

.primary-btn:hover {
    background: #2980b9;
}

.primary-btn:disabled {
    background: #bdc3c7;
    cursor: not-allowed;
}

.auth-toggle {
    text-align: center;
    margin-top: 1.5rem;
    color: #7f8c8d;
    font-size: 0.9rem;
}

.auth-toggle a {
    color: #3498db;
    text-decoration: none;
    font-weight: 500;
    margin-left: 0.25rem;
}

.auth-toggle a:hover {
    text-decoration: underline;
}

.error-message {
    background: rgba(231, 76, 60, 0.1);
    border: 1px solid #e74c3c;
    color: #c0392b;
    padding: 0.75rem;
    border-radius: 4px;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.hidden {
    display: none !important;
}

.streaming {
    opacity: 0.7;
}

@media (max-width: 768px) {
    main {
        flex-direction: column;
    }

    #chat-pane, #plan-pane {
        flex: none;
        height: 50%;
    }

    #chat-pane {
        border-right: none;
        border-bottom: 1px solid #ddd;
    }
}
