:root {
    --bg-color: #121212;
    --card-bg: #1e1e1e;
    --primary-color: #bb86fc;
    --primary-variant: #3700b3;
    --secondary-color: #03dac6;
    --error-color: #cf6679;
    --text-primary: #e1e1e1;
    --text-secondary: #b0b0b0;
    --border-color: #333333;
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
    padding-bottom: 50px;
}

nav {
    background-color: var(--card-bg);
    display: flex;
    align-items: center;
    padding: 1rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    position: sticky;
    top: 0;
    z-index: 1000;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.logo {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary-color);
    flex-shrink: 0;
    margin-right: 2rem;
}

.nav-links {
    display: flex;
    gap: 1.5rem;
    padding: 0 1rem;
}

.nav-links a {
    color: var(--text-primary);
    text-decoration: none;
    white-space: nowrap;
    transition: color 0.3s;
    padding: 0.5rem 1rem;
}

.nav-links a:hover {
    color: var(--primary-color);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

section {
    margin-bottom: 3rem;
}

h2 {
    color: var(--primary-color);
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5rem;
    margin-bottom: 1.5rem;
}

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

h3 {
    color: var(--secondary-color);
    margin-bottom: 1.5rem;
}

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

label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
}

input, textarea, select {
    width: 100%;
    padding: 0.8rem;
    border-radius: 4px;
    border: 1px solid var(--border-color);
    background-color: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    font-size: 1rem;
}

select {
    text-align: center;
    text-align-last: center;
}

textarea {
    resize: vertical;
}

.btn {
    background-color: var(--primary-color);
    color: #000;
    border: none;
    padding: 0.8rem 1.5rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    transition: background-color 0.3s;
}

.btn:hover {
    background-color: var(--primary-variant);
    color: white;
}

.button-container, .button-group {
    display: flex;
    gap: 10px;
    margin-top: 10px;
    flex-wrap: wrap;
}

.button-group button {
    flex: 1;
    min-width: 120px;
}

.result {
    margin-top: 15px;
    padding: 15px;
    background-color: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
    white-space: pre-wrap;
}

.conversations-container {
    margin-top: 20px;
    display: none;
}

.conversation-item {
    background: var(--card-bg);
    padding: 15px;
    margin: 10px 0;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.chat-content {
    font-size: 14px;
    line-height: 1.6;
    margin: 10px 0;
    white-space: pre-wrap;
}

.chat-details {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: var(--text-secondary);
}

.image-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
    margin-top: 16px;
}

.image-grid img {
    width: 100%;
    height: auto;
    border-radius: 6px;
    transition: transform 0.3s;
}

.image-grid img:hover {
    transform: scale(1.05);
}

audio {
    width: 100%;
    margin-top: 1rem;
}

.transcription-text {
    margin: 10px 0;
    line-height: 1.5;
}

.info-text {
    color: var(--text-secondary);
    font-style: italic;
    margin: 5px 0;
}

/* Styling for the audio transcription section */
#transcriptionResult {
    position: relative;
}

#transcriptionResult button {
    margin-top: 10px;
    background-color: #4CAF50;
}

#transcriptionResult button:hover {
    background-color: #3e8e41;
}

#transcriptionResult audio {
    border-radius: 4px;
    margin-top: 15px;
    background-color: rgba(0, 0, 0, 0.2);
}

.copy-btn {
    margin-left: 10px;
    padding: 5px 10px;
    font-size: 0.85rem;
    background-color: #444;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.copy-btn:hover {
    background-color: #555;
}

.endpoint-display {
    font-family: monospace;
    color: var(--secondary-color);
    margin-bottom: 10px;
    padding: 5px;
    background-color: rgba(0, 0, 0, 0.3);
    border-radius: 4px;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
}

.result {
    margin-top: 1.5rem;
    padding: 1rem;
    background-color: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
    min-height: 50px;
    white-space: pre-wrap;
    overflow-x: auto;
    position: relative;
}

.code-block {
    background-color: rgba(0, 0, 0, 0.3);
    padding: 20px;
    border-radius: 4px;
    margin: 10px 0;
    position: relative;
    max-height: 300px;
    overflow: auto;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    white-space: pre-wrap;
    color: lime;
}

.code-block .copy-btn {
    opacity: 0.7;
}

.code-block .copy-btn:hover {
    opacity: 1;
}

.code-display {
    margin-top: 1.5rem;
    border-radius: 4px;
    background-color: rgba(0, 0, 0, 0.2);
    overflow: hidden;
}

.code-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 10px;
    background-color: rgba(0, 0, 0, 0.3);
    border-bottom: 1px solid var(--border-color);
}

.code-header span {
    font-weight: bold;
    color: var(--secondary-color);
}

.mic-container {
    display: flex;
    align-items: center;
    gap: 15px;
}

.mic-btn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--card-bg);
    border: 2px solid var(--border-color);
    cursor: pointer;
    transition: all 0.3s ease;
}

.mic-btn.recording {
    background-color: #4CAF50;
    border-color: #2E7D32;
    animation: pulse 1.5s infinite;
}

.mic-icon {
    font-size: 1.5rem;
}

#recordingStatus {
    color: var(--text-secondary);
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(76, 175, 80, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(76, 175, 80, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(76, 175, 80, 0);
    }
}

/* Loading indicator for transcription/TTS */
.loading-text {
    position: relative;
    padding-left: 20px;
    color: var(--text-secondary);
}

.loading-text:before {
    content: "";
    position: absolute;
    left: 0;
    top: 50%;
    width: 10px;
    height: 10px;
    margin-top: -5px;
    border-radius: 50%;
    border: 2px solid #4CAF50;
    border-top-color: transparent;
    animation: spin 1s linear infinite;
}

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

/* Processing indicator */
#processing {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: rgba(0, 0, 0, 0.8);
    color: var(--primary-color);
    font-size: 1.5rem;
    padding: 1.5rem 2rem;
    border-radius: 8px;
    z-index: 1001;
    text-align: center;
    display: none;
    box-shadow: 0 0 20px rgba(187, 134, 252, 0.5);
    animation: colorChange 2s infinite;
}

@keyframes colorChange {
    0% { 
        color: #bb86fc; /* Purple */
        box-shadow: 0 0 20px rgba(187, 134, 252, 0.7);
    }
    25% { 
        color: #03dac6; /* Teal */
        box-shadow: 0 0 20px rgba(3, 218, 198, 0.7);
    }
    50% { 
        color: #cf6679; /* Pink/Red */
        box-shadow: 0 0 20px rgba(207, 102, 121, 0.7);
    }
    75% { 
        color: #3700b3; /* Deep Purple */
        box-shadow: 0 0 20px rgba(55, 0, 179, 0.7);
    }
    100% { 
        color: #bb86fc; /* Back to Purple */
        box-shadow: 0 0 20px rgba(187, 134, 252, 0.7);
    }
}

.slider-container {
    display: flex;
    align-items: center;
    gap: 10px;
}

.slider-container input[type="range"] {
    flex-grow: 1;
}

.slider-container span {
    min-width: 20px;
    text-align: center;
}


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

    .nav-links {
        margin-top: 1rem;
    }

    .nav-links a {
        margin: 0 0.5rem;
    }

    .container {
        padding: 1rem;
    }

    .button-group {
        flex-direction: column;
    }
}

.function-response {
  margin-top: 20px;
  padding: 10px;
  background-color: rgba(3, 218, 198, 0.1);
  border-radius: 5px;
  border-left: 4px solid var(--secondary-color);
}

.function-response pre {
  white-space: pre-wrap;
  font-family: 'Courier New', monospace;
  font-size: 14px;
  background-color: rgba(0, 0, 0, 0.2);
  padding: 10px;
  border-radius: 5px;
  overflow: auto;
  color: var(--text-primary);
}

.image-upload-container {
  margin: 10px 0;
}

.image-upload-label {
  display: block;
  margin-bottom: 5px;
  font-weight: bold;
  color: var(--text-secondary);
}

.image-upload {
  margin-bottom: 10px;
}

.image-preview {
  margin: 10px 0;
  max-width: 100%;
  background-color: rgba(0, 0, 0, 0.2);
  border-radius: 8px;
  padding: 10px;
  display: flex;
  justify-content: center;
  min-height: 50px;
}

.image-preview img {
  max-width: 300px;
  max-height: 200px;
  border-radius: 5px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.info-text {
    color: #666;
    font-size: 0.9rem;
    margin: 5px 0 15px;
}

.info-section {
    background-color: var(--card-bg);
    border-left: 3px solid var(--secondary-color);
    padding: 10px 15px;
    margin: 15px 0;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.info-section.collapsed .collapsible-content {
    display: none;
}

.info-section:hover {
    background-color: rgba(3, 218, 198, 0.1);
}

.code-example pre {
    background-color: #2d2d2d;
    color: #f8f8f2;
    padding: 12px;
    border-radius: 4px;
    overflow-x: auto;
    font-family: monospace;
    margin: 8px 0;
    font-size: 0.85rem;
}

.info-box {
  background-color: rgba(3, 218, 198, 0.1);
  border-left: 4px solid var(--secondary-color);
  padding: 10px;
  margin: 10px 0;
  font-size: 14px;
  border-radius: 0 4px 4px 0;
}

.info-box p {
  margin: 0;
  color: var(--text-primary);
}


/* Add styles for image results */
#chatResultImage {
  display: block;
  max-width: 100%;
  margin-top: 10px;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
}

/* Improve image grid appearance */
.image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.image-grid img {
  width: 100%;
  height: auto;
  border-radius: 6px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  transition: transform 0.2s ease-in-out;
}

.image-grid img:hover {
  transform: scale(1.05);
}

.button-group {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.title-display {
    display: flex;
    align-items: center;
    gap: 10px;
}

#localDateTime {
    color: var(--text-secondary);
    font-size: 0.9em;
}

/* Conversations styles */
.conversations-container {
    margin-top: 20px;
    padding: 10px;
}

.conversation-item {
    background: rgba(255, 255, 255, 0.05);
    margin-bottom: 15px;
    border-radius: 5px;
    overflow: hidden;
}

.conversation-header {
    padding: 15px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.03);
    transition: background-color 0.3s;
}

.conversation-header:hover {
    background: rgba(255, 255, 255, 0.07);
}

.conversation-header h5 {
    margin: 0;
    color: var(--primary-color);
    font-size: 1.1em;
}

.toggle-icon {
    color: var(--text-secondary);
    font-size: 1.2em;
    font-weight: bold;
    transition: transform 0.3s;
}

.conversation-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
    background: rgba(0, 0, 0, 0.2);
}

.content-grid {
    padding: 15px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.content-section {
    padding: 10px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 4px;
}

.content-section.full-width {
    grid-column: 1 / -1;
}

.content-section label {
    color: var(--text-secondary);
    font-size: 0.9em;
    margin-bottom: 5px;
    display: block;
}

.content-section p {
    margin: 5px 0;
    color: var(--text-primary);
    line-height: 1.4;
    white-space: pre-wrap;
}

.error {
    color: #ff4444;
    padding: 10px;
    background: rgba(255, 68, 68, 0.1);
    border-radius: 4px;
}
/* End of existing styles */