html, body {
  height: 100%;
  width: 100%;
  margin: 0;
  padding: 0;
  font-family: Arial, sans-serif;
  background-color: #3e1f00;
  color: #fff;
}

#container {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 10px;
  box-sizing: border-box;
}

#topContainer {
  display: flex;
  flex-direction: column;  /* stack vertically instead of side by side */
  margin-bottom: 10px;
  overflow-y: none;        /* scroll if too tall */
}

#templates {
  background-color: #5e2e00;
  padding: 8px;
  border-radius: 5px;
  margin: 0 0 10px 0;
  max-height: 100px;
  overflow-y: auto;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  flex-direction: row;
}

#templates h3 {
  flex-basis: 100%;
  margin: 0 0 0px 0;
  font-size: 18px;
  border-bottom: 1px solid #ff8000;
  padding-bottom: 2px;
}

.templateBtn {
  flex: 0 0 auto;
  height: 30px;
  font-size: 14px;
  background-color: #ff8000;
  color: #fff;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  text-align: center;
  transition: background 0.2s;
}

.templateBtn:hover {
  background-color: #e67300;
}

#inputContainer {
  flex: 0 0 auto; /* don’t force it to stretch */
  display: flex;
  flex-direction: column;
}

#sqlInput {
  padding: 5px;
  font-size: 16px;
  border: none;
  border-radius: 5px;
  outline: none;
  resize: vertical;
  min-height: 75px;
  background-color: #5e2e00;
  color: #fff;
  margin-bottom: 5px;
}

#terminal {
  flex: 1;
  border-radius: 5px;
  overflow: hidden;
  background-color: black;
  padding: 5px;
  margin-top: -5px;
  position: relative;
}

.bottomButtons {
  margin-top: 10px;
  padding: 2;
  font-size: 14px;
  display: flex;
  gap: 6px;
}

.button {
  background-color: #ff8000;
  border-radius: 5px;
  border: none;
  cursor: pointer;
  color: #fff;
}

.button:hover {
  background-color: #e67300;
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: #2e1a00;
  border-radius: 5px;
}

::-webkit-scrollbar-thumb {
  background-color: #ff8000;
  border-radius: 5px;
  border: 2px solid #2e1a00;
}

::-webkit-scrollbar-thumb:hover {
  background-color: #e67300;
}

* {
  scrollbar-width: thin;
  scrollbar-color: #ff8000 #2e1a00;
}

body {
  -ms-overflow-style: scrollbar;
}

/* Spinner overlay */
#spinnerOverlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  display: none;
}

.spinner {
  border: 6px solid #2e1a00;
  border-top: 6px solid #ff8000;
  border-radius: 50%;
  width: 50px;
  height: 50px;
  animation: spin 1s linear infinite;
}

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

.spinnerText {
  color: #ffb84d;
  font-size: 16px;
  margin-top: 10px;
  text-align: center;
}

.spinnerContainer {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.h1 {
  color: orange;
}

#footer {
  text-align: right;
  font-size: 16px;
  color: orange;
  margin-top: 8px;
}

#footer a {
  color: #ffb84d;
  text-decoration: none;
}

#footer a:hover {
  text-decoration: underline;
}

#header {
  text-align: center;
  font-size: 30px;
  font-weight: bold;
  margin: 6px 0;
  color: orange;
}

.dropdown {
  position: relative;
  display: inline-block;
  margin-bottom: 0px;
}

.dropbtn {
  flex: 0 0 auto;
  height: 30px;
  font-size: 14px;
  background-color: #ff8000;
  color: #fff;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  text-align: center;
  transition: background 0.01s;
}

.dropdown-content {
  display: none;
  position: fixed; /* floats relative to viewport */
  background-color: #1e1e1e; /* dark background for black theme */
  color: #ffb84d;            /* orange text to match terminal theme */
  max-width: 300px;          /* minimum width for readability */
  box-shadow: 0px 8px 16px rgba(0,0,0,0.7);
  z-index: 9999;
  border-radius: 6px;
  padding: 1px 1px;
  padding-bottom: 5px;
  font-size: 14px;
  font-family: monospace;
}

.dropdown-content button {
  width: 100%;
  padding: 8px;
  text-align: left;
  border: none;
  background: none;
  cursor: pointer;
}

.dropdown-content button:hover {
  background-color: #333; /* slightly lighter dark for hover effect */
  color: #ffa500;         /* brighter orange on hover */
}

#sendBtn, 
#sendBtn2, 
.button, 
.dropbtn, 
.templateBtn {
  font-size: 14px;
  background-color: #ff8000;
  color: #fff;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  text-align: center;
  padding: 6px;
  transition: background 0.2s;
}

#sendBtn:hover,
.button:hover {
  background-color: #e67300;
}

#userMenu {
  float: right;
  font-size: 14px;
  display: flex;          /* arrange buttons in a row */
  gap: 0px;              /* spacing between buttons */
  align-items: center;    /* vertical centering */
  margin-right: 5px;    /* vertical centering */
}

#userMenu a, 
#userMenu button {
  margin-left: 10px;
  text-decoration: none;
  background: none;
  border: none;
  color: #ffb84d;
  cursor: pointer;
  font-weight: bold;
}

#userMenu button:hover, 
#userMenu a:hover {
  text-decoration: underline;
}


/* User dropdown specific styling */
.user-dropdown {
  right: 0;                    /* align to the right */
  left: auto;
  display: inline-block;        /* container fits content */
  max-width: 120px;             /* slightly wider for comfort */
  white-space: nowrap;           /* prevent text wrapping */
  background-color: #5e2e00;    /* match template & input background */
  border-radius: 10px;           /* more rounded edges */
  overflow: hidden;
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.5); /* softer shadow */
  transition: background 0.2s;
  font-family: Arial, sans-serif;
}

/* Individual buttons inside dropdown */
.user-dropdown button {
  display: block;               /* full width */
  padding: 8px 5px;           /* comfortable padding */
  background: none;
  border: none;
  text-align: left;
  color: #ffb84d;
  font-weight: bold;
  cursor: pointer;
  border-bottom: 1px solid #ff8000; /* subtle divider */
  transition: background-color 0.2s, color 0.2s;
  border-radius: 0;             /* reset for individual buttons */
}

.user-dropdown button:last-child {
  border-bottom: none;          /* remove border for last button */
}

/* Hover effect */
.user-dropdown button:hover {
  background-color: #ff8000;    /* bright orange hover */
  color: #fff;                  /* contrast text on hover */
}

/* Optional: smooth dropdown animation */
.user-dropdown.show {
  display: block;
  animation: fadeIn 0.2s ease-in-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-5px); }
  to { opacity: 1; transform: translateY(0); }
}




@media (max-width: 850px) {
  #header { 
    font-size: 20px; 
  }

  #templates h3 { 
    font-size: 14px; 
  }

  #sqlInput { 
    font-size: 11px; 
    min-height: 50px; 
  }

  .user-dropdown {
    width: 20px;           /* fixed width for mobile */
    border-radius: 8px;
    font-size: 12px;
    white-space: nowrap;    /* prevent wrapping */
    overflow: hidden;       /* hide overflow */
    text-overflow: ellipsis; /* truncate long text */
  }

  .user-dropdown button {
    padding: 4px 2px;       /* smaller padding */
    font-size: 12px;
    border-bottom: 1px solid #ff8000;
  }

  .user-dropdown button:last-child {
    border-bottom: none;
  }

  .user-dropdown button:hover {
    background-color: #ff8000;
    color: #fff;
  }

  .templateBtn, 
  #sendBtn, 
  #sendBtn2, 
  .button,  
  .dropbtn {
    height: 20px;
    font-size: 10px;
    padding: 2px 4px;
  }

  .dropdown-content {
    font-size: 4px;
    min-width: 140px;
  }

  .bottomButtons, 
  .dropbtn, 
  .button {
    gap: 4px;
  }

  #userMenu a,   
  #userMenu button {
    font-size: 12px;
  }

  #terminal {
    padding: 3px;
  }

  #footer { 
    font-size: 11px; 
  }
}
