:root {
  --bg-dark: #0a0a0a;
  --panel-bg: #141414;
  --accent-purple: #038c05; /* Your Green Accent */
  --accent-green: #9dfc8c;
  --text-main: #ffffff;
  --text-dim: #b3b3b3;
  --border: #2a2a2a;
  --glass: rgba(255, 255, 255, 0.05);
  --msg-bg: rgba(255, 255, 255, 0.03); /* Lighter gray for message boxes */
  --nav-height: 60px;
}

/* BASE LAYOUT */
body {
  margin: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background-color: var(--bg-dark);
  color: var(--text-main);
  display: flex;
  flex-direction: column;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
}

/* TOP NAVBAR */
.dashboard-nav {
  height: var(--nav-height);
  background: #000;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 20px;
  flex-shrink: 0;
  z-index: 10;
}

.nav-item {
  background: transparent;
  border: none;
  color: var(--text-dim);
  padding: 8px 15px;
  cursor: pointer;
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  transition: 0.2s;
}

.nav-item.active, .nav-item:hover {
  color: #fff;
}

/* MAIN CONTENT WRAPPER */
.main-container {
  display: flex;
  flex-direction: row;
  flex: 1;
  height: calc(100vh - var(--nav-height));
  overflow: hidden;
}

/* SIDEBAR - PROFESSIONAL REFINEMENT */
.sidebar {
  width: 320px;
  background: var(--panel-bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.sidebar-header {
  padding: 30px 24px;
  border-bottom: 1px solid var(--border);
}

.sidebar-header h2 {
  margin: 0 0 20px 0;
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.btn-add-friend {
  background: var(--accent-purple);
  color: white;
  border: none;
  padding: 8px 14px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  transition: opacity 0.2s;
}

.btn-add-friend:hover {
  opacity: 0.8;
}

.tab-container {
  display: flex;
  gap: 5px;
  background: #000;
  padding: 4px;
  border-radius: 10px;
}

.tab-btn {
  flex: 1;
  padding: 10px;
  background: transparent;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  border-radius: 7px;
  font-size: 0.75rem;
  font-weight: 700;
  transition: 0.2s;
}

.tab-btn.active {
  background: var(--border);
  color: white;
}

.list-container {
  flex: 1;
  overflow-y: auto;
}

.section-label {
  padding: 24px 24px 8px;
  font-size: 0.65rem;
  font-weight: 800;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 1.8px;
}

.room-item {
  padding: 14px 24px;
  cursor: pointer;
  border-bottom: 1px solid rgba(255,255,255,0.02);
  display: flex;
  align-items: center;
  gap: 12px;
  transition: 0.2s;
}

.room-item:hover {
  background: var(--glass);
}

.room-item.active {
  background: rgba(3, 140, 5, 0.12);
  border-left: 4px solid var(--accent-purple);
}

.room-item span {
  font-size: 0.95rem;
  font-weight: 500;
  letter-spacing: 0.1px;
}

.pfp-small {
  width: 38px;
  height: 38px;
  border-radius: 10px; /* Modern squircle */
  object-fit: cover;
  background: var(--border);
}

/* CHAT AREA WITH GREEN GLOW */
.chat-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  position: relative;
  /* Deep Radial Green Glow */
  background: radial-gradient(circle at center, rgba(3, 140, 5, 0.07) 0%, rgba(10, 10, 10, 1) 75%);
}

.chat-header {
  padding: 18px 25px;
  background: rgba(20, 20, 20, 0.7);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: 0.2px;
}

/* MESSAGE BOXES */
#messages {
  flex: 1;
  padding: 24px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px; /* Gap between different user messages */
}

.discord-msg {
  display: flex;
  padding: 18px;
  gap: 16px;
  background: var(--msg-bg);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: 14px;
  max-width: 80%;
  transition: border-color 0.2s, background 0.2s;
}

.discord-msg:hover {
  border-color: rgba(3, 140, 5, 0.3);
  background: rgba(255, 255, 255, 0.05);
}

.discord-avatar {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  flex-shrink: 0;
  object-fit: cover;
}

.discord-content {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.discord-meta {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.discord-author {
  font-weight: 700;
  color: #fff;
  font-size: 0.95rem;
}

.discord-time {
  color: var(--text-dim);
  font-size: 0.65rem;
  font-weight: 600;
}

.discord-text {
  color: #e0e0e0;
  font-size: 0.95rem;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}

/* INPUT AREA */
.input-container {
  padding: 24px 30px;
  background: transparent;
  display: flex;
  gap: 15px;
}

.input-wrapper {
  flex: 1;
  background: #1a1a1a;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 5px 18px;
  transition: border-color 0.2s;
}

.input-wrapper:focus-within {
  border-color: var(--accent-purple);
}

#message-input {
  width: 100%;
  background: transparent;
  border: none;
  color: white;
  padding: 12px 0;
  outline: none;
  font-size: 0.95rem;
}

/* MODAL */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.modal-content {
  background: var(--panel-bg);
  width: 400px;
  border-radius: 16px;
  border: 1px solid var(--border);
  padding: 30px;
  box-shadow: 0 20px 40px rgba(0,0,0,0.4);
}

/* New specific additions for Group and Remove buttons */
.btn-remove {
    background: rgba(255, 68, 68, 0.1);
    color: #ff4444;
    border: 1px solid rgba(255, 68, 68, 0.2);
    padding: 4px 8px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.7rem;
    font-weight: 700;
    transition: 0.2s;
}
.btn-remove:hover {
    background: #ff4444;
    color: white;
}
.group-checkbox {
    accent-color: var(--accent-purple);
    width: 18px;
    height: 18px;
    cursor: pointer;
}
.modal-input {
    width: 100%;
    margin-bottom: 15px;
    padding: 12px;
    border-radius: 8px;
    background: #000;
    border: 1px solid var(--border);
    color: white;
    outline: none;
}
.modal-input:focus {
    border-color: var(--accent-purple);
}

.attachment-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  padding: 0 10px;
  cursor: pointer;
  font-size: 1.1rem;
  transition: color 0.2s;
}
.attachment-btn:hover { color: #038c05; }

.chat-media-content {
  margin-top: 8px;
  max-width: 300px;
  border-radius: 8px;
  overflow: hidden;
  display: block;
}

.chat-media-content.image { cursor: zoom-in; border: 1px solid #333; }
.chat-media-content.video { width: 100%; background: #000; }
/* Make audio wider and remove the white background */
.media-audio {
    width: 100%;             /* Fills the available width of the message */
    max-width: 500px;        /* Increases width from your current look */
    height: 40px;
    margin-top: 10px;
    display: block;
    border-radius: 8px;
    background-color: #1a1a1a; /* Matches your chat bubble background */

    /* This filter targets the green buttons while darkening the bar */
    filter: sepia(100%) saturate(300%) hue-rotate(80deg) brightness(0.9);
}

/* Chrome, Edge, and Safari specific fix for the white box */
audio::-webkit-media-controls-panel {
    background-color: #1a1a1a; /* Forces the internal panel to be dark */
}

/* Ensure the time text is visible against the dark background */
audio::-webkit-media-controls-current-time-display,
audio::-webkit-media-controls-time-remaining-display {
    color: #ffffff;
}
.discord-text { word-break: break-word; }

/* --- MOBILE RESPONSIVE STYLING (WhatsApp Style) --- */

@media (max-width: 768px) {
    /* Adjust Main Container for Mobile */
    .main-container {
        position: relative;
        height: calc(100dvh - var(--nav-height));
        width: 100vw;
        overflow: hidden;
        display: block; 
    }

    .sidebar {
        width: 100% !important;
        height: 100%;
        position: absolute;
        top: 0;
        left: 0;
        z-index: 1;
        border-right: none;
    }

    .chat-area {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: var(--bg-dark);
        z-index: 5;
        display: none; 
        flex-direction: column;
    }

    .chat-area.mobile-active {
        display: flex;
    }

    .chat-header {
        padding: 12px 15px;
        display: flex;
        align-items: center;
        gap: 10px;
        flex-shrink: 0;
        background: rgba(20, 20, 20, 0.8);
        backdrop-filter: blur(10px);
    }

    .chat-header::before {
        content: '';
        display: inline-block;
        width: 10px;
        height: 10px;
        border-left: 2.5px solid var(--accent-purple);
        border-bottom: 2.5px solid var(--accent-purple);
        transform: rotate(45deg);
        cursor: pointer;
        margin-right: 12px;
        flex-shrink: 0;
    }

    .discord-msg {
        max-width: 90%;
        padding: 12px;
        gap: 10px;
    }

    .discord-avatar {
        width: 36px;
        height: 36px;
    }

    /* --- UPDATED INPUT CONTAINER --- */
    .input-container {
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        box-sizing: border-box; /* Ensures padding stays inside the 100% width */
        display: flex; /* Uses flex to keep input and button on one line */
        align-items: center;
        padding: 12px 12px calc(45px + env(safe-area-inset-bottom));
        background: var(--panel-bg);
        gap: 10px;
        flex-shrink: 0;
        border-top: 1px solid var(--border);
        z-index: 100;
    }

    .input-wrapper {
        flex: 1; /* This tells the input to take up only the available space */
        min-width: 0; /* Prevents flex items from overflowing */
        border-radius: 25px; 
        padding: 2px 15px;
        background: #000;
        border: 1px solid var(--border);
        display: flex;
        align-items: center;
    }

    #message-input {
        padding: 10px 0;
        font-size: 16px; 
        background: transparent;
        color: white;
        border: none;
        outline: none;
        width: 100%; /* Now stays within the flex-1 wrapper */
    }

    /* Ensure the send button doesn't shrink */
    .send-button {
        flex-shrink: 0;
    }

    .modal-content {
        width: 90%;
        padding: 20px;
        margin: 0 10px;
    }

    .dashboard-nav {
        overflow-x: auto;
        white-space: nowrap;
        gap: 5px;
        padding: 0 10px;
        -webkit-overflow-scrolling: touch;
    }

    .nav-item {
        padding: 5px 10px;
        font-size: 0.65rem;
        flex-shrink: 0;
    }
}