:root {
  --background: #0E0E10;
  --card-bg: #18181B;
  --border: #2E2E33;
  --border-hover: #3E3E44;
  --primary: #9146FF;
  --primary-hover: #A970FF;
  --text-primary: #EFEFF1;
  --text-secondary: #B7A79F;
  --text-muted: #757575;
  --danger: #FF4F4D;
  --danger-hover: #FF6B68;
  --success: #00C853;
  --hover-bg: rgba(255, 255, 255, 0.05);
  --hover-bg-subtle: var(--hover-bg-subtle);
  --overlay-bg: rgba(0, 0, 0, 0.5);
  --overlay-dark: rgba(0, 0, 0, 0.7);
  --overlay-darker: rgba(0, 0, 0, 0.9);
  --black: #000;
}

html::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

html::-webkit-scrollbar-track {
  background: #0E0E10;
}

html::-webkit-scrollbar-thumb {
  background: #2E2E33;
}

html::-webkit-scrollbar-thumb:hover {
  background: #3E3E44;
}

.sidebar-list::-webkit-scrollbar {
  width: 8px;
}

.sidebar-list::-webkit-scrollbar-track {
  background: #18181B;
}

.sidebar-list::-webkit-scrollbar-thumb {
  background: #2E2E33;
  border-radius: 4px;
}

.sidebar-list::-webkit-scrollbar-thumb:hover {
  background: #3E3E44;
}

html, body {
  color-scheme: dark !important;
  forced-color-adjust: none;
}

html {
  background-color: #0E0E10 !important;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0;
  background: var(--background) !important;
  color: var(--text-primary) !important;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  min-height: 100vh;
}

input,
select,
button,
textarea {
  background: var(--card-bg) !important;
  color: var(--text-primary) !important;
  border: 1px solid var(--border) !important;
  border-radius: 6px;
  padding: 10px 14px;
  font-size: 14px;
}

input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
textarea:-webkit-autofill,
textarea:-webkit-autofill:hover,
textarea:-webkit-autofill:focus,
select:-webkit-autofill,
select:-webkit-autofill:hover,
select:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--text-primary) !important;
  -webkit-box-shadow: 0 0 0px 1000px var(--card-bg) inset !important;
  transition: background-color 5000s ease-in-out 0s;
  caret-color: var(--text-primary);
}

input:not([type="checkbox"]):focus,
select:focus,
button:focus-visible {
  outline: none;
  border-color: var(--primary);
}

input::placeholder {
  color: var(--text-muted);
}

select {
  cursor: pointer;
}

button {
  cursor: pointer;
  font-weight: 600;
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none !important;
  margin: 0 !important;
  display: none !important;
}

input[type="number"] {
  -moz-appearance: textfield !important;
}

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

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

input[type="checkbox"] {
  appearance: none;
  width: 18px;
  height: 18px;
  border: 2px solid var(--border);
  border-radius: 4px;
  cursor: pointer;
  position: relative;
}

input[type="checkbox"]:checked {
  background: var(--primary);
  border-color: var(--primary);
}

input[type="checkbox"]:checked::after {
  content: '';
  position: absolute;
  left: 5px;
  top: 2px;
  width: 5px;
  height: 9px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

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

th,
td {
  text-align: left;
  padding: 12px;
  border-bottom: 1px solid var(--border);
}

th {
  background: var(--card-bg);
  font-weight: 600;
  color: var(--text-secondary);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

th a {
  color: var(--text-secondary);
  cursor: pointer;
}

th a:hover {
  color: var(--primary);
}

tbody tr:hover {
  background: var(--hover-bg-subtle);
}

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

.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.search-form {
  margin-bottom: 2rem;
}

.search-form-row {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 1.5rem;
}

.search-input-group {
  flex: 1;
  min-width: 250px;
}

.search-input-wrapper {
  position: relative;
}

.search-input-wrapper .bi-at,
.search-input-wrapper .bi-search {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
}

.search-input-wrapper input {
  width: 100%;
  padding-left: 3rem;
  height: 38px;
  box-sizing: border-box;
}

.search-submit-btn {
  padding: 0.625rem 2rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 180px;
  justify-content: center;
  height: 38px;
  box-sizing: border-box;
}

.datetime-picker-button {
  width: 220px;
  background: var(--card-bg);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.625rem 1rem;
  text-align: left;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  height: 38px;
  box-sizing: border-box;
  font-weight: normal;
}

.search-error {
  color: var(--danger);
  font-size: 0.875rem;
  margin-top: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.filter-bar {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.75rem;
  margin-top: 1rem;
}

.filter-bar input,
.filter-bar .datetime-picker-button {
  width: 100%;
  box-sizing: border-box;
}

.filter-bar input,
.filter-bar .datetime-picker-button {
  height: 38px;
  box-sizing: border-box;
  transition: border-color 0.15s ease;
  font-weight: normal;
}

.filter-bar input:hover,
.filter-bar .datetime-picker-button:hover {
  border-color: var(--primary);
}

.btn-icon-only {
  padding: 0;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.15s ease;
}

.btn-icon-only:hover {
  border-color: var(--danger);
}

.btn-icon-only i {
  font-size: 1rem;
}

.pagination-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  justify-content: space-between;
}

.pagination-compact {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.pagination-compact-btn {
  padding: 0;
  width: 32px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-primary);
  cursor: pointer;
  box-sizing: border-box;
}

.pagination-compact-btn:hover:not(:disabled) {
  border-color: var(--primary);
}

.pagination-compact-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.pagination-compact-info {
  font-size: 0.875rem;
  color: var(--text-secondary);
  padding: 0 0.5rem;
  height: 38px;
  display: flex;
  align-items: center;
}

.clip-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.5rem;
}

.clip-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.5rem;
  display: flex;
  flex-direction: column;
  aspect-ratio: 1;
  animation: popIn 0.2s ease-out;
}

@keyframes popIn {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.clip-streamer {
  font-size: 0.65rem;
  color: var(--text-secondary);
  font-weight: 500;
  margin-top: 0.25rem;
  margin-bottom: 0.25rem;
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.clip-streamer-avatar {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  object-fit: cover;
}

.clip-title {
  color: var(--primary);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.75rem;
  margin-bottom: 0.5rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.1;
  min-height: 2rem;
}

.clip-title:hover {
  text-decoration: underline;
}

.clip-meta-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.65rem;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.clip-meta-item {
  display: flex;
  align-items: center;
  gap: 0.2rem;
}

.clip-meta-item i {
  font-size: 0.6rem;
  color: var(--text-muted);
}

.clip-actions {
  display: flex;
  gap: 0.35rem;
  margin-top: auto;
}

.clip-btn {
  flex: 1;
  padding: 0.35rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.2rem;
  font-size: 0.65rem;
  border-radius: 4px;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s ease;
}

.clip-btn i {
  font-size: 0.75rem;
}

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

.clip-btn-download:hover {
  background: var(--border);
}

.clip-btn-twitch {
  background: var(--primary);
  color: white;
  border: none;
}

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

.clip-btn:disabled {
  opacity: 0.7;
  cursor: wait;
}

.clip-thumbnail-wrapper {
  position: relative;
  cursor: pointer;
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 0.35rem;
  aspect-ratio: 16/9;
}

.clip-thumbnail-wrapper img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.clip-thumbnail-wrapper:hover img {
  opacity: 0.7;
}

.clip-play-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.clip-play-button {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  background: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
}

.clip-play-button i {
  color: white;
  font-size: 1rem;
  margin-left: 0.2rem;
}

.clip-embed-wrapper {
  position: relative;
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 0.35rem;
  aspect-ratio: 16/9;
  background: var(--black);
}

.clip-embed-wrapper iframe {
  width: 100%;
  height: 100%;
  border: none;
}

.clip-embed-close-btn {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: var(--overlay-dark);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  cursor: pointer;
  z-index: 1;
}

.clip-embed-close-btn:hover {
  background: var(--overlay-darker);
}

.no-clips {
  text-align: center;
  padding: 3rem 0;
  color: var(--text-muted);
}

.no-clips i {
  font-size: 2.5rem;
  margin-bottom: 0.75rem;
  display: block;
  opacity: 0.5;
}

.loading-state,
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 50vh;
  color: var(--text-muted);
  gap: 1rem;
  text-align: center;
}

.loading-state i,
.empty-state i {
  font-size: 2.5rem;
  opacity: 0.5;
}

.spinner {
  width: 2.5rem;
  height: 2.5rem;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.datetime-picker {
  position: relative;
}

.datetime-picker-button {
  width: 220px;
  background: var(--card-bg);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.625rem 1rem;
  text-align: left;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  font-weight: normal;
}

.datetime-picker-backdrop {
  position: fixed;
  inset: 0;
  background: var(--overlay-bg);
  backdrop-filter: blur(4px);
  z-index: 9999;
}

.datetime-picker-dropdown {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 10000;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.5rem;
  width: 450px;
}

.datetime-picker-dropdown select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  width: 100%;
  height: 32px;
  background: var(--background);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.375rem 2.5rem 0.375rem 0.75rem;
  font-size: 0.875rem;
  color: var(--text-primary);
  box-sizing: border-box;
}

.datetime-picker-dropdown select:focus {
  outline: none;
  border-color: var(--primary);
}

.datetime-picker-error {
  padding: 0.5rem 0.75rem;
  margin-bottom: 1rem;
  background: rgba(255, 79, 77, 0.1);
  border: 1px solid var(--danger);
  border-radius: 6px;
  font-size: 0.875rem;
  color: var(--danger);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.date-row,
.time-row {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.date-row {
  margin-bottom: 1rem;
}

.time-row {
  margin-bottom: 1.25rem;
}

.time-separator {
  color: var(--text-muted);
}

.actions-row {
  display: flex;
  gap: 0.5rem;
}

.btn-apply {
  flex: 1;
  padding: 0.5rem;
  font-size: 0.875rem;
  background: var(--primary);
  color: white;
  border: none;
}

.btn-clear {
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: transparent;
}

.btn-clear:hover {
  color: var(--text-primary);
  background: var(--border);
}

.relative {
  position: relative;
}

.flex-1 {
  flex: 1;
}

.relative .bi-chevron-down {
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
  font-size: 0.75rem;
}

.page-wrapper {
  display: flex;
  min-height: 100vh;
}

.page-container {
  flex: 1;
  padding: 1.5rem;
  max-width: 1600px;
  margin: 0 auto;
}

.sidebar {
  width: 260px;
  background: var(--card-bg);
  border-right: 1px solid var(--border);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 1000;
}

.sidebar::-webkit-scrollbar {
  width: 8px !important;
}

.sidebar::-webkit-scrollbar-track {
  background: #18181B !important;
}

.sidebar::-webkit-scrollbar-thumb {
  background: #2E2E33 !important;
  border-radius: 4px !important;
}

.sidebar::-webkit-scrollbar-thumb:hover {
  background: #3E3E44 !important;
}

.sidebar-header h2 {
  margin: 0;
  font-size: 1rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

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

.sidebar-refresh {
  background: transparent !important;
  border: none !important;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sidebar-refresh:hover {
  color: var(--primary);
}

.sidebar-refresh:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

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

.animate-spin {
  animation: spin 1s linear infinite;
}

.sidebar-add {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  position: relative;
}

.sidebar-add input {
  flex: 1;
  padding: 0.5rem 2.5rem 0.5rem 0.75rem;
  font-size: 0.875rem;
  height: 38px;
  box-sizing: border-box;
}

.sidebar-add-icon-btn {
  position: absolute;
  right: 0.5rem;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none !important;
  background: transparent !important;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0 !important;
}

.sidebar-add-icon-btn:hover:not(:disabled) {
  color: var(--primary);
}

.sidebar-add-icon-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.sidebar-list {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  overflow-y: auto;
  flex: 1;
}

.sidebar-item-wrapper {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.sidebar-item {
  flex: 1;
  padding: 0.5rem 0.75rem;
  background: transparent;
  border: none;
  border-radius: 6px;
  color: var(--text-primary);
  text-align: left;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
}

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

.sidebar-item.active {
  background: var(--primary) !important;
  color: white !important;
  border-color: var(--primary) !important;
}

.sidebar-item.all {
  font-weight: 500;
  padding-bottom: 0.5rem;
  margin-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.sidebar-item i {
  font-size: 1rem;
}

.sidebar-avatar {
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 50%;
  object-fit: cover;
}

.sidebar-remove {
  padding: 0.25rem;
  background: transparent !important;
  border: none !important;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sidebar-remove:hover {
  color: var(--danger);
}

.page-header {
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
  text-align: center;
}

.page-title {
  font-size: 1.875rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  margin: 0;
}

.twitch-logo {
  width: 2.5rem;
  height: 2.5rem;
}

.page-subtitle {
  color: var(--text-secondary);
  margin-top: 0.5rem;
  margin-bottom: 0;
}

.info-card {
  margin-bottom: 1.5rem;
  padding: 1rem;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.results-stats {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-bottom: 1rem;
}

.results-stats strong {
  color: var(--text-primary);
}

.results-stats a {
  color: var(--primary);
  text-decoration: none;
}

.results-stats a:hover {
  text-decoration: underline;
}

.flex {
  display: flex;
}

.flex-col {
  flex-direction: column;
}

.items-center {
  align-items: center;
}

.gap-2 {
  gap: 0.5rem;
}

.toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 2000;
  animation: slideIn 0.3s ease;
  min-width: 250px;
}

.toast-content {
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.toast-error {
  border-color: var(--danger);
}

.toast-error i {
  color: var(--danger);
}

.toast-success {
  border-color: var(--success);
}

.toast-success i {
  color: var(--success);
}

.toast-progress {
  height: 3px;
  background: var(--primary);
  transition: width 0.05s linear;
}

.toast-error .toast-progress {
  background: var(--danger);
}

.toast-success .toast-progress {
  background: var(--success);
}

@keyframes slideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.auth-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.auth-modal {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 2rem;
  width: 100%;
  max-width: 400px;
  text-align: center;
}

.auth-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.auth-header i {
  font-size: 3rem;
  color: var(--primary);
}

.auth-header h2 {
  color: var(--text-primary);
  margin: 0;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.auth-form input {
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg);
  color: var(--text-primary);
  font-size: 1rem;
}

.auth-form button {
  padding: 0.75rem;
  border: none;
  border-radius: 4px;
  background: var(--primary);
  color: white;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
}

.auth-form button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.auth-error {
  color: var(--danger);
  font-size: 0.875rem;
}
