
* {
    margin: 0;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

:root {
    --bg-darker: #2f323a;
    --bg-container: #1c1f26;
    --text-color: #e2e8f0;
    --border-color: #2d3544;
    --header-bg: black;
    --header-text: white;
    --user-message-bg: #294a74;
    --bot-message-bg: #373f53;
    --button-primary-bg: #1b5a9d;
    --button-primary-hover-bg: #185291;
    --button-secondary-bg: #026f81;
    --button-secondary-hover-bg: #026676;
    --disabled-bg: #374151;
    --input-bg: black;
    --input-placeholder: #64748b;
    --accent-color: #06b6d4;
}

html, body {
    margin: 0;
    padding: 0;
}

body {
    overflow: hidden;
    background: var(--bg-darker);
    color: var(--text-color);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background-image: url('./img/back1.jpg');
    background-size: cover;
    background-repeat: no-repeat;
    background-position: center center;
}

.container {
    background: var(--bg-container);
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    position: relative;
}

.header {
    background: var(--header-bg);
    color: var(--header-text);
    padding: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-left img {
    width: 24px;
    height: 24px;
    margin-left: 10px;
}

.header-right {
    font-size: 1.2rem;
    margin-right: 10px;
}

.header h1 {
    font-size: 22px;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.chat-container {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) var(--bg-container);
}

.chat-container::-webkit-scrollbar {
    width: 8px;
}

.chat-container::-webkit-scrollbar-track {
    background: var(--bg-container);
}

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

.message {
    margin-bottom: 20px;
    display: flex;
    align-items: flex-start;
}

.message.user {
    flex-direction: row-reverse;
}

.message-content {
    max-width: 70%;
    padding: 14px;
    border-radius: 18px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    line-height: 1.5;
}

.message-content img {
    border-radius: 14px;
}

.user .message-content {
    background: var(--user-message-bg);
    color: var(--header-text);
    border-bottom-right-radius: 4px;
}

.bot .message-content, .assistant .message-content {
    background: var(--bot-message-bg);
    color: var(--text-color);
    border-bottom-left-radius: 4px;
}

.camera-container {
    padding-top: 20px;
    text-align: center;
    background: var(--bg-container);
    flex-shrink: 0;
}

#video {
    width: 100%;
    max-width: 352px;
    border-radius: 12px;
    margin-bottom: 16px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    border: 2px solid var(--border-color);
}

#canvas {
    display: none;
}

.input-container {
    padding: 8px 20px;
    display: none;
    background: var(--bg-container);
    flex-shrink: 0;
}

.controls {
    padding: 10px 20px 20px 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 12px;
    background: var(--bg-container);
    flex-shrink: 0;
}

button {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s ease;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

#captureBtn {
    background: var(--button-primary-bg);
    color: var(--header-text);
    flex: 1;
}

#captureBtn:hover {
    background: var(--button-primary-hover-bg);
    transform: translateY(-1px);
}

#sendBtn {
    background: var(--button-secondary-bg);
    color: var(--header-text);
    flex: 1;
}

#sendBtn:hover {
    background: var(--button-secondary-hover-bg);
    transform: translateY(-1px);
}

#sendBtn:disabled, #captureBtn:disabled {
    background: var(--disabled-bg);
    cursor: not-allowed;
    transform: none;
}

#messageInput {
    width: 100%;
    padding: 14px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    background: var(--input-bg);
    color: var(--text-color);
    transition: border-color 0.2s ease;
}

#messageInput:focus {
    outline: none;
    border-color: gray;
    box-shadow: 0 0 0 2px rgba(124, 58, 237, 0.2);
}

#messageInput::placeholder {
    color: var(--input-placeholder);
}

.message-content h1 {
    color: #f8fafc;
    font-size: 20px;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 8px;
}

.message-content p {
    margin-bottom: 12px;
    line-height: 1.6;
}

p, li, h3 {
    padding: 5px;
}

.spinner {
    border: 4px solid var(--button-primary-bg);
    border-top-color: #7c3aed;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    animation: spin 1s linear infinite;
    box-sizing: border-box;
    display: inline-block;
    vertical-align: middle;
    margin-right: 10px;
}

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

a {
    color: #80fbff; 
}


/* Mobile First Design (up to 480px) */
@media screen and (max-width: 480px) {
    body {
        display: block;
    }

    .container {
        width: 100%;
        height: 100vh;
        border-radius: 0;
    }

    .chat-container {
        padding: 16px;
    }

    .camera-container {
        padding: 16px;
    }

    #video {
        width: 100%;
        height: 35vh;
        object-fit: cover;
    }

    .message-content {
        max-width: 85%;
        padding: 12px;
        font-size: 16px;
        -webkit-text-size-adjust: 100%;
    }

    .message-content img {
        width: 100%;
        height: 35vh;
        object-fit: cover;
        object-position: center 20%;
    }

    .controls {
        padding: 8px 16px 16px 16px;
    }

    button {
        padding: 10px 16px;
        font-size: 13px;
    }

    .header h1 {
        font-size: 18px;
    }

    .header-left img{
        margin-left: 0;
    }

    .header-right {
        font-size: 1.0rem;
        margin-right: 0;
    }

    .input-container {
    padding: 8px 15px;
    }
}

/* Small Tablet (481px - 768px) */
@media screen and (min-width: 481px) and (max-width: 768px) {
    body {
        padding: 20px;
    }

    .container {
        width: 500px;
        height: 85vh;
        min-height: 700px;
        max-height: 800px;
    }

    #video {
        max-width: 400px;
        max-height: 35vh;
        object-fit: cover;
    }

    .message-content {
        max-width: 75%;
        min-width: 0;
    }

    .message-content img {
        width: 100%;
        height: 35vh;
        object-fit: cover;
    }
}

/* Large Tablet (769px - 1024px) */
@media screen and (min-width: 769px) and (max-width: 1024px) {
    body {
        padding: 20px;
    }

    .container {
        width: 600px;
        height: 85vh;
        min-height: 700px;
        max-height: 850px;
    }

    #video {
        max-width: 500px;
        max-height: 35vh;
        object-fit: cover;
    }

    .message-content {
        max-width: 75%;
    }

     .message-content img {
        width: 100%;
        height: 35vh;
        object-fit: cover;
    }
}

/* Desktop (1025px and above) */
@media screen and (min-width: 1025px) {
    body {
        min-height: 100vh;
    }

    .container {
        width: 800px;
        height: 85vh;
        max-height: 900px;
        min-height: 700px;
    }

    #video {
        max-width: 450px;
        max-height: 35vh;
    }

    .header h1 {
        font-size: 24px;
    }

    .message-content {
        max-width: 70%;
        font-size: 16px;
    }

    button {
        padding: 14px 28px;
        font-size: 15px;
    }

    #messageInput {
        padding: 16px;
        font-size: 16px;
    }
}

.audio-wave-container {
  display: inline-block;
  margin-right: 15px;
  vertical-align: middle;
  position: absolute;
  right: 45px;  /* Position it to the left of the TTS toggle */
  top: 53%;
  transform: translateY(-50%);
}

#messageInput {
  flex: 1;
  padding-right: 45px; /* Make room for the toggle button */
}
.tts-toggle {
  background: none;
  border: none;
  color: #333;
  font-size: 1.8rem;
  cursor: pointer;
  padding: 5px 15px;
  margin-left: 15px;
  border-radius: 50%;
  transition: background-color 0.3s;
  position: absolute;
  right: 10px;
  top: 48%;
  transform: translateY(-50%);
  z-index: 10;
  -webkit-tap-highlight-color: transparent;
}

.tts-toggle:hover {
  background-color: rgba(0, 0, 0, 0.1);
}

#inputContainer {
  position: relative;
  display: flex;
  align-items: center;
}

.audio-loading {
  display: inline-block;
  margin-left: 10px;
  vertical-align: middle;
}

.audio-wave {
  display: inline-block;
  width: 35px;
  height: 25px;
  background: linear-gradient(#3498db, #3498db) center/3px 60% no-repeat,
              linear-gradient(#3498db, #3498db) center/3px 80% no-repeat,
              linear-gradient(#3498db, #3498db) center/3px 40% no-repeat,
              linear-gradient(#3498db, #3498db) center/3px 70% no-repeat,
              linear-gradient(#3498db, #3498db) center/3px 50% no-repeat;
  background-position: 20% center, 35% center, 50% center, 65% center, 80% center;
  animation: audio-wave 1.2s infinite ease-in-out;
}

@keyframes audio-wave {
  0% {
    background-size: 3px 60%, 3px 80%, 3px 40%, 3px 70%, 3px 50%;
  }
  25% {
    background-size: 3px 40%, 3px 60%, 3px 80%, 3px 50%, 3px 70%;
  }
  50% {
    background-size: 3px 70%, 3px 40%, 3px 60%, 3px 80%, 3px 50%;
  }
  75% {
    background-size: 3px 50%, 3px 70%, 3px 40%, 3px 60%, 3px 80%;
  }
  100% {
    background-size: 3px 60%, 3px 80%, 3px 40%, 3px 70%, 3px 50%;
  }
}

.footer-credits {
    display: flex;
    justify-content: space-between;
    align-items: center; /* Vertically align items if needed */
    margin-bottom: 1rem;
    padding: 0 20px; /* Add padding to match controls if needed */
    font-size: 1rem;
}

.footer-credits > div {
    flex: 1; /* Allow each div to take up space */
}