/* Woodman Messages — Styles */

:root {
    /* Dark theme colors */
    --bg-primary: #1a1d21;
    --bg-secondary: #222529;
    --bg-sidebar: #19171d;
    --bg-hover: #2c2f33;
    --bg-active: #36393f;
    --bg-input: #2c2f33;
    --bg-modal: #2c2f33;

    --text-primary: #e1e1e3;
    --text-secondary: #9a9b9e;
    --text-muted: #6b6c6f;
    --text-link: #7cabf0;

    --accent: #5b8def;
    --accent-hover: #4a7de0;
    --accent-text: #ffffff;

    --success: #4caf50;
    --warning: #ff9800;
    --danger: #f44336;

    --border: #3a3d41;
    --border-light: #2e3136;

    --shadow: 0 2px 8px rgba(0, 0, 0, 0.3);

    /* Sizing */
    --sidebar-width: 260px;
    --thread-panel-width: 380px;
    --header-height: 52px;
    --compose-min-height: 44px;
    --avatar-size: 36px;
    --avatar-small: 28px;

    /* Typography */
    --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    --font-mono: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
    --font-size: 14px;
    --font-size-sm: 12px;
    --font-size-lg: 16px;
    --line-height: 1.5;

    --radius: 6px;
    --radius-sm: 4px;
    --radius-lg: 8px;
}

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

body {
    font-family: var(--font-family);
    font-size: var(--font-size);
    line-height: var(--line-height);
    color: var(--text-primary);
    background: var(--bg-primary);
    overflow: hidden;
    height: 100vh;
}

a { color: var(--text-link); text-decoration: none; }
a:hover { text-decoration: underline; }

.hidden { display: none !important; }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 16px;
    border: none;
    border-radius: var(--radius);
    font-size: var(--font-size);
    font-family: inherit;
    cursor: pointer;
    transition: background 0.15s, opacity 0.15s;
}

.btn-primary {
    background: var(--accent);
    color: var(--accent-text);
}
.btn-primary:hover { background: var(--accent-hover); }

.btn-secondary {
    background: var(--bg-hover);
    color: var(--text-primary);
}
.btn-secondary:hover { background: var(--bg-active); }

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-text {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: var(--font-size-sm);
    padding: 4px 8px;
}
.btn-text:hover { color: var(--text-primary); }

.btn-full { width: 100%; }

.btn-icon {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 6px;
    border-radius: var(--radius-sm);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.btn-icon:hover { background: var(--bg-hover); color: var(--text-primary); }

.btn-icon-sm {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 2px 6px;
    font-size: 16px;
    line-height: 1;
    border-radius: var(--radius-sm);
}
.btn-icon-sm:hover { background: var(--bg-hover); color: var(--text-primary); }

/* Forms */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 4px;
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    font-weight: 600;
}

input[type="text"],
input[type="password"],
input[type="email"],
select,
textarea {
    width: 100%;
    padding: 8px 12px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: var(--font-size);
    font-family: inherit;
    outline: none;
    transition: border-color 0.15s;
}

input:focus, textarea:focus, select:focus {
    border-color: var(--accent);
}

/* Error message */
.error-msg {
    margin-top: 12px;
    padding: 8px 12px;
    background: rgba(244, 67, 54, 0.15);
    border: 1px solid var(--danger);
    border-radius: var(--radius);
    color: var(--danger);
    font-size: var(--font-size-sm);
}

/* Login screen */
.login-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100vh;
    background: var(--bg-primary);
}

.login-card {
    width: 360px;
    padding: 40px;
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}

.login-title {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 24px;
    text-align: center;
    color: var(--text-primary);
}

/* App layout */
.app-layout {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    background: var(--bg-sidebar);
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border-light);
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-light);
}

.sidebar-title {
    font-size: var(--font-size-lg);
    font-weight: 700;
}

.sidebar-search {
    padding: 8px 12px;
}

.sidebar-search input {
    padding: 6px 10px;
    font-size: var(--font-size-sm);
    background: var(--bg-hover);
    border-color: transparent;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 4px 0;
}

.nav-section {
    margin-bottom: 8px;
}

.nav-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 16px;
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.nav-list {
    list-style: none;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 4px 16px;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: var(--font-size);
    gap: 8px;
    border-radius: 0;
    transition: background 0.1s;
}

.nav-item:hover {
    background: var(--bg-hover);
}

.nav-item.active {
    background: var(--bg-active);
    color: var(--text-primary);
}

.nav-item-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.nav-item-prefix {
    color: var(--text-muted);
    font-weight: 500;
}

.unread-badge {
    background: var(--accent);
    color: white;
    font-size: 11px;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
}

.sidebar-footer {
    padding: 8px 12px;
    border-top: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: var(--font-size-sm);
}

/* Avatar */
.avatar {
    width: var(--avatar-size);
    height: var(--avatar-size);
    border-radius: 50%;
    background: var(--accent);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
    flex-shrink: 0;
}

.avatar-small {
    width: var(--avatar-small);
    height: var(--avatar-small);
    border-radius: 50%;
    background: var(--accent);
    color: white;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 11px;
    flex-shrink: 0;
}

/* Main content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: var(--bg-primary);
}

/* Channel header */
.channel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    height: var(--header-height);
    min-height: var(--header-height);
    border-bottom: 1px solid var(--border);
    background: var(--bg-secondary);
}

.channel-header-info {
    display: flex;
    align-items: baseline;
    gap: 12px;
    min-width: 0;
}

.channel-name {
    font-size: var(--font-size-lg);
    font-weight: 700;
    white-space: nowrap;
}

.channel-desc {
    font-size: var(--font-size-sm);
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.channel-header-actions {
    display: flex;
    gap: 4px;
}

/* Messages */
.message-list {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
}

.messages-container {
    flex: 1;
    padding: 16px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    min-height: 100%;
}

.message {
    display: flex;
    gap: 10px;
    padding: 4px 0;
    position: relative;
}

.message:hover {
    background: var(--bg-hover);
    margin: 0 -16px;
    padding: 4px 16px;
}

.message-body {
    flex: 1;
    min-width: 0;
}

.message-header {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 2px;
}

.message-author {
    font-weight: 600;
    font-size: var(--font-size);
    color: var(--text-primary);
}

.message-time {
    font-size: var(--font-size-sm);
    color: var(--text-muted);
}

.message-edited {
    font-size: 11px;
    color: var(--text-muted);
    font-style: italic;
}

.message-source {
    font-size: 11px;
    color: var(--text-muted);
    background: var(--bg-hover);
    padding: 1px 5px;
    border-radius: var(--radius-sm);
}

.message-content {
    color: var(--text-primary);
    word-wrap: break-word;
    overflow-wrap: break-word;
    white-space: pre-wrap;
}

.message-content.ai-content {
    border-left: 3px solid var(--accent);
    padding-left: 10px;
    color: var(--text-secondary);
}

.message-deleted {
    color: var(--text-muted);
    font-style: italic;
}

/* Message actions (hover) */
.message-actions {
    display: none;
    position: absolute;
    top: -12px;
    right: 8px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2px;
    gap: 2px;
    box-shadow: var(--shadow);
}

.message:hover .message-actions {
    display: flex;
}

/* Thread reply indicator */
.message-thread-info {
    margin-top: 4px;
    font-size: var(--font-size-sm);
    color: var(--text-link);
    cursor: pointer;
}
.message-thread-info:hover { text-decoration: underline; }

/* Reactions */
.message-reactions {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 4px;
}

.reaction-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    background: var(--bg-hover);
    border: 1px solid var(--border);
    border-radius: 12px;
    font-size: var(--font-size-sm);
    cursor: pointer;
}
.reaction-badge:hover { background: var(--bg-active); }
.reaction-badge.reacted { border-color: var(--accent); background: rgba(91, 141, 239, 0.1); }

/* File attachments */
.message-files {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 6px;
}

.file-attachment {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--bg-hover);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    max-width: 300px;
    cursor: pointer;
    font-size: var(--font-size-sm);
}
.file-attachment:hover { background: var(--bg-active); }

.file-attachment-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text-link);
}

.file-attachment-size {
    color: var(--text-muted);
    white-space: nowrap;
}

.file-image-preview {
    max-width: 400px;
    max-height: 300px;
    border-radius: var(--radius);
    margin-top: 6px;
    cursor: pointer;
}

/* Typing indicator */
.typing-indicator {
    padding: 4px 16px;
    font-size: var(--font-size-sm);
    color: var(--text-muted);
    min-height: 24px;
}

/* Compose bar */
.compose-bar {
    padding: 8px 16px 12px;
    background: var(--bg-primary);
    border-top: 1px solid var(--border);
}

.compose-wrapper {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 4px 4px 4px 8px;
}

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

.message-input {
    flex: 1;
    border: none;
    background: transparent;
    padding: 6px 4px;
    resize: none;
    max-height: 150px;
    min-height: 20px;
    line-height: 1.4;
}

.message-input:focus {
    border: none;
    outline: none;
}

.btn-send {
    padding: 6px 10px;
    border-radius: var(--radius);
    flex-shrink: 0;
}

/* Thread panel */
.thread-panel {
    width: var(--thread-panel-width);
    min-width: var(--thread-panel-width);
    background: var(--bg-secondary);
    border-left: 1px solid var(--border);
    display: flex;
    flex-direction: column;
}

.thread-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    font-weight: 600;
}

.thread-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

.compose-bar-thread {
    border-top: 1px solid var(--border);
    background: var(--bg-secondary);
}

/* Presence dot */
.presence-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}
.presence-dot.online { background: var(--success); }
.presence-dot.away { background: var(--warning); }
.presence-dot.dnd { background: var(--danger); }
.presence-dot.offline { background: var(--text-muted); }

/* Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: var(--bg-modal);
    border-radius: var(--radius-lg);
    padding: 24px;
    min-width: 360px;
    max-width: 500px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: var(--shadow);
}

.modal-title {
    font-size: var(--font-size-lg);
    font-weight: 700;
    margin-bottom: 16px;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 20px;
}

/* Date separator */
.date-separator {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 0;
    color: var(--text-muted);
    font-size: var(--font-size-sm);
    font-weight: 600;
}

.date-separator::before,
.date-separator::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* Drag and drop overlay */
.drop-overlay {
    position: fixed;
    inset: 0;
    background: rgba(91, 141, 239, 0.1);
    border: 3px dashed var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 600;
    color: var(--accent);
    z-index: 999;
    pointer-events: none;
}

/* Empty state */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    color: var(--text-muted);
    gap: 8px;
    padding: 40px;
    text-align: center;
}

.empty-state-icon {
    font-size: 48px;
    opacity: 0.3;
}

/* Search results */
.search-result {
    padding: 8px 12px;
    border-bottom: 1px solid var(--border-light);
    cursor: pointer;
}
.search-result:hover { background: var(--bg-hover); }

.search-result-channel {
    font-size: var(--font-size-sm);
    color: var(--text-muted);
}

.search-result-content {
    margin-top: 4px;
}

.search-result-highlight {
    background: rgba(91, 141, 239, 0.3);
    padding: 0 2px;
    border-radius: 2px;
}
