
/* === Base Styles === */
:root {
    --bg: #282828;
    --fg: #ebdbb2;
    --dark-gray: #3c3836;
    --light-gray: #a89984;
    --yellow: #d79921;
    --green: #b8bb26;
    --blue: #83a598;
    --red: #fb4934;
    --orange: #fe8019;
  }
  
  * {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Whitney', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  }
  
  body {
    background-color: var(--bg);
    color: var(--fg);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 100vh;
  } 
    input,
    textarea {
      border: none;
      outline: none; /* Optional: removes focus outline */
      background-color: var(--bg);
      color: var(--fg);
      padding: 10px;
      border-radius: 4px;
    }
    
/* === Layout Structure === */
#app-container {
    display: flex;
    height: 100vh;
    width: 100vw;
    
  }
  
  /* Sidebar container (holds server bar + DM pane + user bar) */
  #sidebar-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 275px;
    gap: 10px; /* space between top and bottom */
    padding: 10px;
  }
  
  
  #sidebar-top {
    display: flex;
    flex-grow: 1;
    overflow: hidden;

  }
  
  /* === Server Bar === */
  #server-bar {
    width: 72px;
    background-color: var(--dark-gray);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px 0;
    gap: 8px;
    overflow-y: auto;
    border-right: 0.75px solid var(--light-gray);

  }
  
  /* Server Buttons */
  .server-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background-color: var(--dark-gray);
    border: none;
    color: var(--fg);
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
  }
  .server-btn.add-server {
    margin-top: auto;
    background-color: var(--bg);
    color: var(--blue);
  }
  
  #add-server{
    align-items: end;

  }
  .server-btn:hover {
    border-radius: 16px;
    background-color: var(--blue);
  }
  
  .server-btn:first-child {
    background-color: var(--blue);
    color: white;
  }
  
  /* === DM Pane === */
  #dm-pane {
    width: 240px;
    background-color: var(--dark-gray);
    display: flex;
    flex-direction: column;
    padding: 10px;
    gap: 5px;
    overflow-y: auto;
    flex-grow: 1;

  }
  
  #dm-pane h3 {
    text-align: center;
    color: var(--light-gray);
    text-decoration:underline;
    font-size: 13px;
    margin: 10px 8px;
    letter-spacing: 0.5px;

  }
  
  .dm-btn {
    color: var(--fg);
    background-color: var(--bg);
    border: none;
    text-align: left;
    padding: 15px 8px;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 5px; 
    transition: background-color 0.2s, transform 0.1s ease;
    font-size: 15px; 
  }
  .dm-btn:hover {
    background-color: var(--light-gray);
    color: --var(fg);
  }
  .dm-btn.selected {
    background-color: var(--blue);
    color: --var(fg);
  }
  .notification-dot {
    height: 8px;
    width: 8px;
    background-color: var(--orange);
    border-radius: 50%;
    margin-right: 8px;
  }

  #user-bar {
    height: 76px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    font-size: 14px;

  }
  
  #sidebar-top,
#user-bar {
  border-radius: 16px;
  background-color: var(--dark-gray);
  border: 1px solid var(--light-gray);

}

  #user-info {
    display: flex;
    align-items: center;
    gap: 8px;
  }
  
  #themeToggle {
    width: 13px;
    height: 13px;
    background-color: var(--blue); /* Online status color */
    border-radius: 50%;
    box-shadow: 0 0 4px var(--blue);
    border: none;
  }
  
#username {
  font-weight: 600;
  background-color: var(--bg);
  padding: 6px 10px;
  border-radius: 12px;  /* more rounded */
  border: 1.4px solid var(--light-gray);
  color: var(--fg);
  box-shadow: 0 0 6px rgba(0,0,0,0.2);  /* soft glow */
}
  
  #logout-button {
    color: var(--red);
    background: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    transition: color 0.2s ease;
  }
  
  #logout-button:hover {
    color: var(--fg);
  }
  
  
  #main-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    background-color: var(--bg);
  } 

  
  /* === Chat Area === */
  #ChatTitle {
    text-align: center;
    color: var(--fg);
    font-size: 20px;
    font-weight: 600;
    padding: 10px 0;
    border-bottom: 1.4px solid var(--light-gray);
    margin: 10px 16px 10px 16px;  /* Align horizontally */
    border-radius: 12px ;  /* Top rounding */
    background-color: var(--dark-gray);
    
    }
  
  #ChatBox {
    
    flex: 1;
    overflow-y: auto;
    padding: 10px;
    border-radius: 4px;
    background: var(--bg);
    display: flex;
    flex-direction: column;
    gap: 2px;
    width: 100%;

    opacity: 1;
    transition: opacity 0.3s ease;
  }
  
  #ChatBox.fade-transition {
    opacity: 0;
    transition: opacity 0.25s ease-in-out;
  }

  /* .fade-in {
    opacity: 0;
    transition: opacity 0.3s ease-in;
  }
  
  .fade-in.show {
    opacity: 1;
  } */
  
  .ChatBoxClone {
    display: flex;
    flex-direction: column;
    width: 100%;
    gap: 2px;

  }

/* Default message styles */
#ChatBox p {
    color: var(--fg);
}
#ChatBox button {
    user-select: none;
    color: var(--yellow);
    background: none;
    border: none;
    cursor: pointer;
    font-size: 19px;
    font-weight: bold;
}

/* Messages from others */
.OtherMessage {
    align-self: flex-start;
    background: var(--dark-gray);
    border-radius: 5px;
    max-width: 80%;
    word-wrap: break-word;
    padding: 10px;
    color: var(--fg);
}

/* Your own messages */
.SelfMessage {
    align-self: flex-end;
    background: var(--dark-gray);
    border-radius: 5px;
    max-width: 80%;
    word-wrap: break-word;
    padding: 10px;
    color: var(--bg);
    text-align: right;
}

/* Server messages */
.ServerMessage {
    align-self: center;
    background: var(--dark-gray);
    border-radius: 5px;
    padding: 10px;
    width: fit-content;
    max-width: 80%;
    font-weight: bold;
    font-size: 18px;
    text-align: center;
    color: var(--yellow);
}
#ChatBox .ServerMessage button{
  color: var(--blue);
}
#ChatBox .ServerMessage button,
#ChatBox .SelfMessage button {
    pointer-events: none;
    cursor: not-allowed;
}
  #ChatBox::-webkit-scrollbar {
    width: 8px;
  }
  
  #ChatBox::-webkit-scrollbar-track {
    background: var(--dark-gray);
  }
  
  #ChatBox::-webkit-scrollbar-thumb {
    background-color: var(--light-gray);
    border-radius: 4px;
  }
  

  .timestamp {
    font-size: 0.75rem;  
    opacity: 0.6;      
    margin-left: 4px;
    user-select: none;        
  }
  
  .unread-divider {
    border-bottom: 1px solid var(--red);
    margin-bottom:10px;
    color: var(--red);
    text-align: center;
    font-style: italic;
}

.LoadingMessage {
    text-align: center;
    font-style: italic;
    color: #888;
}

  
  /* === Message Input === */
  #emoji-button {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
  }
  
  #MessageBox {
    display: flex;
    padding: 16px 16px 16px 5px ;
    gap: 10px;
    border-radius: 16px;
    background-color: var(--dark-gray);
    margin: 10px;
    border-top: 1.4px solid var(--light-gray);

  }
  
  #ClientMessage {
    flex: 1;
    padding: 12px;
    border: 1px solid var(--light-gray);
    border-radius: 5px;
    background-color: var(--bg);
    color: var(--fg);
    font-size: 16px;
  }
#sendBtn {
  padding: 12px 20px;
  border: none;
  border-radius: 5px;
  background-color: var(--blue);
  color: white;
  font-size: 16px;
  cursor: pointer;
  transition: background 0.3s ease, transform 0.1s ease, box-shadow 0.2s ease;
  position: relative;
  overflow: hidden;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

#sendBtn:hover {
  background-image: linear-gradient(135deg, var(--blue), var(--green));
  transform: scale(1.05);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

#sendBtn:active {
  transform: scale(0.95);
}

/* Ripple effect */
.ripple {
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.5);
  transform: scale(0);
  animation: ripple 0.6s linear;
}
@keyframes ripple {
  to {
    transform: scale(4);
    opacity: 0;
  }
}

  
  /* === Login Page === */
  #LoginWrapper {
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
  }
  
  #LoginBox {
    background-color: var(--dark-gray);
    padding: 30px;
    border-radius: 8px;
    width: 90vw;
    max-width: 400px;
    text-align: center;
  }
  
  #auth-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
  }
  
  #auth-form input {
    padding: 10px;
    border: 2px solid var(--fg);
    border-radius: 5px;
    background-color: var(--bg);
    color: var(--fg);
  }
  
  #auth-form button {
    padding: 10px;
    border: none;
    border-radius: 5px;
    background-color: var(--yellow);
    color: var(--bg);
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.2s;
  }
  
  #auth-form button:hover {
    background-color: var(--blue);
  }
  
  #log-reg-toggle {
    margin-top: 20px;
    background: none;
    border: none;
    color: var(--orange);
    font-weight: bold;
    cursor: pointer;
  }
  
  #log-message {
    margin-top: 10px;
    color: var(--red);
  }

  @media (max-width: 768px) {
    html, body {
      height: 100%;
      overflow-y: auto;
      -webkit-overflow-scrolling: touch;
    }
    #app-container {
      height: calc(var(--vh) * 100);
    }
    
    #sidebar-container,
    #main-content,
    body {
      height: calc(var(--vh) * 100);
    }
    
    #app-container {
      flex-direction: column;
      height: 100vh;
      overflow: hidden;
      user-select: none;
    }
  
    #sidebar-container {
      position: fixed;
      top: 37px;
      bottom: 60px;
      left: -60%;
      width: 55%;
      height: auto;
      z-index: 1000;
      transition: left 0.15s ease;
    }
    #sidebar-container h3{
      font-size: 10px;
      white-space: nowrap; 
    }

    #sidebar-container.active {
      left: 0;
    }  

  #server-bar {
    width: 40%;
    overflow-x: auto;
    border-right: none;
  }

  .server-btn {
    width: 30px;
    height: 30px;
    font-size: 13px;
  }

  .dm-btn {
    font-size: 13px;
    padding: 10px;
  }

  #user-bar {
    height: auto;
    padding: 12px;
    font-size: 12px;
    justify-content: space-between;
  }

  #main-content {
    flex-grow: 1;
    overflow: hidden;
    width: 100%;
  }

  #ChatTitle {
    font-size: 16px;
    padding: 8px;
    margin: 5px;
  }

  #MessageBox {
    padding: 10px;
    gap: 8px;
    margin: 5px;
    z-index: 999;
  }

  #ClientMessage {
    font-size: 14px;
    padding: 10px;
  }

  #sendBtn {
    font-size: 14px;
    padding: 10px;
  }

}


/* animations */

/* Bounce animation */
@keyframes bounceIn {
    0%   { transform: scale(0.95); }
    50%  { transform: scale(1.05); }
    100% { transform: scale(1); }
}
.bounce {
    animation: bounceIn 0.4s ease;
}

/* Shake animation */
@keyframes shakeAnim {
    0% { transform: translateX(0); }
    20% { transform: translateX(-5px); }
    40% { transform: translateX(5px); }
    60% { transform: translateX(-5px); }
    80% { transform: translateX(5px); }
    100% { transform: translateX(0); }
}
.shake {
    animation: shakeAnim 0.5s;
}

/* Optional: Smooth transitions for any element using fade/slide animations */
.fade-slide {
    transition: all 0.3s ease, opacity 0.3s ease;
}
