/* style.css content here */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

header {
    background: #fff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 10;
}

nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

h1 {
    font-size: 1.5rem;
    color: #1a73e8;
}

.device-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.device-toggle label {
    font-weight: 500;
}

.device-toggle select {
    padding: 0.25rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    background: white;
}

nav a {
    color: #1a73e8;
    text-decoration: none;
    font-weight: 500;
}

nav a:hover {
    text-decoration: underline;
}

main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem;
    height: calc(100vh - 80px);
    display: flex;
    flex-direction: column;
}

.chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    overflow: hidden;
}

.chat-history {
    flex: 1;
    padding: 1rem;
    overflow-y: auto;
    scroll-behavior: smooth;
}

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

.message.user {
    background: #1a73e8;
    color: white;
    margin-left: auto;
    text-align: right;
}

.message.assistant {
    background: #f0f0f0;
    color: #333;
}

.message.system {
    background: #e8f4fd;
    color: #0066cc;
    text-align: center;
    margin: 0 auto 1rem;
    max-width: 100%;
}

.message p {
    margin: 0;
}

.input-container {
    display: flex;
    padding: 1rem;
    gap: 0.5rem;
    border-top: 1px solid #eee;
    background: white;
}

#user-input {
    flex: 1;
    padding: 0.75rem;
    border: 1px solid #ccc;
    border-radius: 20px;
    resize: none;
    font-family: inherit;
    font-size: 1rem;
    min-height: 44px;
    max-height: 120px;
    overflow-y: auto;
}

#user-input:focus {
    outline: none;
    border-color: #1a73e8;
}

#send-button {
    padding: 0.75rem 1.5rem;
    background: #1a73e8;
    color: white;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    font-weight: 500;
    min-height: 44px;
}

#send-button:hover:not(:disabled) {
    background: #1557b0;
}

#send-button:disabled {
    background: #ccc;
    cursor: not-allowed;
}

#user-input:disabled {
    background: #f5f5f5;
    cursor: not-allowed;
}

.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    margin: 1rem;
}

.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #1a73e8;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.error {
    background: #fee;
    color: #c33;
    padding: 1rem;
    border-radius: 4px;
    margin: 1rem;
    text-align: center;
    border: 1px solid #fcc;
}

.hidden {
    display: none;
}

/* Responsive Design */
@media (max-width: 768px) {
    nav {
        flex-direction: column;
        gap: 1rem;
        padding: 1rem;
    }

    .device-toggle {
        order: 3;
    }

    main {
        padding: 0.5rem;
        height: calc(100vh - 120px);
    }

    .chat-history {
        padding: 0.75rem;
    }

    .message {
        max-width: 95%;
        padding: 0.5rem;
    }

    .input-container {
        padding: 0.75rem;
        flex-direction: column;
    }

    #user-input {
        border-radius: 8px;
    }

    #send-button {
        align-self: stretch;
        border-radius: 8px;
    }
}