/* assets/css/style.css */

:root {
    --bg-color: #0e0e10;
    --card-bg: #18181b;
    --text-color: #efeff1;
    --accent-color: #9146ff;
    /* Twitch Purple */
    --accent-hover: #a970ff;
    --youtube-color: #ff0000;
    --border-color: #2a2a2d;
    --font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: var(--font-family);
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Layout Utilities */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    width: 100%;
}

.flex-center {
    display: flex;
    justify-content: center;
    align-items: center;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    border-radius: 6px;
    font-weight: 600;
    text-decoration: none;
    transition: background-color 0.2s, transform 0.1s;
    border: none;
    cursor: pointer;
    font-size: 1rem;
}

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

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

.card {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1rem;
}

h1,
h2,
h3 {
    margin-top: 0;
}

/* Navbar */
.navbar {
    background-color: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-color);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.logo span {
    color: var(--accent-color);
}

/* Dashboard Grid */
.grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.channel-card {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    transition: transform 0.2s, border-color 0.2s;
}

.channel-card:hover {
    transform: translateY(-2px);
    border-color: var(--accent-color);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.badge {
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 700;
}

.badge-live {
    background-color: #e91916;
    color: white;
}

.badge-offline {
    background-color: #555;
    color: #ccc;
}

.viewers,
.category {
    margin: 0;
    font-size: 0.9rem;
    color: #bbb;
}

.actions {
    margin-top: auto;
    padding-top: 1rem;
    display: flex;
    gap: 0.5rem;
}

.btn-secondary {
    background-color: #3a3a3d;
    color: #aaa;
    cursor: not-allowed;
}

.btn-outline {
    background-color: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-color);
}

.btn-outline:hover {
    border-color: var(--text-color);
    background-color: rgba(255, 255, 255, 0.05);
}

/* Stream Page Layout */
.stream-layout {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 60px);
    /* Minus navbar */
    overflow: hidden;
}

.video-container {
    background: #000;
    width: 100%;
    height: 60vh;
    min-height: 200px;
    resize: vertical;
    overflow: hidden;
    /* Required for resize handle to show */
    flex-shrink: 0;
}

.chat-container {
    background: var(--card-bg);
    border-top: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    /* Important for FireFox/Grid */
    overflow: visible;
    position: relative;
    /* For absolute positioning of notification */
}

.chat-paused-notification {
    position: absolute;
    bottom: 80px;
    /* Above input area */
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.8rem;
    pointer-events: none;
    /* Let clicks pass through if needed, though usually on top */
    opacity: 0;
    transition: opacity 0.2s;
    z-index: 10;
    border: 1px solid var(--accent-color);
}

.chat-paused-notification.visible {
    opacity: 1;
}

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

.chat-input-area {
    padding: 1rem;
    border-top: 1px solid var(--border-color);
    background: #1f1f23;
}

.chat-message {
    font-size: 0.9rem;
    line-height: 1.4;
    word-wrap: break-word;
}

.chat-message .username {
    font-weight: 700;
    margin-right: 0.5rem;
    cursor: pointer;
}

.chat-message .badges {
    display: inline-flex;
    gap: 2px;
    margin-right: 4px;
    vertical-align: middle;
}

.source-icon {
    width: 16px;
    height: 16px;
    vertical-align: middle;
    margin-right: 4px;
}

.chat-emote {
    vertical-align: middle;
    max-height: 28px;
    margin: -5px 0;
}

.chat-badge {
    vertical-align: middle;
    height: 18px;
    margin-right: 4px;
    border-radius: 2px;
}

/* Chat Settings */
.settings-btn {
    background: transparent;
    border: none;
    color: #aaa;
    cursor: pointer;
    padding: 5px;
    margin-right: 5px;
    transition: color 0.2s;
}

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

.chat-settings-panel {
    position: absolute;
    bottom: 110px;
    /* Above input area and button */
    left: 20px;
    background: #1f1f23;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 1rem;
    width: 250px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.5);
    z-index: 20;
    display: none;
}

.chat-settings-panel.visible {
    display: block;
}

.settings-item {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 0.8rem;
    font-size: 0.9rem;
    cursor: pointer;
}

.settings-item:last-child {
    margin-bottom: 0;
}

.settings-item input[type="checkbox"] {
    accent-color: var(--accent-color);
}

/* Emote Picker */
.emote-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 5px;
    font-size: 1.2rem;
    line-height: 1;
    filter: grayscale(1);
    transition: filter 0.2s, transform 0.1s;
}

.emote-btn:hover {
    filter: grayscale(0);
    transform: scale(1.1);
}

.emote-picker-panel {
    position: absolute;
    bottom: 60px;
    /* Above input area */
    right: 20px;
    /* Aligned right, or maybe adjust */
    width: 300px;
    height: 300px;
    background: #1f1f23;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    z-index: 25;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    display: none;
    /* Hidden by default */
}

.emote-picker-panel.visible {
    display: flex;
}

.emote-picker-header {
    padding: 10px;
    background: #18181b;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.9rem;
    font-weight: bold;
}

.emote-picker-content {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
}

.emote-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(32px, 1fr));
    gap: 8px;
}

.emote-item {
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.emote-item:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.emote-item img {
    max-width: 100%;
    max-height: 28px;
}

/* Mention Suggestions */
.suggestions-panel {
    position: absolute;
    bottom: 100%;
    /* Align bottom to top of input */
    left: 0;
    width: 250px;
    background: #1f1f23;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.5);
    z-index: 30;
    max-height: 200px;
    overflow-y: auto;
    display: none;
    flex-direction: column;
}

.suggestions-panel.visible {
    display: flex;
}

.suggestion-item {
    padding: 8px 12px;
    cursor: pointer;
    font-size: 0.9rem;
    color: #ccc;
    border-bottom: 1px solid #2a2a2d;
    display: flex;
    align-items: center;
    gap: 8px;
}


/* Message Actions (Reply/Pin) */
.message-actions {
    display: inline-flex;
    float: right;
    gap: 5px;
    margin-left: 10px;
    opacity: 0;
    transition: opacity 0.2s;
    vertical-align: middle;
}

.chat-message:hover .message-actions {
    opacity: 1;
}

.action-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    padding: 0 2px;
    opacity: 0.6;
    transition: transform 0.1s, opacity 0.1s;
}


/* User Info Card (Popover) */
.user-card {
    position: absolute;
    width: 300px;
    background: #18181b;
    border: 1px solid #333;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
    z-index: 1000;
    overflow: hidden;
    font-size: 0.9rem;
    opacity: 0;
    transform: scale(0.95);
    transition: opacity 0.1s, transform 0.1s;
    pointer-events: none;
    /* Initially non-interactive until visible */
}

.user-card.visible {
    opacity: 1;
    transform: scale(1);
    pointer-events: auto;
}

.user-card-header {
    background: #2a2a2d;
    padding: 15px;
    display: flex;
    align-items: center;
    gap: 15px;
    border-bottom: 1px solid #333;
}

.user-card-avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: 2px solid var(--accent-color);
}

.user-card-info h3 {
    margin: 0;
    font-size: 1.1rem;
    color: white;
}

.user-card-info p {
    margin: 2px 0 0;
    color: #aaa;
    font-size: 0.8rem;
}

.user-card-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    padding: 15px;
    background: #1f1f23;
}

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

.stat-label {
    font-size: 0.75rem;
    color: #888;
    text-transform: uppercase;
}

.stat-value {
    font-size: 0.9rem;
    color: #eee;
    font-weight: 500;
}

.user-card-actions {
    padding: 10px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    background: #18181b;
}

.card-action-btn {
    background: #2a2a2d;
    border: 1px solid #333;
    color: #ccc;
    padding: 8px 0;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: background 0.2s, color 0.2s;
}

.card-action-btn:hover {
    background: #3a3a3d;
    color: white;
}

.card-action-btn.timeout:hover {
    background: #e6a23c;
    /* Warning Orange */
    color: black;
    border-color: #e6a23c;
}

.card-action-btn.ban:hover {
    background: #f56c6c;
    /* Danger Red */
    color: white;
    border-color: #f56c6c;
}

.user-card-close {
    position: absolute;
    top: 5px;
    right: 5px;
    background: none;
    border: none;
    color: #666;
    cursor: pointer;
    font-size: 1.2rem;
}

.user-card-close:hover {
    color: white;
}

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

.suggestion-item:hover,
.suggestion-item.selected {
    background-color: var(--accent-color);
    color: white;
}

.suggestion-item .match {
    font-weight: bold;
    color: white;
}

/* Context Menu */
.context-menu {
    position: absolute;
    background: #18181b;
    border: 1px solid #333;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    z-index: 2000;
    /* Higher than User Card */
    min-width: 150px;
    padding: 5px 0;
    opacity: 0;
    transform: scale(0.95);
    transition: opacity 0.1s, transform 0.1s;
    pointer-events: none;
}

.context-menu.visible {
    opacity: 1;
    transform: scale(1);
    pointer-events: auto;
}

.context-menu-item {
    padding: 8px 15px;
    cursor: pointer;
    font-size: 0.9rem;
    color: #ddd;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background 0.1s;
}

.context-menu-item:hover {
    background: #2a2a2d;
    color: white;
}

.context-menu-separator {
    height: 1px;
    background: #333;
    margin: 4px 0;
}

.context-menu-item.danger {
    color: #f56c6c;
}

.context-menu-item.danger:hover {
    background: rgba(245, 108, 108, 0.1);
}