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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: #1a1a1a;
    color: #e0e0e0;
    line-height: 1.6;
}

.container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 20px;
}

header {
    margin-bottom: 20px;
}

.header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.header-row h1 {
    margin: 0;
}

header h1 {
    color: #5865f2;
    font-size: 1.8rem;
}

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

.btn-logout {
    padding: 8px 16px;
    background: transparent;
    border: 1px solid #3a3a3a;
    color: #aaa;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
}

.btn-logout:hover {
    background: #3a3a3a;
    color: #e0e0e0;
}

.btn-icon {
    background: transparent;
    border: 1px solid #3a3a3a;
    color: #aaa;
    width: 36px;
    height: 36px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1.2rem;
}

.btn-icon:hover {
    background: #3a3a3a;
    color: #e0e0e0;
}

.settings-modal .modal-body {
    padding: 20px;
}

.settings-notice {
    font-size: 0.85rem;
    color: #888;
    margin-bottom: 16px;
}

.tokens-list {
    margin-bottom: 20px;
}

.token-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    padding: 12px 14px;
    background: #1a1a1a;
    border: 1px solid #3a3a3a;
    border-radius: 6px;
    margin-bottom: 8px;
}

.token-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.token-name {
    font-weight: 600;
    color: #e0e0e0;
}

.token-masked {
    font-family: monospace;
    font-size: 0.85rem;
    color: #888;
}

.token-actions {
    display: flex;
    gap: 8px;
}

.add-token-form {
    display: flex;
    gap: 10px;
    margin-top: 16px;
}

.add-token-form input {
    flex: 1;
    min-width: 0;
}

.stats {
    display: flex;
    gap: 16px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.stat-card {
    background: #2a2a2a;
    border-radius: 8px;
    padding: 14px 24px;
    text-align: center;
    border: 1px solid #3a3a3a;
    min-width: 100px;
}

.stat-label {
    font-size: 0.75rem;
    color: #aaa;
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    font-size: 1.4rem;
    font-weight: bold;
    color: #5865f2;
}

nav.tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
    border-bottom: 2px solid #3a3a3a;
    padding-bottom: 10px;
}

.tab {
    background: transparent;
    border: none;
    color: #aaa;
    padding: 10px 16px;
    cursor: pointer;
    font-size: 0.9rem;
    border-radius: 6px;
    transition: all 0.2s;
}

.tab:hover {
    color: #e0e0e0;
    background: #2a2a2a;
}

.tab.active {
    color: #fff;
    background: #5865f2;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Filters */
.filters {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 15px;
    padding: 15px;
    background: #2a2a2a;
    border-radius: 8px;
    align-items: center;
}

.filter-input, .filter-select {
    padding: 8px 12px;
    border: 1px solid #3a3a3a;
    border-radius: 6px;
    background: #1a1a1a;
    color: #e0e0e0;
    font-size: 0.9rem;
    min-width: 140px;
}

.filter-input:focus, .filter-select:focus {
    border-color: #5865f2;
    outline: none;
}

.filter-input::placeholder {
    color: #666;
}

.filter-checkbox {
    display: flex;
    align-items: center;
    gap: 6px;
    color: #aaa;
    font-size: 0.85rem;
    cursor: pointer;
}

.filter-checkbox input {
    cursor: pointer;
}

.btn-filter, .btn-clear {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.btn-filter {
    background: #5865f2;
    color: white;
}

.btn-filter:hover {
    background: #4752c4;
}

.btn-clear {
    background: #3a3a3a;
    color: #aaa;
}

.btn-clear:hover {
    background: #4a4a4a;
    color: #e0e0e0;
}

.results-info {
    font-size: 0.85rem;
    color: #888;
    margin-bottom: 10px;
}

.search-types {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 14px;
    align-items: center;
}

.search-type-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 500;
}

.search-type-badge.type-message { background: #5865f2; color: #fff; }
.search-type-badge.type-edit { background: #faa61a; color: #000; }
.search-type-badge.type-delete { background: #ed4245; color: #fff; }
.search-type-badge.type-voice { background: #57f287; color: #000; }
.search-type-badge.type-reaction { background: #eb459e; color: #fff; }
.search-type-badge.type-profile { background: #9b59b6; color: #fff; }
.search-type-badge.type-presence { background: #3498db; color: #fff; }
.search-type-badge.type-typing { background: #95a5a6; color: #fff; }

.search-details {
    max-width: 400px;
}

/* Table styles */
.table-container {
    overflow-x: auto;
    background: #2a2a2a;
    border-radius: 8px;
    border: 1px solid #3a3a3a;
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead {
    background: #1a1a1a;
    position: sticky;
    top: 0;
}

th {
    padding: 12px 10px;
    text-align: left;
    color: #5865f2;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.5px;
    border-bottom: 2px solid #3a3a3a;
    white-space: nowrap;
}

td {
    padding: 10px;
    border-bottom: 1px solid #333;
    font-size: 0.9rem;
}

tbody tr:nth-child(even) {
    background: #252525;
}

tbody tr:hover {
    background: #333;
}

tbody tr:last-child td {
    border-bottom: none;
}

/* Content styles */
.message-content {
    max-width: 350px;
    word-wrap: break-word;
    overflow-wrap: break-word;
    white-space: pre-wrap;
}

.old-content {
    color: #f04747;
    text-decoration: line-through;
    opacity: 0.8;
}

.new-content {
    color: #43b581;
}

.deleted-content {
    color: #f04747;
    font-style: italic;
}

.channel-name {
    color: #5865f2;
}

.guild-name {
    color: #aaa;
    font-size: 0.85rem;
}

.username {
    color: #fff;
    font-weight: 500;
}

.timestamp {
    color: #888;
    font-size: 0.8rem;
    white-space: nowrap;
}

.message-id, .msg-id-cell {
    font-family: monospace;
    font-size: 0.75rem;
    color: #666;
}

/* Clickable elements */
.clickable-user {
    color: #5865f2;
    cursor: pointer;
    transition: all 0.2s;
}

.clickable-user:hover {
    color: #7289da;
    text-decoration: underline;
}

.clickable-id {
    font-family: monospace;
    font-size: 0.75rem;
    color: #888;
    cursor: pointer;
    transition: all 0.2s;
}

.clickable-id:hover {
    color: #5865f2;
    text-decoration: underline;
}

.clickable-reply {
    cursor: pointer;
}

.clickable-reply:hover {
    filter: brightness(1.2);
}

.user-id-inline {
    font-size: 0.7rem;
    color: #666;
    font-family: monospace;
}

.user-id-cell {
    font-family: monospace;
    font-size: 0.75rem;
    color: #888;
    word-break: break-all;
    max-width: 120px;
}

.token-index {
    font-family: monospace;
    font-size: 0.75rem;
    color: #5865f2;
    font-weight: 600;
}

.dm-badge {
    color: #9146ff;
    font-weight: 500;
}

.dm-indicator {
    color: #9146ff;
    font-weight: 500;
    font-size: 0.85rem;
}

.filter-input-small {
    max-width: 160px;
}

.emoji {
    font-size: 1.2rem;
}

/* Status badges */
.status-badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 500;
}

.status-online { background: #43b581; color: white; }
.status-idle { background: #faa61a; color: white; }
.status-dnd { background: #f04747; color: white; }
.status-offline { background: #747f8d; color: white; }

.voice-status {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 500;
}

.voice-status.join { background: #43b581; color: white; }
.voice-status.leave { background: #f04747; color: white; }
.voice-status.move { background: #5865f2; color: white; }
.voice-status.mute, .voice-status.unmute { background: #faa61a; color: white; }
.voice-status.deafen, .voice-status.undeafen { background: #faa61a; color: white; }
.voice-status.stream_start, .voice-status.stream_stop { background: #9146ff; color: white; }
.voice-status.video_start, .voice-status.video_stop { background: #5865f2; color: white; }
.voice-status.update { background: #3a3a3a; color: #aaa; }

.reaction-action {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
}

.reaction-action.add { background: #43b581; color: white; }
.reaction-action.remove { background: #f04747; color: white; }

/* Activity type colors */
.activity-type-0 { color: #43b581; }
.activity-type-1 { color: #9146ff; }
.activity-type-2 { color: #1db954; }
.activity-type-3 { color: #5865f2; }
.activity-type-5 { color: #faa61a; }

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-top: 15px;
    padding: 10px;
}

.pagination button {
    padding: 8px 16px;
    border: 1px solid #3a3a3a;
    border-radius: 6px;
    background: #2a2a2a;
    color: #e0e0e0;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s;
}

.pagination button:hover {
    background: #3a3a3a;
    border-color: #5865f2;
}

.pagination .page-info {
    color: #888;
    font-size: 0.9rem;
}

/* Loading and empty states */
.loading, .empty {
    text-align: center;
    padding: 40px;
    color: #666;
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #1a1a1a;
}

::-webkit-scrollbar-thumb {
    background: #3a3a3a;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #4a4a4a;
}

/* Tracked Users */
.tracked-section {
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid #3a3a3a;
}

.tracked-section:last-child {
    border-bottom: none;
}

.tracked-section h2 {
    color: #5865f2;
    margin-bottom: 15px;
    font-size: 1.2rem;
}

.add-tracked-form {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 15px;
}

.tracked-config-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.tracked-config-item {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #2a2a2a;
    border: 1px solid #3a3a3a;
    border-radius: 8px;
    padding: 10px 15px;
}

.tracked-config-avatar img,
.tracked-config-avatar .avatar-placeholder-small {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}

.avatar-placeholder-small {
    background: #5865f2;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    font-weight: bold;
    color: white;
}

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

.tracked-config-name {
    font-weight: 600;
    color: #fff;
}

.tracked-config-id {
    font-size: 0.75rem;
    color: #666;
    font-family: monospace;
}

.tracked-config-notes {
    font-size: 0.8rem;
    color: #888;
    margin-top: 2px;
}

.tracked-config-meta {
    font-size: 0.75rem;
    color: #666;
    white-space: nowrap;
}

.btn-remove {
    background: transparent;
    border: 1px solid #f04747;
    color: #f04747;
    width: 28px;
    height: 28px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.btn-remove:hover {
    background: #f04747;
    color: white;
}

.empty-config {
    text-align: center;
    padding: 30px;
    color: #666;
    background: #2a2a2a;
    border-radius: 8px;
    border: 1px dashed #3a3a3a;
}

.tracked-users-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.tracked-user-card {
    background: #2a2a2a;
    border-radius: 8px;
    padding: 15px;
    border: 1px solid #3a3a3a;
    display: flex;
    gap: 15px;
    align-items: flex-start;
}

.tracked-user-avatar img,
.tracked-user-avatar .avatar-placeholder {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
}

.avatar-placeholder {
    background: #5865f2;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: bold;
    color: white;
}

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

.tracked-user-name {
    font-size: 1.1rem;
    font-weight: 600;
    color: #fff;
}

.tracked-user-global {
    font-size: 0.9rem;
    color: #aaa;
}

.tracked-user-id {
    font-size: 0.75rem;
    color: #666;
    font-family: monospace;
    margin: 4px 0;
}

.tracked-user-bio {
    font-size: 0.85rem;
    color: #ccc;
    margin: 8px 0;
    word-break: break-word;
}

.tracked-user-meta {
    font-size: 0.75rem;
    color: #666;
}

.tracked-user-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.btn-refresh {
    border-color: #57f287;
    color: #57f287;
}

.btn-refresh:hover {
    background: #57f287;
    color: #1a1a1a;
}

.banner-history-grid .avatar-history-item img,
.banner-img {
    width: 100%;
    height: 60px;
    object-fit: cover;
    border-radius: 4px;
}

.btn-small {
    padding: 5px 10px;
    font-size: 0.75rem;
    border: 1px solid #5865f2;
    background: transparent;
    color: #5865f2;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-small:hover {
    background: #5865f2;
    color: white;
}

.table-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}

.avatar-cell {
    width: 50px;
}

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

.modal-content {
    background: #2a2a2a;
    border-radius: 12px;
    max-width: 800px;
    max-height: 80vh;
    width: 90%;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid #3a3a3a;
}

.modal-header h3 {
    margin: 0;
    color: #5865f2;
}

.modal-close {
    background: none;
    border: none;
    color: #aaa;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.modal-close:hover {
    color: #fff;
}

.avatar-history-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 15px;
    padding: 20px;
    overflow-y: auto;
}

.avatar-history-item {
    text-align: center;
}

.avatar-history-item img {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #3a3a3a;
}

.avatar-history-date {
    font-size: 0.75rem;
    color: #888;
    margin-top: 5px;
}

.avatar-history-size {
    font-size: 0.7rem;
    color: #666;
}

/* Detail modals */
.detail-row {
    margin-bottom: 10px;
}

.detail-content {
    background: #1a1a1a;
    padding: 12px;
    border-radius: 6px;
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 300px;
    overflow-y: auto;
}

.edit-detail-item {
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid #3a3a3a;
}

.edit-detail-item:last-child {
    border-bottom: none;
}

.detail-table {
    width: 100%;
    margin-top: 10px;
}

.detail-table th,
.detail-table td {
    padding: 8px;
    text-align: left;
}

/* User Modal */
.user-modal {
    max-width: 450px;
}

.user-modal-body {
    display: flex;
    gap: 20px;
    padding: 20px;
}

.user-modal-avatar img,
.user-modal-avatar .avatar-placeholder {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    object-fit: cover;
}

.user-modal-info {
    flex: 1;
}

.user-modal-name {
    font-size: 1.3rem;
    font-weight: 600;
    color: #fff;
}

.user-modal-global {
    font-size: 1rem;
    color: #aaa;
}

.user-modal-id {
    font-size: 0.75rem;
    color: #666;
    font-family: monospace;
    margin: 5px 0;
}

.user-modal-status {
    margin: 10px 0;
}

.user-modal-bio {
    font-size: 0.9rem;
    color: #ccc;
    margin: 10px 0;
    padding: 10px;
    background: #1a1a1a;
    border-radius: 6px;
    white-space: pre-wrap;
}

.user-modal-stats {
    display: flex;
    gap: 15px;
    font-size: 0.85rem;
    color: #888;
    margin-top: 10px;
}

.user-modal-actions {
    display: flex;
    gap: 10px;
    padding: 15px 20px;
    border-top: 1px solid #3a3a3a;
    justify-content: flex-end;
}

/* Responsive */
@media (max-width: 768px) {
    .filters {
        flex-direction: column;
    }
    
    .filter-input, .filter-select {
        width: 100%;
    }
    
    .header-row {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .stats {
        flex-direction: column;
    }
    
    nav.tabs {
        overflow-x: auto;
        flex-wrap: nowrap;
        padding-bottom: 15px;
    }
    
    .tab {
        white-space: nowrap;
    }
    
    .tracked-user-card {
        flex-direction: column;
    }
    
    .tracked-user-actions {
        width: 100%;
    }
    
    .modal-content {
        max-width: 95%;
        max-height: 90vh;
    }
}
