@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;500;700&display=swap');

:root {
  --primary-color: #00c3ff;
  --secondary-color: #3a3b47;
  --background-color: #1a1b2e;
  --chat-bg-color: rgba(30, 31, 48, 0.7);
  --text-color: #e0e0e0;
  --input-bg-color: rgba(0, 195, 255, 0.1);
  --button-hover-color: #0099cc;
  --shadow-color: rgba(0, 195, 255, 0.2);
}

html, body {
    height: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden;
}

body {
    font-family: 'Orbitron', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    margin: 0;
    padding: 10px env(safe-area-inset-right) calc(env(safe-area-inset-bottom) + 5px) env(safe-area-inset-left);
}

.language-btn {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    font-size: 1.5em;
    cursor: pointer;
    color: var(--primary-color);
}

.language-btn:hover {
    color: var(--button-hover-color);
}

.chat-input input::placeholder {
    color: rgba(255, 255, 255, 0.5);
    font-family: 'Orbitron', sans-serif;
    font-size: 0.8em;
}

.iframe-container {
    flex: 1;
    width: 100%;
    max-width: 600px; /* Match the max-width of chat-container */
    margin: 10px auto;
    border-radius: 15px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    min-height: 300px;
    max-height: 60vh;
}

.iframe-container::before {
    content: '';
    position: absolute;
    top: -10px;
    left: -10px;
    right: -10px;
    bottom: -10px;
    border-radius: 15px;
    background: radial-gradient(
        circle at center,
        rgba(0, 195, 255, 0.2) 10%,
        rgba(0, 195, 255, 0.05) 50%,
        transparent 70%
    );
    filter: blur(10px);
    z-index: -1;
    pointer-events: none;
}

.iframe-container iframe {
    width: 100%;
    height: 100%;
    border: none;
    border-radius: 15px;
    background-color: transparent;
    position: relative;
    z-index: 1;
}

.chat-container {
    width: 100%;
    max-width: 600px;
    background-color: var(--chat-bg-color);
    border-radius: 15px;
    box-shadow: 0 0 10px rgba(0, 255, 255, 0.2);
    margin: 10px auto; /* Keep the same margin as iframe-container */
    display: flex;
    flex-direction: column;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(0, 255, 255, 0.1);
    max-height: calc(50vh - 20px);
}

.container-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px; /* Consistent gap between iframe and chat */
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
}

.chat-response-container {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: stretch;
    height: 75px;
    position: relative;
    overflow: hidden;
    padding-bottom: 10px;
}

.chat-response {
    padding: 10px;
    overflow-y: auto;
    font-size: 1.2em;
    width: 100%;
    height: 100%;
    opacity: 0;
    animation: fadeIn 1s ease-in forwards;
    display: block;
    word-wrap: break-word;
    box-sizing: border-box;
    color: var(--text-color);
    text-shadow: 0 0 5px rgba(0, 195, 255, 0.5);
}
  
  .chat-response[dir="ltr"] {
      text-align: left;
  }
  
  .chat-response[dir="rtl"] {
      text-align: right;
  }
  
  #history-content div {
      margin-bottom: 15px;
      font-size: 1em;
  }
  
  .chat-input {
    display: flex;
    justify-content: space-between;
    padding: 10px;
    background-color: var(--secondary-color);
    gap: 10px; /* This adds a 10px gap between flex items */
}

.chat-input input {
    flex-grow: 1; /* This allows the input to grow and fill available space */
    width: auto; /* Remove the fixed width */
    padding: 10px;
    border: 1px solid var(--primary-color);
    border-radius: 4px;
    background-color: var(--input-bg-color);
    color: var(--text-color);
    font-size: 1.2em;
}

.chat-input button {
    padding: 10px 20px;
    border: none;
    background-color: var(--primary-color);
    color: var(--background-color);
    border-radius: 4px;
    cursor: pointer;
    font-size: 1.2em;
    transition: all 0.3s ease;
    white-space: nowrap; /* Prevents the button text from wrapping */
}
  
  .chat-input button:hover {
      background-color: var(--button-hover-color);
      box-shadow: 0 0 10px var(--shadow-color);
  }
  
  .voice-input {
      display: flex;
      justify-content: center;
      align-items: center;
      padding: 10px;
      background-color: var(--secondary-color);
      position: relative;
  }
  
  #voice-button {
      background-color: var(--primary-color);
      border: none;
      border-radius: 50%;
      width: 60px;
      height: 60px;
      display: flex;
      align-items: center;
      justify-content: center;
      transition: all 0.3s ease;
      color: var(--background-color);
      margin: 0 20px;
      box-shadow: 0 0 10px var(--shadow-color);
  }
  
  #voice-button:active {
      transform: scale(0.9);
  }
  
  #voice-button.pressed {
      animation: buttonPress 0.2s;
  }
  
  #equalizer-left, #equalizer-right {
      width: 5px;
      height: 20px;
      background-color: var(--primary-color);
      margin: 0 5px;
      transition: height 0.1s;
  }
  
  .history-btn {
      position: absolute;
      right: 10px;
      top: 50%;
      transform: translateY(-50%);
      background: none;
      border: none;
      font-size: 1.5em;
      cursor: pointer;
      color: var(--primary-color);
  }
  
  .history-btn:hover {
      color: var(--button-hover-color);
  }
  
  .click-hold-text {
      text-align: center;
      color: var(--text-color);
      font-size: 0.9em;
      margin-top: 5px;
      padding-bottom: 6px;
  }
  
  .loading {
      position: absolute;
      bottom: 0;
      left: 50%;
      transform: translateX(-50%);
      width: 80%;
      max-width: 300px;
      height: 5px;
      background-color: rgba(0, 195, 255, 0.2);
      border-radius: 2.5px;
      overflow: hidden;
      display: none;
  }
  
  .loading .loading-bar {
      width: 100%;
      height: 100%;
      background-color: var(--primary-color);
      animation: loading 1s linear infinite;
  }
  
  .chat-history {
      position: fixed;
      top: 0;
      right: 0;
      width: 100%;
      height: 100%;
      max-width: 300px;
      background-color: var(--chat-bg-color);
      box-shadow: -5px 0 15px rgba(0, 0, 0, 0.1);
      overflow-y: auto;
      display: none;
      padding: 10px;
      z-index: 20;
      box-sizing: border-box;
      backdrop-filter: blur(10px);
  }
  
  .chat-history div {
      margin-bottom: 15px;
      font-size: 1em;
      border-bottom: 1px solid rgba(0, 195, 255, 0.2);
      padding-bottom: 10px;
  }
  
  .close-btn, .download-btn, .brochure-btn, .more-info-btn {
      background: var(--primary-color);
      border: none;
      padding: 10px;
      border-radius: 4px;
      cursor: pointer;
      color: var(--background-color);
      width: 100%;
      margin-bottom: 10px;
      font-size: 1em;
      transition: all 0.3s ease;
  }
  
  .close-btn:hover, .download-btn:hover, .brochure-btn:hover, .more-info-btn:hover {
      background: var(--button-hover-color);
      box-shadow: 0 0 10px var(--shadow-color);
  }
  
  .chat-response::-webkit-scrollbar {
      width: 8px;
  }
  
  .chat-response::-webkit-scrollbar-track {
      background: var(--secondary-color);
  }
  
  .chat-response::-webkit-scrollbar-thumb {
      background: var(--primary-color);
      border-radius: 4px;
  }
  
  .chat-response::-webkit-scrollbar-thumb:hover {
      background: var(--button-hover-color);
  }
  
  .queue-overlay {
      position: fixed;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      background-color: rgba(0, 0, 0, 0.8);
      display: flex;
      justify-content: center;
      align-items: center;
      z-index: 1000;
      backdrop-filter: blur(5px);
  }
  
  .queue-message {
      background-color: var(--chat-bg-color);
      padding: 20px;
      border-radius: 10px;
      text-align: center;
      box-shadow: 0 0 20px var(--shadow-color);
  }
  
  .queue-position {
      font-size: 48px;
      font-weight: bold;
      margin: 20px 0;
      color: var(--primary-color);
  }
  
  #more-info {
      font-size: 0.9em;
      margin-top: 10px;
      padding: 10px;
      background-color: var(--secondary-color);
      border-radius: 4px;
  }
  
  #time-left {
      display: flex;
      justify-content: center;
      align-items: center;
      font-size: 0.7em;
      padding-bottom: 2px;
      color: var(--primary-color);
  }
  
  .rejoin-button {
    background-color: var(--primary-color);
    color: var(--background-color);
    border: none;
    padding: 12px 24px;
    font-size: 1em;
    font-weight: bold;
    border-radius: 30px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px var(--shadow-color);
    outline: none;
    position: relative;
    overflow: hidden;
}

.rejoin-button:before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        120deg,
        transparent,
        rgba(255, 255, 255, 0.4),
        transparent
    );
    transition: all 0.6s;
}

.rejoin-button:hover {
    background-color: var(--button-hover-color);
    transform: translateY(-2px);
    box-shadow: 0 6px 8px var(--shadow-color);
}

.rejoin-button:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px var(--shadow-color);
}

.rejoin-button:hover:before {
    left: 100%;
}
.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
  ::selection {
      background-color: var(--primary-color);
      color: var(--background-color);
  }
  
  @keyframes loading {
      0% { transform: translateX(-100%); }
      100% { transform: translateX(100%); }
  }
  
  @keyframes slideIn {
      0% { transform: translateY(100%); }
      100% { transform: translateY(0); }
  }
  
  @keyframes fadeIn {
      0% { opacity: 0; }
      100% { opacity: 1; }
  }
  
  @keyframes buttonPress {
      0% { transform: scale(1); }
      50% { transform: scale(0.9); }
      100% { transform: scale(1); }
  }
  
  @media (max-width: 768px) {
    body {
        height: -webkit-fill-available;
        display: flex;
        flex-direction: column;
    }

    .iframe-container {
        max-width: 90%;
        height: 50vh;
        min-height: 150px;
        margin: 5px auto;
    }

    .chat-container {
        max-width: 90%;
        margin: 5px auto 10px; /* Added bottom margin for gap */
        flex-shrink: 0;
        max-height: calc(70vh - 25px); /* Adjusted to account for bottom gap */
    }

    .chat-response-container {
        height: 100px;
        max-height: calc(100% - 120px);
    }

    .chat-input {
        padding: 5px;
    }

    .chat-input input {
        width: 70%;
    }

    .chat-input button {
        padding: 10px;
        font-size: 1.1em;
    }

    .chat-response {
        padding: 10px;
        font-size: 1em;
    }

    .chat-history {
        width: 100%;
        max-width: 100%;
        height: 100%;
        left: 0;
    }

    .loading .loading-bar {
        width: 90%;
    }

    .voice-input {
        padding: 5px;
    }

    #voice-button {
        width: 50px;
        height: 50px;
    }

    .click-hold-text {
        font-size: 0.8em;
        margin-top: 2px;
        padding-bottom: 2px;
    }
}

@supports (-webkit-touch-callout: none) {
    body {
        min-height: -webkit-fill-available;
    }
}

@media screen and (max-height: 600px) {
    .iframe-container {
        height: 25vh;
        min-height: 120px;
    }

    .chat-container {
        max-height: calc(75vh - 25px); /* Adjusted to account for bottom gap */
        margin-bottom: 10px; /* Added bottom margin for gap */
    }

    .chat-response-container {
        height: 80px;
        max-height: calc(100% - 100px);
    }
}

/* Add this new style for the bottom gap */
.bottom-gap {
    height: 10px;
    width: 100%;
}
