:root {
    --bg-color: #0d1117;
    --card-bg: rgba(22, 27, 34, 0.7);
    --border-color: rgba(240, 246, 252, 0.1);
    --text-primary: #e6edf3;
    --text-secondary: #8b949e;
    --accent-color: #1f6feb;
    --accent-hover: #388bfd;
    --success-color: #238636;
    --danger-color: #da3637;
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

body {
    margin: 0;
    padding: 0;
    font-family: var(--font-family);
    background-color: var(--bg-color);
    color: var(--text-primary);
    overflow-x: hidden;
}

/* Glassmorphic Effects */
.glass-card {
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

/* Auth Container */
.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
}

.auth-form {
    width: 320px;
}

.auth-form h2 {
    text-align: center;
    margin-bottom: 24px;
    color: var(--accent-hover);
}

.form-group {
    margin-bottom: 15px;
}

label {
    display: block;
    font-size: 14px;
    margin-bottom: 5px;
    color: var(--text-secondary);
}

input {
    width: 100%;
    padding: 10px;
    background: #161b22;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    box-sizing: border-box;
}

input:focus {
    outline: none;
    border-color: var(--accent-hover);
}

button {
    width: 100%;
    padding: 10px;
    background-color: var(--accent-color);
    border: none;
    border-radius: 6px;
    color: white;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.2s;
}

button:hover {
    background-color: var(--accent-hover);
}

/* Navigation & Header */
nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 30px;
    border-bottom: 1px solid var(--border-color);
    background: rgba(13, 17, 23, 0.8);
    position: sticky;
    top: 0;
    z-index: 100;
}

.logo {
    font-size: 20px;
    font-weight: bold;
    color: var(--accent-hover);
}

/* Grid Layout for Dashboard */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    padding: 20px;
}

.stat-value {
    font-size: 32px;
    font-weight: bold;
    margin-top: 10px;
}

.stat-label {
    color: var(--text-secondary);
    font-size: 14px;
    text-transform: uppercase;
}

/* Table styling */
table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

th {
    color: var(--text-secondary);
    font-size: 12px;
    text-transform: uppercase;
}

/* --- Support Messaging System CSS --- */
.nav-badge-container {
    position: relative;
    display: inline-block;
    margin-right: 15px;
}
.nav-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background-color: var(--danger-color);
    color: white;
    border-radius: 50%;
    padding: 2px 6px;
    font-size: 10px;
    font-weight: bold;
    line-height: 1;
    min-width: 10px;
    text-align: center;
}

#chat-drawer {
    position: fixed;
    top: 0;
    right: 0;
    width: 450px;
    height: 100vh;
    background: rgba(13, 17, 23, 0.95);
    backdrop-filter: blur(20px);
    border-left: 1px solid var(--border-color);
    box-shadow: -5px 0 25px rgba(0, 0, 0, 0.5);
    z-index: 1000;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
}

#chat-drawer.open {
    transform: translateX(0);
}

#chat-drawer.admin-mode {
    width: 750px;
}

.chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
}

.chat-header h3 {
    margin: 0;
    font-size: 18px;
    color: var(--text-primary);
}

.close-chat-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 20px;
    cursor: pointer;
    width: auto;
    padding: 0;
}

.close-chat-btn:hover {
    color: var(--text-primary);
}

.chat-body-container {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* Admin side list */
.conversation-list {
    width: 250px;
    border-right: 1px solid var(--border-color);
    overflow-y: auto;
    background: rgba(22, 27, 34, 0.5);
}

.conversation-item {
    padding: 15px;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: background 0.2s;
}

.conversation-item:hover, .conversation-item.active {
    background: rgba(31, 111, 235, 0.15);
}

.conversation-item-header {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    font-weight: bold;
    color: var(--text-primary);
}

.conversation-item-snippet {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.conversation-unread-badge {
    background: var(--danger-color);
    color: white;
    border-radius: 10px;
    font-size: 9px;
    padding: 1px 5px;
}

/* Chat window area */
.chat-window {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.message-item-wrapper {
    display: flex;
    flex-direction: column;
    margin-bottom: 15px;
    position: relative;
    max-width: 80%;
}

.message-item-wrapper.sent {
    align-self: flex-end;
}

.message-item-wrapper.received {
    align-self: flex-start;
}

.message-bubble {
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 13px;
    line-height: 1.4;
    word-wrap: break-word;
    position: relative;
}

.sent .message-bubble {
    background: var(--accent-color);
    color: #fff;
    border-bottom-right-radius: 2px;
}

.received .message-bubble {
    background: #161b22;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    border-bottom-left-radius: 2px;
}

/* Highlight unread received messages */
.received.unread .message-bubble {
    border-color: var(--accent-hover);
    box-shadow: 0 0 8px rgba(56, 139, 253, 0.2);
}

.message-actions {
    display: flex;
    gap: 8px;
    margin-top: 4px;
    font-size: 10px;
    color: var(--text-secondary);
    opacity: 0;
    transition: opacity 0.2s;
    justify-content: flex-end;
}

.message-item-wrapper:hover .message-actions {
    opacity: 1;
}

.message-action-btn {
    cursor: pointer;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 10px;
    padding: 0;
    width: auto;
}

.message-action-btn:hover {
    color: var(--text-primary);
    text-decoration: underline;
}

.message-action-btn.delete-btn:hover {
    color: var(--danger-color);
}

.message-time {
    font-size: 10px;
    color: var(--text-secondary);
    margin-top: 2px;
    align-self: flex-end;
}

.received .message-time {
    align-self: flex-start;
}

/* Chat Input Footer */
.chat-footer {
    padding: 15px;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 10px;
    align-items: center;
}

.chat-input {
    flex: 1;
    background: #0d1117;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 10px 15px;
    color: var(--text-primary);
    font-size: 13px;
    resize: none;
    outline: none;
}

.chat-input:focus {
    border-color: var(--accent-hover);
}

.send-msg-btn {
    background: var(--accent-color);
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
}

.send-msg-btn:hover {
    background: var(--accent-hover);
}

