/* Discord Monitor - Modern Design */

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

:root {
    --bg-primary: #1a1b1e;
    --bg-secondary: #25262b;
    --bg-tertiary: #2a2b30;
    --bg-hover: #32353a;
    --border-color: #3f4147;
    --text-primary: #f2f3f5;
    --text-secondary: #b5bac1;
    --text-muted: #80848e;
    --accent-green: #23a559;
    --accent-green-hover: #1a8c48;
    --accent-blue: #5865f2;
    --accent-blue-hover: #4752c4;
    --accent-red: #da373c;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.5);
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
}

body {
    font-family: 'gg sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
}

/* Login Screen */
.login-screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #5865f2 0%, #3ba55c 100%);
    padding: 20px;
}

.login-box {
    background: var(--bg-secondary);
    padding: 48px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 420px;
    text-align: center;
}

.login-logo {
    font-size: 64px;
    margin-bottom: 16px;
}

.login-box h1 {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.login-subtitle {
    color: var(--text-secondary);
    margin-bottom: 32px;
    font-size: 15px;
}

/* Dashboard */
.dashboard {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Navbar */
.navbar {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    padding: 16px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow-sm);
}

.nav-left {
    display: flex;
    align-items: center;
    gap: 32px;
}

.nav-brand {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
}

.nav-stats {
    display: flex;
    gap: 24px;
}

.stat {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.stat-value {
    font-size: 20px;
    font-weight: 700;
    color: var(--accent-green);
}

.stat-label {
    font-size: 11px;
    text-transform: uppercase;
    color: var(--text-muted);
    font-weight: 600;
    letter-spacing: 0.5px;
}

.nav-right {
    display: flex;
    gap: 12px;
}

/* Container */
.container {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* Sidebar */
.sidebar {
    width: 320px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.section {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
}

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

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

.section-header h3 {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
}

.badge {
    background: var(--accent-blue);
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.btn-icon {
    background: var(--bg-tertiary);
    border: none;
    color: var(--text-secondary);
    width: 28px;
    height: 28px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: all 0.2s;
}

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

/* Channels List */
.channels-list {
    max-height: 400px;
    overflow-y: auto;
}

.guild-section {
    margin-bottom: 16px;
}

.guild-header {
    background: var(--bg-tertiary);
    padding: 10px 12px;
    border-radius: var(--radius-md);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: background 0.2s;
}

.guild-header:hover {
    background: var(--bg-hover);
}

.guild-icon {
    width: 32px;
    height: 32px;
    background: var(--accent-blue);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
    color: white;
    flex-shrink: 0;
}

.guild-name {
    flex: 1;
    font-weight: 600;
    color: var(--text-primary);
}

.guild-channel-count {
    font-size: 12px;
    color: var(--text-muted);
}

.channel-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    margin: 4px 0;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.2s;
    margin-left: 20px;
}

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

.channel-item.enabled {
    background: rgba(35, 165, 89, 0.1);
    border-color: var(--accent-green);
}

.channel-item.enabled .channel-name {
    color: var(--accent-green);
    font-weight: 600;
}

.channel-name {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    color: var(--text-secondary);
}

.channel-name::before {
    content: '#';
    color: var(--text-muted);
}

/* Toggle Switch */
.channel-toggle {
    width: 44px;
    height: 24px;
    background: var(--border-color);
    border-radius: 12px;
    position: relative;
    cursor: pointer;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.channel-toggle:hover {
    background: var(--text-muted);
}

.channel-toggle.active {
    background: var(--accent-green);
}

.channel-toggle::after {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    background: white;
    border-radius: 50%;
    top: 3px;
    left: 3px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.channel-toggle.active::after {
    transform: translateX(20px);
}

/* Webhooks List */
.webhooks-list {
    max-height: 200px;
    overflow-y: auto;
}

.webhook-item {
    background: var(--bg-tertiary);
    padding: 12px;
    margin: 8px 0;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.webhook-info {
    margin-bottom: 8px;
}

.webhook-name {
    color: var(--text-primary);
    font-weight: 600;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.webhook-status {
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
    text-transform: uppercase;
}

.webhook-status.enabled {
    background: rgba(35, 165, 89, 0.2);
    color: var(--accent-green);
}

.webhook-status.disabled {
    background: rgba(128, 132, 142, 0.2);
    color: var(--text-muted);
}

.webhook-url {
    color: var(--text-muted);
    font-size: 12px;
    word-break: break-all;
    font-family: 'Consolas', monospace;
    margin-top: 4px;
}

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

/* Main Content */
.main-content {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

/* Welcome State */
.welcome-state {
    text-align: center;
    padding: 60px 20px;
    max-width: 600px;
    margin: 0 auto;
}

.welcome-icon {
    font-size: 80px;
    margin-bottom: 24px;
}

.welcome-state h2 {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 12px;
    color: var(--text-primary);
}

.welcome-state > p {
    font-size: 16px;
    color: var(--text-secondary);
    margin-bottom: 32px;
}

.welcome-steps {
    display: flex;
    flex-direction: column;
    gap: 16px;
    text-align: left;
}

.step {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.step-number {
    width: 32px;
    height: 32px;
    background: var(--accent-blue);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    flex-shrink: 0;
}

.step-text {
    font-size: 14px;
    color: var(--text-secondary);
}

/* Message Feed Section */
.message-feed-section {
    max-width: 900px;
    margin: 0 auto;
}

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

.feed-header h2 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
}

.feed-controls {
    display: flex;
    align-items: center;
    gap: 12px;
}

.connection-status {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    font-size: 13px;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent-green);
    animation: pulse 2s infinite;
}

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

.message-feed {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    padding: 20px;
    min-height: 400px;
    max-height: 600px;
    overflow-y: auto;
}

.empty-state,
.empty-state-small {
    text-align: center;
    color: var(--text-muted);
    padding: 40px 20px;
}

/* Messages */
.message {
    display: flex;
    gap: 16px;
    padding: 16px;
    margin: 12px 0;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--accent-blue);
    flex-shrink: 0;
    overflow: hidden;
}

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

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

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

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

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

.message-channel {
    color: var(--accent-green);
    font-size: 12px;
    font-weight: 600;
}

.message-action-btn {
    margin-left: auto;
    padding: 4px 10px;
    font-size: 11px;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s;
    opacity: 0.7;
}

.message-action-btn:hover {
    opacity: 1;
    background: var(--bg-hover);
    border-color: var(--accent-blue);
    color: var(--accent-blue);
}

.message-action-btn:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

.message-text {
    color: var(--text-secondary);
    line-height: 1.4;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.message-attachments {
    margin-top: 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.attachment {
    color: var(--accent-blue);
    text-decoration: none;
    font-size: 13px;
    padding: 6px 12px;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
}

.attachment:hover {
    background: var(--bg-hover);
    border-color: var(--accent-blue);
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.btn-primary {
    background: var(--accent-blue);
    color: white;
}

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

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

.btn-secondary:hover {
    background: var(--bg-hover);
}

.btn-small {
    padding: 6px 12px;
    font-size: 13px;
}

.btn-large {
    padding: 14px 32px;
    font-size: 16px;
}

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

.btn-danger:hover {
    background: #c43434;
}

/* Modal */
.modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
}

.modal-content {
    position: relative;
    background: var(--bg-secondary);
    padding: 32px;
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 500px;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
}

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

.modal-header h2 {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
}

.modal-body {
    margin-bottom: 24px;
}

/* Token Status */
.token-status {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    margin-top: 12px;
}

.status-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--text-muted);
}

.token-status .status-text {
    font-size: 14px;
    color: var(--text-secondary);
}

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

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

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 14px;
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent-blue);
}

.form-group textarea {
    resize: vertical;
    font-family: 'Consolas', monospace;
}

.help-text {
    display: block;
    margin-top: 6px;
    font-size: 12px;
    color: var(--text-muted);
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 24px;
}

/* Utilities */
.hidden {
    display: none !important;
}

.error {
    color: var(--accent-red);
    margin-top: 16px;
    font-size: 14px;
}

.loading-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color);
    border-top-color: var(--accent-blue);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 12px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-text {
    text-align: center;
    color: var(--text-muted);
    font-size: 14px;
}

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

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

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

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

/* Logs Modal */
.modal-large {
    max-width: 900px;
    width: 90%;
}

.logs-modal-body {
    padding: 0;
}

.logs-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-secondary);
}

.logs-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}

.status-dot-green {
    background: var(--accent-green);
}

.status-dot-yellow {
    background: #f59e0b;
}

.status-dot-red {
    background: var(--accent-red);
}

.logs-container {
    height: 500px;
    overflow-y: auto;
    padding: 16px;
    background: var(--bg-primary);
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 13px;
}

.log-entry {
    display: grid;
    grid-template-columns: 80px 60px 120px 1fr;
    gap: 12px;
    padding: 6px 0;
    border-bottom: 1px solid var(--border-color);
    align-items: start;
}

.log-timestamp {
    color: var(--text-muted);
    font-size: 12px;
}

.log-level {
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.log-level-info {
    background: rgba(59, 130, 246, 0.2);
    color: #60a5fa;
}

.log-level-warning {
    background: rgba(245, 158, 11, 0.2);
    color: #fbbf24;
}

.log-level-error {
    background: rgba(239, 68, 68, 0.2);
    color: #f87171;
}

.log-level-debug {
    background: rgba(107, 114, 128, 0.2);
    color: #9ca3af;
}

.log-source {
    color: var(--text-muted);
    font-size: 12px;
}

.log-message {
    color: var(--text-primary);
    word-break: break-word;
}
