/* CSS Variables for Theming */
:root {
    --bg-primary: #ffffff;
    --bg-secondary: #f5f5f5;
    --bg-card: #ffffff;
    --text-primary: #1a1a1a;
    --text-secondary: #666666;
    --text-muted: #999999;
    --border-color: #e0e0e0;
    --accent-color: #2481cc;
    --accent-hover: #1a6db3;
    --success-color: #34c759;
    --warning-color: #ff9500;
    --danger-color: #ff3b30;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.12);
    --radius: 12px;
    --radius-sm: 8px;
}

[data-theme="dark"] {
    --bg-primary: #1a1a1a;
    --bg-secondary: #2d2d2d;
    --bg-card: #252525;
    --text-primary: #ffffff;
    --text-secondary: #b0b0b0;
    --text-muted: #808080;
    --border-color: #404040;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.4);
}

/* Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    line-height: 1.5;
    min-height: 100vh;
    transition: background-color 0.3s, color 0.3s;
}

#app {
    max-width: 600px;
    margin: 0 auto;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.header {
    background: var(--bg-card);
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header h1 {
    font-size: 20px;
    font-weight: 600;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-info {
    font-size: 12px;
    color: var(--text-secondary);
    background: var(--bg-secondary);
    padding: 4px 10px;
    border-radius: 12px;
}

.user-id-card {
    background: linear-gradient(135deg, var(--accent-color), #6366f1);
    color: white;
}

.user-id-card h2 {
    color: white;
}

.user-id-card .hint {
    color: rgba(255, 255, 255, 0.8);
}

.user-id-box {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(255, 255, 255, 0.15);
    padding: 12px 16px;
    border-radius: 8px;
    margin: 12px 0;
}

.user-id-value {
    font-size: 20px;
    font-weight: 700;
    font-family: 'SF Mono', Monaco, monospace;
    letter-spacing: 1px;
}

.user-id-card .btn-secondary {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
}

.user-id-card .btn-secondary:hover {
    background: rgba(255, 255, 255, 0.3);
}

.theme-btn {
    background: var(--bg-secondary);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: transform 0.2s, background-color 0.3s;
}

.theme-btn:hover {
    transform: scale(1.1);
}

.theme-btn:active {
    transform: scale(0.95);
}

[data-theme="dark"] .sun-icon,
.moon-icon {
    display: none;
}

[data-theme="dark"] .moon-icon {
    display: inline;
}

/* Tabs Navigation */
.tabs {
    display: flex;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    padding: 0 8px;
    position: sticky;
    top: 73px;
    z-index: 99;
}

.tab {
    flex: 1;
    background: none;
    border: none;
    padding: 12px 8px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    color: var(--text-muted);
    transition: color 0.2s;
    position: relative;
}

.tab::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 3px;
    background: var(--accent-color);
    border-radius: 3px 3px 0 0;
    transition: width 0.2s;
}

.tab.active {
    color: var(--accent-color);
}

.tab.active::after {
    width: 40px;
}

.tab-icon {
    font-size: 20px;
}

.tab-text {
    font-size: 11px;
    font-weight: 500;
}

/* Content */
.content {
    flex: 1;
    padding: 16px;
}

.tab-content {
    display: none;
    animation: fadeIn 0.3s ease;
}

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

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

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

.stat-card {
    background: var(--bg-card);
    padding: 16px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 12px;
}

.stat-icon {
    font-size: 28px;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
}

.stat-info {
    display: flex;
    flex-direction: column;
}

.stat-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
}

.stat-label {
    font-size: 12px;
    color: var(--text-secondary);
}

/* Section */
.section {
    margin-top: 20px;
}

.section h2 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text-primary);
}

/* Actions List */
.actions-list, .logs-list, .bans-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.action-item {
    background: var(--bg-card);
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow);
}

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

.action-type {
    font-size: 12px;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 4px;
    text-transform: uppercase;
}

.action-type.bad-word {
    background: #ffebee;
    color: #c62828;
}

.action-type.ad {
    background: #fff3e0;
    color: #ef6c00;
}

.action-type.warning {
    background: #fff8e1;
    color: #f9a825;
}

.action-type.ban {
    background: #fce4ec;
    color: #ad1457;
}

[data-theme="dark"] .action-type.bad-word {
    background: rgba(198, 40, 40, 0.2);
}

[data-theme="dark"] .action-type.ad {
    background: rgba(239, 108, 0, 0.2);
}

[data-theme="dark"] .action-type.warning {
    background: rgba(249, 168, 37, 0.2);
}

[data-theme="dark"] .action-type.ban {
    background: rgba(173, 20, 87, 0.2);
}

.action-time {
    font-size: 11px;
    color: var(--text-muted);
}

.action-user {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
}

.action-message {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 4px;
    word-break: break-word;
    background: var(--bg-secondary);
    padding: 8px;
    border-radius: 6px;
}

/* Ban Item */
.ban-item {
    background: var(--bg-card);
    padding: 16px;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ban-info {
    flex: 1;
}

.ban-user {
    font-weight: 600;
    font-size: 15px;
}

.ban-reason {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 2px;
}

.ban-date {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* Filter Bar */
.filter-bar {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
}

.select {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    color: var(--text-primary);
    font-size: 14px;
    cursor: pointer;
}

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

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

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

.btn-secondary {
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

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

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

.btn-danger:hover {
    opacity: 0.9;
}

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

.btn-block {
    width: 100%;
    margin-top: 20px;
}

.btn:active {
    transform: scale(0.98);
}

/* Settings */
.settings-section {
    background: var(--bg-card);
    padding: 16px;
    border-radius: var(--radius);
    margin-bottom: 16px;
    box-shadow: var(--shadow);
}

.settings-section h2 {
    font-size: 15px;
    margin-bottom: 12px;
}

.hint {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.settings-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Toggle Setting */
.toggle-setting {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    padding: 8px 0;
}

.toggle-setting span:first-child {
    font-size: 14px;
    color: var(--text-primary);
}

.toggle-setting input {
    display: none;
}

.toggle {
    width: 48px;
    height: 28px;
    background: var(--border-color);
    border-radius: 14px;
    position: relative;
    transition: background 0.3s;
}

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

.toggle-setting input:checked + .toggle {
    background: var(--success-color);
}

.toggle-setting input:checked + .toggle::after {
    transform: translateX(20px);
}

/* Textarea */
.textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
    min-height: 100px;
}

.textarea:focus {
    outline: none;
    border-color: var(--accent-color);
}

/* Toast */
.toast {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--text-primary);
    color: var(--bg-primary);
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    opacity: 0;
    transition: all 0.3s;
    z-index: 1000;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

/* Loading */
.loading {
    text-align: center;
    padding: 40px;
    color: var(--text-muted);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
}

.empty-state-icon {
    font-size: 48px;
    margin-bottom: 12px;
}

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

::-webkit-scrollbar-track {
    background: transparent;
}

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

/* Mobile Optimizations */
@media (max-width: 400px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .stat-card {
        padding: 12px;
    }
    
    .tab-text {
        font-size: 10px;
    }
}
