:root {
    --primary-color: #4285F4;
    --primary-dark: #3367D6;
    --background-color: #f5f5f5;
    --text-color: #333;
    --card-background: #ffffff;
    --border-color: #e0e0e0;
    --font-family: 'Roboto', sans-serif;
}

body {
    font-family: var(--font-family);
    background-color: var(--background-color);
    color: var(--text-color);
    margin: 0;
    padding: 2rem;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
}

#app-container {
    max-width: 700px;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

header {
    text-align: center;
}

header h1 {
    font-size: 2.5rem;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

header p {
    font-size: 1.1rem;
    color: #666;
}

.card {
    background-color: var(--card-background);
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    padding: 1.5rem;
}

#image-upload-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1.5rem;
    margin-bottom: 1.5rem;
}

#image-preview {
    max-width: 100%;
    max-height: 300px;
    border-radius: 4px;
    border: 1px solid var(--border-color);
}

.file-upload-label {
    background-color: var(--primary-color);
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s ease-in-out;
    font-weight: 500;
}

.file-upload-label:hover {
    background-color: var(--primary-dark);
}

#file-upload {
    display: none;
}

.prompt-section {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.input-wrapper {
    position: relative;
    display: flex;
    width: 100%;
}

#prompt-input {
    width: 100%;
    padding: 0.75rem;
    padding-right: 3.5rem; /* Make space for the mic icon */
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-family: var(--font-family);
    font-size: 1rem;
    resize: vertical;
    box-sizing: border-box;
}

#voice-input-button {
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    cursor: pointer;
    color: #666;
    padding: 0.5rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s, background-color 0.2s;
}

#voice-input-button:hover:not(:disabled) {
    color: var(--primary-color);
    background-color: #f0f0f0;
}

#voice-input-button:disabled {
    cursor: not-allowed;
    color: #bdbdbd;
}


#voice-input-button.listening {
    color: #d93025;
    animation: pulse 1.5s infinite;
}

#submit-button, #read-aloud-button {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 0.8rem 1.5rem;
    border-radius: 4px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s ease-in-out, opacity 0.2s ease-in-out;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

#submit-button:hover:not(:disabled) {
    background-color: var(--primary-dark);
}

#submit-button:disabled {
    background-color: #9E9E9E;
    cursor: not-allowed;
}


#response-section {
    position: relative;
}

#response-section h2 {
    margin-top: 0;
    color: var(--primary-color);
}

#response-text {
    white-space: pre-wrap;
    line-height: 1.6;
}

.hidden {
    display: none !important;
}

/* Loader animation */
#loader {
    border: 4px solid #f3f3f3;
    border-radius: 50%;
    border-top: 4px solid var(--primary-color);
    width: 30px;
    height: 30px;
    animation: spin 1s linear infinite;
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
}

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

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(217, 48, 37, 0.4);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(217, 48, 37, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(217, 48, 37, 0);
    }
}

@media (max-width: 600px) {
    body {
        padding: 1rem;
    }

    header h1 {
        font-size: 2rem;
    }
}