:root {
    --primary: #00a884;
    --primary-dark: #005c4b;
    --bg-color: #0b141a; /* Dark sleek background */
    --glass-bg: rgba(32, 44, 51, 0.75);
    --glass-border: rgba(255, 255, 255, 0.08);
    --text-main: #e9edef;
    --text-subtle: #8696a0;
    --online-green: #00a884;
    --offline-grey: rgba(134, 150, 160, 0.5);
    
    --msg-mine: #005c4b;
    --msg-theirs: #202c33;
    --danger: #ef5350;
    --badge-red: #f23d4f;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    -webkit-tap-highlight-color: transparent;
}

body, html {
    height: 100%;
    width: 100%;
    background: var(--bg-color);
    background-image: radial-gradient(circle at center, #111b21 0%, #0b141a 100%);
    color: var(--text-main);
    overflow: hidden;
}

.screen {
    display: none;
    height: 100%;
    width: 100%;
    flex-direction: column;
}

.screen.active {
    display: flex;
}

/* Glassmorphism Classes */
.glass-panel, .glass-header {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.4);
}

/* Auth */
#auth-screen {
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.auth-panel {
    padding: 30px;
    border-radius: 24px;
    text-align: center;
    width: 100%;
    max-width: 400px;
}

.auth-panel h1 { color: var(--primary); margin-bottom: 10px; font-size: 2rem; }
.auth-panel input {
    width: 100%;
    padding: 15px;
    margin: 12px 0;
    border-radius: 12px;
    border: 1px solid var(--glass-border);
    outline: none;
    background: rgba(11, 20, 26, 0.8);
    color: var(--text-main);
    transition: box-shadow 0.2s;
}
.auth-panel input:focus { box-shadow: 0 0 0 2px var(--primary); }

/* Universal Button Press Feeling */
button, .action-btn, .press-effect, .tab-btn {
    transition: transform 0.1s cubic-bezier(0.4, 0, 0.2, 1), background-color 0.2s;
    cursor: pointer;
}
button:active, .action-btn:active, .press-effect:active {
    transform: scale(0.92) !important;
}

.auth-panel button {
    background: var(--primary);
    color: #111;
    border: none;
    padding: 14px 20px;
    width: 100%;
    border-radius: 12px;
    font-weight: 700;
    font-size: 1rem;
    margin-top: 10px;
}
.error { color: var(--danger); font-size: 0.9em; margin-top: 10px; }

/* Dashboard Header & Tabs */
.main-header {
    padding: 20px 20px 0 20px;
    border-bottom-left-radius: 20px;
    border-bottom-right-radius: 20px;
    z-index: 10;
}
.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}
.header-top h2 { color: var(--text-main); font-size: 1.8rem; margin: 0; }
.tabs { display: flex; gap: 10px; }
.tab-btn {
    flex: 1;
    padding: 12px;
    background: transparent;
    border: none;
    font-weight: bold;
    color: var(--text-subtle);
    border-bottom: 3px solid transparent;
}
.tab-btn.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

/* Content & Lists */
.content {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
}
.tab-content { display: none; }
.tab-content.active { display: block; }

.user-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    margin-bottom: 12px;
    background: rgba(32, 44, 51, 0.4);
    border-radius: 16px;
    border: 1px solid var(--glass-border);
}

.user-info { display: flex; align-items: center; gap: 12px; position: relative; }
.status-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--offline-grey);
    border: 2px solid var(--bg-color);
}
.status-dot.online { background: var(--online-green); box-shadow: 0 0 8px var(--online-green); }
.user-details h4 { margin: 0; color: var(--text-main); font-size: 1.1rem; }

/* Unread Badge */
.unread-badge {
    background: var(--badge-red);
    color: white;
    font-size: 0.75rem;
    font-weight: bold;
    padding: 2px 7px;
    border-radius: 12px;
    margin-left: 8px;
    display: inline-block;
    box-shadow: 0 2px 5px rgba(242, 61, 79, 0.4);
}

.action-btn { 
    padding: 8px 14px; 
    font-size: 0.85em; 
    border-radius: 10px; 
    border: none; 
    color: white; 
    font-weight: bold;
}
.btn-req { background: #f57c00; color: #fff;}
.btn-acc { background: var(--primary); color: #111; }
.btn-dec { background: var(--danger); color: #fff; }
.btn-chat { background: var(--primary-dark); color: #fff;}

/* Chat Screen */
.chat-header {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px 20px;
    border-bottom: 1px solid var(--glass-border);
}
#back-btn {
    background: transparent;
    border: none;
    font-size: 1.5em;
    color: var(--primary);
    padding: 5px;
}
#chat-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: hidden;
    position: relative;
}
#messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    scroll-behavior: smooth;
}

/* Message Animations */
@keyframes messageSlideIn {
    0% { opacity: 0; transform: translateY(15px) scale(0.95); }
    100% { opacity: 1; transform: translateY(0) scale(1); }
}

.message {
    max-width: 78%;
    padding: 10px 14px;
    border-radius: 18px;
    position: relative;
    word-wrap: break-word;
    color: var(--text-main);
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    animation: messageSlideIn 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}
.msg-mine { background: var(--msg-mine); align-self: flex-end; border-bottom-right-radius: 4px; }
.msg-theirs { background: var(--msg-theirs); align-self: flex-start; border-bottom-left-radius: 4px; }
.msg-time { font-size: 0.65em; color: rgba(255,255,255,0.6); float: right; margin-top: 6px; margin-left: 12px; }

/* Typing Indicator */
#typing-indicator {
    padding: 5px 15px 15px 15px;
    transition: opacity 0.3s;
}
#typing-indicator.hidden { display: none; }
.typing-bubble { padding: 12px 16px; border-radius: 18px; display: inline-block; margin: 0; }
.typing-wave { display: flex; align-items: center; gap: 4px; }
.typing-wave span {
    width: 6px; height: 6px;
    background-color: var(--text-subtle);
    border-radius: 50%;
    animation: wave 1.2s infinite ease-in-out;
}
.typing-wave span:nth-child(1) { animation-delay: 0s; }
.typing-wave span:nth-child(2) { animation-delay: 0.2s; }
.typing-wave span:nth-child(3) { animation-delay: 0.4s; }

@keyframes wave {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-6px); background-color: var(--text-main); }
}

/* Chat Input */
.chat-input-area {
    padding: 12px;
    display: flex;
    gap: 10px;
    border-top: 1px solid var(--glass-border);
    background: var(--bg-color);
}
#message-input {
    flex: 1;
    padding: 14px 20px;
    border-radius: 24px;
    border: none;
    outline: none;
    background: var(--msg-theirs);
    color: var(--text-main);
    font-size: 1rem;
}
#message-input::placeholder { color: var(--text-subtle); }
#send-btn {
    background: var(--primary);
    color: #111;
    border: none;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    font-size: 1.2em;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Footer Trigger & Banner */
#footer-trigger {
    position: fixed;
    bottom: 25px;
    left: 20px;
    width: 48px;
    height: 48px;
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    transition: transform 0.2s, bottom 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* Make it Squircle (Not so very circular) */
.squircle {
    border-radius: 16px;
    border: 1px solid var(--glass-border);
}

/* Move footer up when inside chat so it doesn't overlap input */
body.in-chat #footer-trigger {
    bottom: 85px; 
}
body.in-chat #copyright-banner {
    bottom: 90px;
}

#footer-trigger img { width: 24px; height: 24px; border-radius: 4px; }

#copyright-banner {
    position: fixed;
    bottom: 30px;
    left: 80px;
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    padding: 12px 20px;
    border-radius: 16px;
    border: 1px solid var(--glass-border);
    box-shadow: 0 4px 15px rgba(0,0,0,0.5);
    font-size: 0.85em;
    color: var(--text-main);
    z-index: 999;
    transition: all 0.3s ease-in-out;
    opacity: 1;
    transform: translateX(0);
}
#copyright-banner.hidden {
    opacity: 0;
    transform: translateX(-15px) scale(0.95);
    pointer-events: none;
}