/* ============================================
   drop - terminal-style dark theme
   ============================================ */

:root {
    --bg: #0d1117;
    --bg-sidebar: #161b22;
    --bg-input: #1c2128;
    --bg-hover: #1f2937;
    --bg-modal: #1c2128;
    --text: #c9d1d9;
    --text-dim: #8b949e;
    --text-bright: #f0f6fc;
    --green: #3fb950;
    --green-dim: #238636;
    --blue: #58a6ff;
    --orange: #d29922;
    --red: #f85149;
    --purple: #bc8cff;
    --border: #30363d;
    --font: 'JetBrains Mono', 'Cascadia Code', 'Fira Code', 'SF Mono', 'Consolas', monospace;
    --radius: 4px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: 13px;
    line-height: 1.5;
    overflow: hidden;
}

#app {
    height: 100%;
    width: 100%;
}

.view {
    height: 100%;
    width: 100%;
}

.hidden {
    display: none !important;
}

/* ============================================
   Scrollbar
   ============================================ */

::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg);
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-dim);
}

/* ============================================
   Login View
   ============================================ */

#login-view {
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 2rem;
}

.ascii-logo {
    color: var(--green);
    text-align: center;
    margin-bottom: 2rem;
    font-size: 14px;
    line-height: 1.2;
    user-select: none;
}

.ascii-logo-small {
    color: var(--green);
    font-size: 16px;
    font-weight: bold;
    letter-spacing: 2px;
}

.input-group {
    margin-bottom: 1rem;
}

.input-group label {
    display: block;
    color: var(--green);
    margin-bottom: 0.25rem;
    font-size: 12px;
}

input[type="text"],
input[type="password"],
input[type="email"],
textarea {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border);
    color: var(--text-bright);
    font-family: var(--font);
    font-size: 13px;
    padding: 0.5rem;
    border-radius: var(--radius);
    outline: none;
    transition: border-color 0.2s;
}

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

textarea {
    resize: vertical;
}

.btn-primary {
    background: var(--green-dim);
    color: var(--text-bright);
    border: 1px solid var(--green);
    font-family: var(--font);
    font-size: 13px;
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    cursor: pointer;
    transition: background 0.2s;
    width: 100%;
}

.btn-primary:hover {
    background: var(--green);
}

.btn-link {
    background: none;
    border: none;
    color: var(--blue);
    font-family: var(--font);
    font-size: 12px;
    cursor: pointer;
    padding: 0;
}

.btn-link:hover {
    color: var(--text-bright);
}

.btn-icon {
    background: none;
    border: none;
    color: var(--text-dim);
    font-size: 16px;
    cursor: pointer;
    padding: 0.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-icon:hover {
    color: var(--text-bright);
}

.error-msg {
    color: var(--red);
    font-size: 12px;
    margin-top: 0.5rem;
    min-height: 1.2em;
}

.status-msg {
    color: var(--green);
    font-size: 12px;
    margin-top: 0.5rem;
    min-height: 1.2em;
}

.login-footer {
    text-align: center;
    margin-top: 1rem;
}

/* ============================================
   Modal
   ============================================ */

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: var(--bg-modal);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    width: 100%;
    max-width: 400px;
    margin: 1rem;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    color: var(--green);
}

/* ============================================
   App Layout
   ============================================ */

#app-view {
    display: flex;
    height: 100%;
}

.mobile-header {
    display: none;
    align-items: center;
    padding: 0.5rem 1rem;
    background: var(--bg-sidebar);
    border-bottom: 1px solid var(--border);
    gap: 0.5rem;
}

.chat-name-display {
    flex: 1;
    color: var(--green);
    font-weight: bold;
}

/* ============================================
   Sidebar
   ============================================ */

.sidebar {
    width: 260px;
    min-width: 260px;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

.sidebar-header {
    padding: 1rem;
    border-bottom: 1px solid var(--border);
}

.sidebar-user {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 0.5rem;
    font-size: 12px;
    color: var(--text-dim);
}

.sidebar-section {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem 0;
}

.sidebar-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.25rem 1rem;
    color: var(--text-dim);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.chat-list {
    display: flex;
    flex-direction: column;
}

.chat-item {
    display: flex;
    align-items: center;
    padding: 0.5rem 1rem;
    cursor: pointer;
    gap: 0.5rem;
    transition: background 0.15s;
    position: relative;
}

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

.chat-item.active {
    background: var(--bg-hover);
    border-left: 2px solid var(--green);
}

.chat-color-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.chat-item-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 13px;
}

.chat-type-badge {
    font-size: 10px;
    color: var(--text-dim);
    flex-shrink: 0;
}

.chat-unread {
    background: var(--green);
    color: var(--bg);
    border-radius: 50%;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: bold;
    flex-shrink: 0;
}

.sidebar-btn {
    display: block;
    padding: 0.5rem 1rem;
    width: 100%;
    text-align: left;
}

/* ============================================
   Main Content
   ============================================ */

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

.empty-state {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-dim);
}

.ascii-art {
    font-size: 12px;
    line-height: 1.3;
    white-space: pre;
    user-select: none;
}

/* ============================================
   Messages
   ============================================ */

.messages-area {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

.messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
}

.messages {
    display: flex;
    flex-direction: column;
    margin-top: auto;
}

.load-more {
    text-align: center;
    padding: 0.5rem;
}

.message {
    padding: 0.15rem 0;
    line-height: 1.5;
    word-wrap: break-word;
}

.message .timestamp {
    color: var(--text-dim);
    font-size: 11px;
}

.message .username {
    color: var(--green);
    font-weight: bold;
}

.message .content {
    color: var(--text);
}

.message .file-info {
    color: var(--orange);
}

.message .file-link {
    color: var(--blue);
    text-decoration: none;
}

.message .file-link:hover {
    text-decoration: underline;
}

.message .file-size {
    color: var(--text-dim);
    font-size: 11px;
}

.message.system-message {
    color: var(--text-dim);
    font-style: italic;
    font-size: 12px;
}

/* ============================================
   Upload Progress
   ============================================ */

.upload-progress {
    padding: 0.5rem 1rem;
    border-top: 1px solid var(--border);
    background: var(--bg-input);
    font-size: 12px;
}

.progress-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.25rem;
}

#progress-fill {
    color: var(--green);
    font-family: var(--font);
    white-space: pre;
}

#progress-text {
    color: var(--text-dim);
    font-size: 11px;
    min-width: 4em;
}

/* ============================================
   Input Area
   ============================================ */

.input-area {
    padding: 0.75rem 1rem;
    border-top: 1px solid var(--border);
    background: var(--bg);
}

.input-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.input-row .prompt {
    color: var(--green);
    font-weight: bold;
    flex-shrink: 0;
}

#message-input {
    flex: 1;
    background: var(--bg-input);
    border: 1px solid var(--border);
    color: var(--text-bright);
    font-family: var(--font);
    font-size: 13px;
    padding: 0.5rem;
    border-radius: var(--radius);
    outline: none;
}

#message-input:focus {
    border-color: var(--green);
}

.file-btn {
    cursor: pointer;
    font-size: 16px;
    color: var(--text-dim);
    display: flex;
    align-items: center;
}

.file-btn:hover {
    color: var(--text-bright);
}

/* ============================================
   Admin Panel
   ============================================ */

#admin-view {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 2rem;
    overflow-y: auto;
}

.admin-container {
    width: 100%;
    max-width: 800px;
}

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    color: var(--green);
    font-size: 16px;
}

.admin-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.5rem;
}

.admin-tab {
    background: none;
    border: 1px solid var(--border);
    color: var(--text-dim);
    font-family: var(--font);
    font-size: 12px;
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius);
    cursor: pointer;
}

.admin-tab.active {
    background: var(--green-dim);
    color: var(--text-bright);
    border-color: var(--green);
}

.admin-content {
    min-height: 300px;
}

.admin-action-bar {
    margin-bottom: 1rem;
}

.admin-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.admin-list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    gap: 1rem;
}

.admin-list-item .item-info {
    flex: 1;
}

.admin-list-item .item-info .item-name {
    color: var(--text-bright);
    font-weight: bold;
}

.admin-list-item .item-info .item-detail {
    color: var(--text-dim);
    font-size: 11px;
}

.admin-list-item .item-actions {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
}

.btn-danger {
    background: none;
    border: 1px solid var(--red);
    color: var(--red);
    font-family: var(--font);
    font-size: 11px;
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius);
    cursor: pointer;
}

.btn-danger:hover {
    background: var(--red);
    color: var(--bg);
}

.btn-small {
    background: none;
    border: 1px solid var(--border);
    color: var(--text);
    font-family: var(--font);
    font-size: 11px;
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius);
    cursor: pointer;
}

.btn-small:hover {
    border-color: var(--text);
}

.btn-approve {
    border-color: var(--green);
    color: var(--green);
}

.btn-approve:hover {
    background: var(--green);
    color: var(--bg);
}

/* ============================================
   Toast Notifications
   ============================================ */

.toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.toast {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.75rem 1rem;
    font-size: 12px;
    max-width: 350px;
    animation: slideIn 0.3s ease;
}

.toast.toast-error {
    border-color: var(--red);
    color: var(--red);
}

.toast.toast-success {
    border-color: var(--green);
    color: var(--green);
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* ============================================
   Context Menu
   ============================================ */

.context-menu {
    position: fixed;
    background: var(--bg-modal);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.25rem 0;
    z-index: 1500;
    min-width: 150px;
}

.context-menu-item {
    padding: 0.4rem 1rem;
    cursor: pointer;
    font-size: 12px;
    color: var(--text);
}

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

.context-menu-item.danger {
    color: var(--red);
}

/* ============================================
   Sidebar Overlay (Mobile)
   ============================================ */

.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99;
}

/* ============================================
   Inline Edit
   ============================================ */

.inline-edit {
    background: var(--bg-input);
    border: 1px solid var(--green);
    color: var(--text-bright);
    font-family: var(--font);
    font-size: 13px;
    padding: 0.1rem 0.3rem;
    border-radius: var(--radius);
    outline: none;
    width: 100%;
}

/* ============================================
   Color Picker
   ============================================ */

.color-options {
    display: flex;
    gap: 0.5rem;
    padding: 0.5rem 0;
    flex-wrap: wrap;
}

.color-option {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid transparent;
    transition: border-color 0.15s;
}

.color-option:hover,
.color-option.selected {
    border-color: var(--text-bright);
}

/* ============================================
   Responsive
   ============================================ */

@media (max-width: 768px) {
    .mobile-header {
        display: flex;
    }

    .sidebar {
        position: fixed;
        left: -260px;
        top: 0;
        height: 100%;
        z-index: 100;
        transition: left 0.3s ease;
    }

    .sidebar.open {
        left: 0;
    }

    #app-view {
        flex-direction: column;
    }

    .main-content {
        height: calc(100% - 44px);
    }

    .messages-container {
        padding: 0.5rem;
    }
}
