/* ============================================================
   syschat — main stylesheet
   Palette:
     Yass Queen  #ff1d58
     Sister      #f75990
     Crown Yellow #fff685
     Blue Light  #00ddff
     Brutal Blue #0049b7
   ============================================================ */

/* ── Fonts ───────────────────────────────────────────────── */
@font-face {
    font-family: 'Fragment Mono';
    src: url('../fonts/FragmentMono-Regular.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Fragment Mono';
    src: url('../fonts/FragmentMono-Italic.woff2') format('woff2');
    font-weight: 400;
    font-style: italic;
    font-display: swap;
}

/* ── Reset & Base ────────────────────────────────────────── */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Fragment Mono', 'Courier New', monospace;
    background-color: #e5e5e5;
    color: #1e293b;
    height: 100vh;
    height: 100dvh;
    width: 100vw;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

button {
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
}

i {
    font-style: normal;
    line-height: 1;
}

textarea, input {
    font-family: inherit;
}

/* ── Scrollbars ──────────────────────────────────────────── */
::-webkit-scrollbar       { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.35); }

.hide-scrollbar { scrollbar-width: none; -ms-overflow-style: none; }
.hide-scrollbar::-webkit-scrollbar { display: none; }

/* ── App Container ───────────────────────────────────────── */
.app-container {
    width: 100%;
    height: 100%;
    display: flex;
    position: relative;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0,73,183,0.3);
}

@media (min-width: 768px) {
    .app-container {
        height: 90vh;
        width: 90vw;
        max-width: 1400px;
        border-radius: 1.5rem;
    }
}

/* ── Sidebar — Brutal Blue ───────────────────────────────── */
.sidebar {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    background: #0049b7;
    position: absolute;
    z-index: 20;
    transition: transform 0.3s cubic-bezier(0.4,0,0.2,1);
}

.sidebar.sidebar-hidden {
    transform: translateX(-100%);
}

@media (min-width: 768px) {
    .sidebar {
        width: 20rem;
        position: relative;
        transform: none !important;
        border-right: 1px solid rgba(0,0,0,0.15);
    }
}

.sidebar-header {
    padding: 1.25rem;
    border-bottom: 1px solid rgba(255,255,255,0.12);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.app-title {
    font-size: 1.25rem;
    color: #fff685;
}

/* ── Search ──────────────────────────────────────────────── */
.search-wrap {
    padding: 1rem;
}

.search-box {
    background: rgba(0,0,0,0.2);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 0.75rem;
    display: flex;
    align-items: center;
    padding: 0.625rem 1rem;
    gap: 0.75rem;
    transition: border-color 0.2s;
}

.search-box:focus-within {
    border-color: #f75990;
    box-shadow: 0 0 0 3px rgba(247,89,144,0.2);
}

.search-box i {
    color: rgba(255,255,255,0.5);
    flex-shrink: 0;
}

.search-input {
    background: transparent;
    border: none;
    outline: none;
    font-size: 0.875rem;
    width: 100%;
    color: #fff;
}

.search-input::placeholder {
    color: rgba(255,255,255,0.4);
}

/* ── Chat List ───────────────────────────────────────────── */
#chat-list {
    flex: 1;
    overflow-y: auto;
    padding: 0 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.chat-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    border-radius: 0.75rem;
    cursor: pointer;
    transition: background 0.15s;
    border: 1px solid transparent;
}

.chat-item:hover {
    background: rgba(255,255,255,0.1);
}

.chat-item.active {
    background: rgba(255,246,133,0.15);
    border-color: rgba(255,246,133,0.35);
}

.chat-item:hover .chat-avatar {
    transform: scale(1.05);
}

.chat-item-avatar {
    position: relative;
    flex-shrink: 0;
}

.chat-avatar {
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(255,255,255,0.2);
    transition: transform 0.15s;
}

.avatar {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(255,255,255,0.2);
}

.chat-status-dot {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 0.75rem;
    height: 0.75rem;
    background: #00ddff;
    border: 2px solid #0049b7;
    border-radius: 50%;
}

.chat-item-info {
    flex: 1;
    min-width: 0;
}

.chat-item-top {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 2px;
}

.chat-item-name {
    font-size: 0.875rem;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-item.active .chat-item-name {
    color: #fff685;
}

.chat-item-time {
    font-size: 0.625rem;
    color: rgba(255,255,255,0.45);
    flex-shrink: 0;
    margin-left: 0.5rem;
}

.chat-item-last {
    font-size: 0.75rem;
    color: rgba(255,255,255,0.55);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: color 0.15s;
}

.chat-item:hover .chat-item-last {
    color: rgba(255,255,255,0.8);
}

/* ── User Profile Footer ─────────────────────────────────── */
.user-profile {
    padding: 1rem;
    border-top: 1px solid rgba(255,255,255,0.12);
    background: rgba(0,0,0,0.15);
}

.user-profile-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.user-profile .avatar {
    border: 2px solid rgba(255,246,133,0.5);
}

.user-info {
    flex: 1;
    min-width: 0;
}

.user-name {
    font-size: 0.875rem;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.status-online {
    font-size: 0.75rem;
    color: #00ddff;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #00ddff;
    flex-shrink: 0;
}

/* ── Sidebar buttons ─────────────────────────────────────── */
.btn-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 0.5rem;
    color: rgba(255,255,255,0.6);
    transition: color 0.2s;
}

.btn-close:hover {
    color: #fff685;
}

@media (min-width: 768px) {
    .btn-close { display: none; }
}

/* ── Main Chat Area ──────────────────────────────────────── */
.chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #fff;
    min-width: 0;
}

/* ── Chat Header ─────────────────────────────────────────── */
.chat-header {
    height: 4rem;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1rem;
    background: #fff;
    z-index: 10;
    flex-shrink: 0;
}

@media (min-width: 768px) {
    .chat-header { padding: 0 1.5rem; }
}

.chat-header-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.btn-menu {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 0.5rem;
    color: #64748b;
    transition: color 0.2s;
}

.btn-menu:hover {
    color: #0049b7;
}

@media (min-width: 768px) {
    .btn-menu { display: none; }
}

.avatar-wrap {
    position: relative;
}

.status-badge {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 0.75rem;
    height: 0.75rem;
    border-radius: 50%;
    border: 2px solid #fff;
    background: #00ddff;
}

#header-name {
    font-size: 0.875rem;
    color: #1e293b;
}

@media (min-width: 768px) {
    #header-name { font-size: 1rem; }
}

#header-status-text {
    font-size: 0.75rem;
    color: #94a3b8;
}

#header-status-text.online { color: #00ddff; }

.chat-header-actions {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.btn-icon {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #94a3b8;
    transition: color 0.2s, background 0.2s;
    flex-shrink: 0;
}

.btn-icon:hover {
    color: #ff1d58;
    background: rgba(255,29,88,0.07);
}

/* ── Messages Container ──────────────────────────────────── */
#messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    scroll-behavior: smooth;
    background: #fff;
}

@media (min-width: 768px) {
    #messages-container { padding: 1.5rem; }
}

/* ── Empty State ─────────────────────────────────────────── */
.empty-state {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    opacity: 0.5;
}

.empty-icon {
    width: 5rem;
    height: 5rem;
    border-radius: 50%;
    background: rgba(0,73,183,0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
    animation: pulse 2s cubic-bezier(0.4,0,0.6,1) infinite;
}

.empty-icon i {
    font-size: 1.875rem;
    color: #0049b7;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.5; }
}

.empty-title {
    font-size: 1.125rem;
    color: #64748b;
}

.empty-sub {
    font-size: 0.875rem;
    color: #94a3b8;
    margin-top: 0.25rem;
}

/* ── Messages ────────────────────────────────────────────── */
@keyframes message-pop {
    0%   { opacity: 0; transform: translateY(10px) scale(0.95); }
    100% { opacity: 1; transform: translateY(0)    scale(1); }
}

.message-anim {
    animation: message-pop 0.3s cubic-bezier(0.34,1.56,0.64,1) forwards;
}

.message-row {
    display: flex;
    width: 100%;
}

.message-row.me    { justify-content: flex-end; }
.message-row.them  { justify-content: flex-start; }

.message-wrap {
    max-width: 85%;
    display: flex;
    flex-direction: column;
}

.message-row.me   .message-wrap { align-items: flex-end; }
.message-row.them .message-wrap { align-items: flex-start; }

@media (min-width: 768px) {
    .message-wrap { max-width: 70%; }
}

.bubble {
    padding: 0.75rem 1.25rem;
    border-radius: 1rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.bubble p {
    font-size: 0.875rem;
    line-height: 1.6;
}

.bubble-me {
    background: #ff1d58;
    color: #fff;
    border-top-right-radius: 0.25rem;
}

.bubble-them {
    background: #f1f5f9;
    color: #334155;
    border-top-left-radius: 0.25rem;
}

.message-time {
    font-size: 0.625rem;
    color: #94a3b8;
    margin-top: 0.25rem;
    padding: 0 0.25rem;
}

/* ── Typing Indicator ────────────────────────────────────── */
.typing-indicator {
    padding: 0.5rem 1.5rem;
}

.typing-indicator.hidden {
    display: none;
}

.typing-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.75rem;
    color: #94a3b8;
    margin-bottom: 0.5rem;
}

.typing-bubble {
    background: #f1f5f9;
    border-radius: 1rem;
    border-top-left-radius: 0.25rem;
    padding: 0.75rem 1rem;
    display: inline-flex;
    gap: 0.25rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.typing-dot {
    width: 0.5rem;
    height: 0.5rem;
    background: #94a3b8;
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out both;
}

.typing-dot:nth-child(1) { animation-delay: -0.32s; }
.typing-dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes typing {
    0%, 80%, 100% { transform: scale(0); }
    40%            { transform: scale(1); }
}

/* ── Input Area ──────────────────────────────────────────── */
.input-area {
    padding: 1rem;
    background: #fff;
    border-top: 1px solid #e2e8f0;
    flex-shrink: 0;
}

@media (min-width: 768px) {
    .input-area { padding: 1.5rem; }
}

.input-wrapper {
    border-radius: 1rem;
    display: flex;
    align-items: flex-end;
    gap: 0.5rem;
    padding: 0.5rem;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.input-wrapper:focus-within {
    border-color: rgba(255,29,88,0.4);
    box-shadow: 0 0 0 3px rgba(255,29,88,0.08);
}

#message-input {
    background: transparent;
    border: none;
    outline: none;
    color: #1e293b;
    width: 100%;
    resize: none;
    padding: 0.625rem 0.5rem;
    max-height: 8rem;
    font-size: 0.9rem;
    line-height: 1.5;
}

#message-input::placeholder {
    color: #94a3b8;
}

.input-actions {
    display: flex;
    gap: 0.25rem;
    flex-shrink: 0;
}

.btn-attach:hover { color: #0049b7; }
.btn-emoji:hover  { color: #ff1d58; }

.btn-send {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 0.75rem;
    background: #ff1d58;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    box-shadow: 0 2px 8px rgba(255,29,88,0.4);
    transition: background 0.2s, transform 0.15s;
    flex-shrink: 0;
}

.btn-send:hover  { background: #f75990; transform: scale(1.05); }
.btn-send:active { transform: scale(0.95); }

.encrypt-note {
    text-align: center;
    font-size: 0.625rem;
    color: #94a3b8;
    margin-top: 0.5rem;
}
