@import url('https://fonts.googleapis.com/css2?family=Special+Elite&family=Playfair+Display:ital,wght@0,600;1,600&family=IBM+Plex+Mono:wght@400;600&display=swap');

:root {
    --crate-wood: #3E2723;
    --cardboard: #D7CCC8;
    --vinyl-black: #212121;
    --record-yellow: #FFD54F;
    --record-red: #E57373;
    --turntable-green: #66BB6A;
    --sleeve-shadow: rgba(0, 0, 0, 0.4);
}

* {
    box-sizing: border-box;
}

body {
    background-color: var(--crate-wood);
    background-image: url('https://www.transparenttextures.com/patterns/dark-wood.png');
    color: #3e2723;
    font-family: 'Playfair Display', serif;
    margin: 0;
    height: 100vh;
    display: flex;
    overflow: hidden;
    box-shadow: inset 0 0 100px rgba(0, 0, 0, 0.6);
}

/* Sidebar: The Record Crate */
.sidebar {
    width: 350px;
    background: #2b1b19;
    border-right: 12px solid #1a100f;
    display: flex;
    flex-direction: column;
    box-shadow: 10px 0 30px rgba(0, 0, 0, 0.5);
    z-index: 10;
}

.sidebar-header {
    padding: 25px;
    background: #1a100f;
    border-bottom: 2px solid var(--record-yellow);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sidebar-header h2 {
    font-family: 'Special Elite', cursive;
    font-size: 1rem;
    margin: 0;
    color: var(--record-yellow);
    text-transform: uppercase;
    letter-spacing: 2px;
}

.convo-list {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: linear-gradient(to bottom, #2b1b19, #1a100f);
}

/* Record Spine Style */
.convo-item {
    background: #4e342e;
    border-left: 10px solid var(--vinyl-black);
    height: 60px;
    padding: 0 15px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.2s;
    position: relative;
    box-shadow: 3px 3px 10px rgba(0, 0, 0, 0.3);
    border-radius: 2px 5px 5px 2px;
}

.convo-item:hover {
    transform: translateX(10px);
    background: #5d4037;
}

.convo-item.active {
    background: var(--cardboard);
    border-left-color: var(--turntable-green);
    z-index: 2;
}

.convo-item.active .convo-name {
    color: #3e2723;
}

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid var(--vinyl-black);
    object-fit: cover;
}

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

.convo-name {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--cardboard);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.record-label-tag {
    font-family: 'Special Elite', cursive;
    font-size: 0.6rem;
    padding: 2px 6px;
    background: var(--record-red);
    color: #fff;
    border-radius: 10px;
    position: absolute;
    top: 5px;
    right: 10px;
}

/* Main Listening Lounge */
.chat-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
}

.chat-header {
    padding: 20px 40px;
    background: rgba(0, 0, 0, 0.3);
    border-bottom: 3px solid var(--turntable-green);
    display: flex;
    align-items: center;
    gap: 20px;
    backdrop-filter: blur(8px);
}

.active-user-name {
    font-family: 'Special Elite', cursive;
    font-size: 1.6rem;
    color: var(--record-yellow);
    text-shadow: 2px 2px 0px rgba(0, 0, 0, 0.5);
}

.header-nav {
    margin-left: auto;
    display: flex;
    gap: 15px;
}

.header-nav a {
    color: var(--cardboard);
    text-decoration: none;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.8rem;
    border: 1px solid var(--cardboard);
    padding: 5px 12px;
    border-radius: 20px;
    transition: all 0.2s;
}

.header-nav a:hover {
    background: var(--cardboard);
    color: var(--crate-wood);
}

.messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 50px;
    display: flex;
    flex-direction: column;
    gap: 30px;
    background-image: radial-gradient(circle, rgba(255, 255, 255, 0.05) 10%, transparent 10%);
    background-size: 30px 30px;
}

/* Album Sleeve Message Style */
.message {
    max-width: 500px;
    background: var(--cardboard);
    background-image: url('https://www.transparenttextures.com/patterns/paper-fibers.png');
    padding: 25px;
    position: relative;
    box-shadow: 15px 15px 40px var(--sleeve-shadow);
    border-radius: 2px;
    display: flex;
    gap: 20px;
}

.message .pfp-container {
    width: 100px;
    height: 100px;
    flex-shrink: 0;
    background: #ccc;
    border: 4px solid #fff;
    box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.message .pfp-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.message-body {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.message.received {
    align-self: flex-start;
    border-left: 12px solid var(--record-yellow);
}

.message.sent {
    align-self: flex-end;
    flex-direction: row-reverse;
    border-right: 12px solid var(--turntable-green);
    font-style: italic;
}

.message-content {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.95rem;
    line-height: 1.6;
}

.message-meta {
    margin-top: auto;
    font-family: 'Special Elite', cursive;
    font-size: 0.7rem;
    opacity: 0.6;
    text-transform: uppercase;
}

.delete-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: none;
    border: none;
    color: var(--record-red);
    cursor: pointer;
    font-size: 1.2rem;
    opacity: 0.3;
    transition: opacity 0.2s;
}

.message:hover .delete-btn {
    opacity: 1;
}

/* Vinyl Record Center Label Decoration */
.message::before {
    content: "";
    position: absolute;
    width: 60px;
    height: 60px;
    background: var(--vinyl-black);
    border-radius: 50%;
    top: -20px;
    z-index: -1;
    box-shadow: inset 0 0 10px rgba(255, 255, 255, 0.1);
}

.message.received::before {
    left: 50px;
}

.message.sent::before {
    right: 50px;
}

/* Turntable Control Input Area */
.input-area {
    padding: 30px;
    background: #1a100f;
    border-top: 5px solid #2b1b19;
    display: flex;
    justify-content: center;
}

.control-panel {
    background: #333;
    padding: 15px;
    width: 100%;
    max-width: 800px;
    border-radius: 10px;
    display: flex;
    gap: 20px;
    align-items: center;
    box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.8);
    border: 2px solid #444;
}

.knob {
    width: 40px;
    height: 40px;
    background: radial-gradient(circle, #666, #222);
    border-radius: 50%;
    border: 2px solid #111;
    position: relative;
}

.knob::after {
    content: "";
    position: absolute;
    width: 2px;
    height: 15px;
    background: var(--turntable-green);
    left: 50%;
    top: 5px;
    transform: translateX(-50%);
}

#msg-input {
    flex: 1;
    background: #000;
    border: 1px solid #555;
    color: var(--turntable-green);
    font-family: 'IBM Plex Mono', monospace;
    padding: 12px 20px;
    font-size: 1rem;
    outline: none;
    border-radius: 4px;
}

#send-btn {
    background: var(--record-red);
    color: #fff;
    border: none;
    padding: 10px 25px;
    font-family: 'Special Elite', cursive;
    font-weight: bold;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s;
    text-transform: uppercase;
}

#send-btn:hover {
    background: #ef5350;
    box-shadow: 0 0 15px rgba(229, 115, 115, 0.4);
}

.no-chat-selected {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    color: var(--cardboard);
    opacity: 0.25;
}

.no-chat-selected h3 {
    font-family: 'Special Elite', cursive;
    letter-spacing: 5px;
}