.hidden { display: none!important; }
html {
	height: 100%;
}
body {
	background-color: #ddd;
	font-size: 14px;
	margin: 0;
	padding: 0;
	height: 100vh;
	overflow: hidden;
}
.quota-warning {
    background: #fef3c7; /* light amber */
    border: 1px solid #fbbc05;
    color: #202124;
    padding: 6px 10px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin: 10px;
    max-height: 72px;
    overflow: hidden;
}
.custom-cred-indicator {
    margin-top: 8px;
    font-size: 12px;
    color: #1967d2;
}
.auth-method-selector {
    margin-top: 12px;
    padding: 10px 14px;
    background: rgba(0, 0, 0, 0.04);
    border-radius: 8px;
    display: inline-block;
}
.auth-method-label {
    display: block;
    font-size: 12px;
    color: #555;
    margin-bottom: 6px;
    font-weight: 500;
}
.auth-method-options {
    display: flex;
    gap: 16px;
}
.auth-method-option {
    display: flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    font-size: 13px;
    color: #333;
}
.auth-method-option input[type="radio"] {
    margin: 0;
    cursor: pointer;
}
.auth-method-option span {
    user-select: none;
}
.auth-button, .sign-out-button, .connect-button {
	background-color: #FF0000;
	color: white;
	padding: 8px 12px;
	border: none;
	border-radius: 4px;
	cursor: pointer;
	text-decoration: none;
	font-size: 14px;
	transition: background-color 0.3s;
}
.auth-button:hover, .connect-button:hover {
	background-color: #D30000;
}
.sign-out-button {
	background-color: #f44336;
}
.sign-out-button:hover {
	background-color: #d32f2f;
}
.container {
	max-width: 1200px;
	margin: 0 auto;
	display: grid;
	grid-template-columns: 1fr;
}

/* When logged in, switch to two-column layout */
body:has(.socket:not(.hidden)) .container {
	grid-template-columns: 1fr 300px;
}
.socket > div {
	margin: 5px;
}
.main-content {
	display: flex;
	flex-direction: column;
	gap: 15px;
	height: 100%;
	overflow-y: auto;
}
.chat-badge {
	margin-right: 2px;
	vertical-align: middle;
	height: 18px;
	width: auto;
}
.sidebar {
	display: flex;
	flex-direction: column;
	gap: 15px;
}
.text-center { text-align: center; }

/* Header styles */
.channel-header {
	background: white;
	padding: 12px;
	border-radius: 4px;
	box-shadow: 0 1px 3px rgba(0,0,0,0.1);
	display: flex;
	align-items: center;
	gap: 15px;
}
.header-info {
	display: flex;
	align-items: center;
	gap: 15px;
	flex-grow: 1;
}
.header-item {
	display: flex;
	align-items: center;
	gap: 6px;
}
.header-item span:first-child {
	font-weight: bold;
	color: #FF0000;
}

/* Channel input */
.channel-input-container {
	display: flex;
	align-items: center;
	gap: 8px;
}
.channel-input {
	padding: 8px;
	font-size: 14px;
	border: 1px solid #ddd;
	border-radius: 4px;
	width: 150px;
}

/* Stats grid */
.stats-container {
	background: white;
	padding: 12px;
	border-radius: 4px;
	box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
.stats-container h3 {
	margin: 0 0 10px 0;
	font-size: 16px;
}
.stats-grid {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 10px;
}
.stat-box {
	background: #f8f9fa;
	padding: 8px;
	border-radius: 4px;
	text-align: center;
}
.stat-value {
	font-size: 18px;
	font-weight: bold;
	color: #FF0000;
}
.stat-label {
	font-size: 12px;
	color: #666;
	margin-top: 2px;
}
.container {
	max-width: 1200px;
	margin: 0 auto;
	display: grid;
	grid-template-columns: 1fr;
	height: calc(100vh);
}
.chat-container h3 {
	margin: 0 0 10px 0;
	font-size: 16px;
}
#textarea {
	flex-grow: 1;
	min-height: 100px;
	height: calc(100% - 80px);
	overflow-y: auto;
	margin-bottom: 10px;
}
.chat-input {
	display: flex;
	gap: 8px;
}
.chat-input input {
	flex-grow: 1;
	padding: 8px;
	border: 1px solid #ddd;
	border-radius: 4px;
	font-size: 14px;
}

/* Sidebar components */
.permissions-container,
.recent-events {
	background: white;
	padding: 12px;
	border-radius: 4px;
	box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
#permissions-info:empty {
	display: none!important;
}
.permissions-header {
	font-weight: bold;
	font-size: 14px;
	margin-bottom: 8px;
	color: #FF0000;
}
.permission-item {
	padding: 4px 0;
	display: flex;
	justify-content: space-between;
	align-items: center;
	font-size: 13px;
}
.recent-events h4 {
	margin: 0 0 8px 0;
	font-size: 14px;
}
.event-item {
	padding: 6px 0;
	border-bottom: 1px solid #eee;
	font-size: 13px;
}
#textarea div {
	padding-bottom: 4px;
}
.chat-container {
	background: white;
	border-radius: 4px;
	padding: 12px;
	box-shadow: 0 1px 3px rgba(0,0,0,0.1);
	flex-grow: 1;
	display: flex;
	flex-direction: column;
}
.chat-container h3 {
	margin: 0 0 10px 0;
	font-size: 16px;
}
#textarea {
	flex-grow: 1;
	height: 400px;
	max-height: 400px;
	overflow-y: auto;
	margin-bottom: 10px;
}
.header-avatar {
	width: 32px;
	height: 32px;
	border-radius: 50%;
	margin-right: 8px;
}
.user-info {
	display: flex;
	align-items: center;
}
.user-info-text {
	margin-right: 12px;
}


/* Header styles - updated */
.channel-header {
	background: white;
	padding: 12px;
	border-radius: 4px;
	box-shadow: 0 1px 3px rgba(0,0,0,0.1);
	display: flex;
	flex-direction: column;
	gap: 10px;
}

/* Separate top row with user info and sign-out button */
.header-top {
	display: flex;
	justify-content: space-between;
	align-items: center;
	width: 100%;
}

.chat-emoji {
  height: 1.2em;
  width: auto;
  vertical-align: middle;
  margin: 0 0.05em;
}

.regular-emote {
  height: 1.5em;
  width: auto;
  vertical-align: middle;
  margin: 0 0.1em;
}

.zero-width-emote-centered {
  position: absolute;
  height: 1.5em;
  width: auto;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

/* User info styling */
.user-info {
	display: flex;
	align-items: center;
}

.header-info {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 15px;
	width: 100%;
}

/* Style for the header items to handle overflow */
.header-item {
	display: flex;
	align-items: center;
	gap: 6px;
	min-width: 0;
}

/* Target section with overflow handling */
.header-target {
	display: flex;
	align-items: center;
	gap: 6px;
	overflow: hidden;
	max-width: 100%;
}

.header-target span:first-child {
	font-weight: bold;
	color: #FF0000;
	white-space: nowrap;
}

.target-text {
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.header-item span:first-child {
	font-weight: bold;
	color: #FF0000;
	white-space: nowrap;
}

/* Bottom row with channel input */
.header-bottom {
	display: flex;
	align-items: center;
	justify-content: space-between;
	width: 100%;
}

/* Channel input container */
.channel-input-container {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px;
	flex: 1;
}

.channel-input {
	padding: 8px;
	font-size: 14px;
	border: 1px solid #ddd;
	border-radius: 4px;
	flex: 1;
	min-width: 120px;
}

/* Responsive adjustments */
@media (max-width: 768px) {
	.header-info {
		flex-direction: column;
		align-items: flex-start;
	}
	
	.channel-input-container {
		margin-top: 10px;
		width: 100%;
	}
}

@media (max-height: 800px) {
	#textarea {
		max-height: calc(100vh - 370px);
	}

}
@media (max-height: 600px) {
	#textarea {
		max-height: calc(100vh - 200px);
	}

}
@media (max-height: 600px) {
	.chat-header, .stats-container {
		display:none!important;
	}

}
stats-container

.poll-spinner-container {
	display: inline-flex;
	align-items: center;
	margin-left: 10px;
	font-size: 12px;
	color: #666;
}

.poll-spinner {
	width: 16px;
	height: 16px;
	border-radius: 50%;
	border: 2px solid rgba(255, 0, 0, 0.1);
	border-top-color: #FF0000;
	margin-right: 5px;
	transform-origin: center;
	animation-name: spinner-rotation;
	animation-timing-function: ease-in-out;
	animation-iteration-count: infinite;
}

@keyframes spinner-rotation {
	0% {
		transform: rotate(0deg);
	}
	100% {
		transform: rotate(360deg);
	}
}

.chat-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin: 0 0 10px 0;
}

/* Landing page styles */
.landing-container {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	min-height: 400px;
	padding: 40px 20px;
	background: white;
	border-radius: 8px;
	box-shadow: 0 2px 8px rgba(0,0,0,0.1);
	margin: 20px auto;
	max-width: 600px;
}

.youtube-logo {
	width: 80px;
	height: 56px;
	margin-bottom: 20px;
	background: url('../images/youtube.png') center/contain no-repeat;
}

.landing-title {
	font-size: 24px;
	font-weight: bold;
	margin-bottom: 10px;
	color: #333;
}

.landing-subtitle {
	font-size: 16px;
	color: #666;
	margin-bottom: 30px;
}

.auth-section {
	text-align: center;
	margin-bottom: 30px;
}

.landing-description {
	font-size: 14px;
	color: #666;
	text-align: center;
	line-height: 1.6;
	margin: 20px 0;
	max-width: 500px;
}

.auth.has-token .landing-container {
	align-items: flex-start;
	justify-content: flex-start;
	min-height: auto;
	padding: 20px;
}
.auth.has-token .landing-title,
.auth.has-token .landing-subtitle,
.auth.has-token .landing-description,
.auth.has-token .youtube-logo,
.auth.has-token .credentials-details {
	display: none;
}
.auth.has-token .landing-container {
	box-shadow: none;
	background: transparent;
	padding: 10px 0;
}
.auth.has-token .auth-section {
	margin-bottom: 10px;
}

.credentials-details {
    width: 100%;
    max-width: 640px;
}
.credentials-form {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 10px;
}
.credentials-form label {
    font-size: 12px;
    color: #5f6368;
}
.credentials-form input {
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}
.credentials-actions {
    display: flex;
    gap: 8px;
    margin-top: 6px;
}
.credentials-help {
    font-size: 12px;
    color: #5f6368;
}
.credentials-help code {
    display: inline-block;
    background: #f1f3f4;
    padding: 4px 6px;
    border-radius: 4px;
    margin: 6px 0;
}
.credentials-container {
    background: white;
    padding: 12px;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
.credentials-form.inline input { width: 100%; }

.policy-footer {
	position: fixed;
	bottom: 0;
	left: 0;
	right: 0;
	background: white;
	border-top: 1px solid #e0e0e0;
	padding: 15px;
	text-align: center;
	font-size: 13px;
	z-index: 100;
}

.policy-footer a {
	color: #1a73e8;
	text-decoration: none;
	margin: 0 10px;
}

.policy-footer a:hover {
	text-decoration: underline;
}

body:has(.auth:not(.hidden)) {
	padding-bottom: 60px; /* Make room for fixed footer only during sign-in */
}

@media (max-width: 768px) {
	.landing-container {
		margin: 10px;
	}
	.policy-footer {
		font-size: 12px;
		padding: 12px 10px;
	}
	.policy-footer a {
		margin: 0 5px;
		display: inline-block;
		line-height: 1.5;
	}
	/* Stack layout on mobile when socket is visible */
	body:has(.socket:not(.hidden)) .container {
		grid-template-columns: 1fr;
	}
	.sidebar {
		order: 2;
		margin-top: 20px;
	}
}

/* Dark mode styles */
@media (prefers-color-scheme: dark) {
    body {
        background-color: #181818;
        color: #f1f1f1;
    }
    .channel-header,
    .stats-container,
    .chat-container,
    .permissions-container,
    .recent-events,
    .credentials-container,
    .landing-container {
        background: #212121 !important;
        box-shadow: 0 1px 3px rgba(0,0,0,0.4);
    }
    .stat-box {
        background: #303030;
    }
    .stat-label {
        color: #aaaaaa;
    }
    .channel-input,
    .chat-input input,
    .credentials-form input {
        background: #303030;
        border-color: #404040;
        color: #f1f1f1;
    }
    .channel-input::placeholder,
    .chat-input input::placeholder,
    .credentials-form input::placeholder {
        color: #888888;
    }
    .event-item {
        border-bottom-color: #404040;
    }
    .auth-method-selector {
        background: rgba(255, 255, 255, 0.08);
    }
    .auth-method-label,
    .credentials-form label,
    .credentials-help {
        color: #aaaaaa;
    }
    .auth-method-option {
        color: #f1f1f1;
    }
    .header-item span:last-child,
    #current-user,
    #current-channel,
    .target-text {
        color: #f1f1f1;
    }
    .stats-container h3,
    .chat-container h3,
    .recent-events h4,
    .permissions-header {
        color: #f1f1f1;
    }
    #textarea div {
        color: #f1f1f1;
    }
    .landing-title {
        color: #f1f1f1;
    }
    .landing-subtitle,
    .landing-description {
        color: #aaaaaa;
    }
    .quota-warning {
        background: #3d3200;
        border-color: #665500;
        color: #f1f1f1;
    }
    .custom-cred-indicator {
        color: #8ab4f8;
    }
    .credentials-help code {
        background: #303030;
        color: #f1f1f1;
    }
    .policy-footer {
        background: #212121;
        border-top-color: #404040;
    }
    .policy-footer a {
        color: #8ab4f8;
    }
    .poll-spinner {
        border-color: rgba(255, 0, 0, 0.2);
        border-top-color: #FF0000;
    }
    .poll-spinner-container {
        color: #aaaaaa;
    }
}
