/* Custom styles for StreamPush Backup Server */
/* Using StreamPush framework base */

body {
  min-height: 100vh;
}

.container {
  max-width: 1600px;
}

/* Header */
header {
  padding: 16px 0;
}

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

.header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.header-logo {
  height: 32px;
  width: auto;
}

.logo-button {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
}

.logo-button:focus-visible {
  outline: 2px solid #2caa03;
  outline-offset: 4px;
  border-radius: 4px;
}

.header-title {
  font-size: 24px;
  font-weight: 700;
  color: #234a52;
}

.bandwidth-stats {
  display: flex;
  gap: 24px;
  margin-left: auto;
  margin-right: 24px;
  font-size: 12px;
  color: #234a52;
  font-variant-numeric: tabular-nums;
}

.bandwidth-item {
  display: flex;
  align-items: center;
  gap: 4px;
}

.connection-status {
  font-size: 12px;
  color: #a0bcc0;
  font-weight: 500;
  transition: color 0.2s ease;
}

.connection-status.connected {
  color: #2caa03;
}

.connection-status.disconnected {
  color: #e54545;
}

.status-group {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.api-error {
  font-size: 12px;
  font-weight: 600;
  color: #e54545;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.header-logout {
  font-size: 12px;
  font-weight: 600;
  color: #466e77;
  text-decoration: none;
  padding: 6px 10px;
  border: 1px solid #e1eeef;
  border-radius: 8px;
  background: white;
  line-height: 1;
}

.header-logout:hover {
  border-color: #2caa03;
  color: #2caa03;
}

.header-logout:focus-visible {
  outline: 2px solid #2caa03;
  outline-offset: 2px;
}

/* Auth pages (login/logout) */
.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 12px;
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: white;
  border-radius: 10px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.10);
  overflow: hidden;
}

.auth-card__header {
  padding: 18px;
  border-bottom: 1px solid #e1eeef;
  display: flex;
  align-items: center;
  gap: 10px;
}

.auth-logo {
  height: 28px;
  width: auto;
}

.auth-body {
  padding: 18px;
}

.auth-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
}

.auth-label {
  font-size: 12px;
  font-weight: 600;
  color: #234a52;
}

.auth-input {
  border: 1px solid #e1eeef;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 14px;
  outline: none;
}

.auth-input:focus {
  border-color: #2caa03;
  box-shadow: 0 0 0 3px rgba(44, 170, 3, 0.15);
}

.auth-actions {
  margin-top: 14px;
  display: flex;
  gap: 10px;
}

.auth-actions .btn {
  flex: 1;
  padding: 10px 12px;
  font-size: 14px;
}

.auth-actions form {
  flex: 1;
  margin: 0;
}

.auth-actions form .btn {
  width: 100%;
}

.auth-error {
  display: none;
  margin-bottom: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid rgba(229, 69, 69, 0.25);
  background: rgba(229, 69, 69, 0.08);
  color: #e54545;
  font-size: 13px;
  font-weight: 600;
}

.auth-error.is-visible {
  display: block;
}

/* Server cards */
.server-card {
  background: #ccdfe0;
  border-radius: 6px;
  padding: 0;
  margin-bottom: 24px;
}

.server-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: #ccdfe0;
  border-radius: 6px;
}

.server-title-wrapper {
  display: flex;
  align-items: center;
  gap: 10px;
}

.server-title {
  font-size: 16px;
  font-weight: 600;
  color: #234a52;
  margin: 0;
}

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

/* Status dots */
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

.status-active {
  background: #2caa03;
}

.status-inactive {
  background: #a0bcc0;
}

/* Channel rows */
.channels-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.channel-row {
  background: white;
  margin: 0 16px 16px 16px;
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
}

.channel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: white;
  border-bottom: 1px solid #e1eeef;
}

.channel-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.channel-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.recording-time {
  font-size: 13px;
  font-weight: 600;
  color: #234a52;
  font-variant-numeric: tabular-nums;
}

.latest-recording {
  font-size: 12px;
  color: #729197;
  text-transform: lowercase;
}

.btn-outline-orange {
  background: transparent;
  border: 1px solid #f7941d;
  color: #f7941d;
  pointer-events: none;
}

.btn-outline-blue {
  background: transparent;
  border: 1px solid #2caa03;
  color: #2caa03;
  cursor: pointer;
}

.btn-outline-blue:hover {
  background: #2caa03;
  color: white;
}

/* Modal */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-content {
  background: white;
  border-radius: 8px;
  max-width: 900px;
  width: 90%;
  max-height: 90vh;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  border-bottom: 1px solid #e1eeef;
}

.modal-title {
  font-size: 18px;
  font-weight: 700;
  color: #234a52;
  margin: 0;
}

.modal-close {
  background: none;
  border: none;
  font-size: 32px;
  color: #729197;
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  line-height: 28px;
  text-align: center;
}

.modal-close:hover {
  color: #234a52;
}

.modal-body {
  padding: 0;
}

.preview-video {
  width: 100%;
  height: auto;
  display: block;
  background: #000;
}

.slot-badge {
  display: flex;
  align-items: center;
  gap: 4px;
  color: #729197;
  font-size: 13px;
}

.channel-name {
  color: #234a52;
  font-weight: 700;
  font-size: 15px;
}

/* Sub-streams */
.channel-streams {
  background: #f8fcfc;
}

.stream-subitem {
  display: flex;
  align-items: center;
  padding: 8px 16px;
  border-top: 1px solid #e1eeef;
  font-size: 13px;
}

.stream-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 400px;
}

.stream-indent {
  width: 20px;
}

.stream-name {
  color: #466e77;
  font-size: 13px;
}

.stream-link {
  text-decoration: none;
  color: #466e77;
  transition: color 0.15s ease;
}

.stream-link:hover {
  color: #2caa03;
  text-decoration: underline;
}

.stream-stats {
  display: flex;
  align-items: center;
  gap: 20px;
  flex: 1;
  padding: 0 16px;
}

.stat-value {
  font-size: 12px;
  color: #234a52;
  font-family: 'SF Mono', 'Monaco', 'Courier New', monospace;
  min-width: 75px;
}

.stream-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

/* Buttons */
.btn-sm {
  padding: 4px 10px;
  font-size: 12px;
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 48px 16px;
  color: #729197;
}

/* Connection status */
#connection-status.connected {
  background: #2caa03 !important;
}

#connection-status.connecting {
  background: #f7941d !important;
}

#connection-status.disconnected {
  background: #e54545 !important;
}

/* Responsive */
@media (max-width: 768px) {
  .header-content {
    flex-wrap: wrap;
    gap: 8px;
  }

  .bandwidth-stats {
    order: 3;
    width: 100%;
    margin: 8px 0 0 0;
    justify-content: center;
    gap: 16px;
  }

  .status-group {
    margin-left: auto;
  }

  .server-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .server-actions {
    width: 100%;
  }

  .server-actions .btn {
    flex: 1;
  }

  .channel-header {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .channel-left {
    flex-wrap: wrap;
  }

  .channel-actions {
    justify-content: flex-end;
  }

  .stream-subitem {
    flex-wrap: wrap;
    gap: 8px;
  }

  .stream-left {
    flex: 1 1 100%;
    min-width: 0;
  }

  .stream-stats {
    flex: 1 1 auto;
    padding: 0;
    gap: 12px;
  }

  .stat-value {
    min-width: 60px;
  }

  /* Improve readability on mobile (framework uses light gray for these) */
  .stream-stats .text-gray-500 {
    color: #234a52 !important;
  }

  .stream-actions {
    flex: 0 0 auto;
  }

  .channel-row {
    margin: 0 8px 12px 8px;
  }

  .stream-progress {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 480px) {
  .container {
    padding-left: 8px;
    padding-right: 8px;
  }

  .bandwidth-stats {
    font-size: 11px;
    gap: 10px;
  }

  .channel-name {
    font-size: 14px;
  }

  .stream-left {
    gap: 6px;
  }

  .stream-indent {
    display: none;
  }

  .stream-stats {
    gap: 8px;
  }

  .stat-value {
    font-size: 11px;
    min-width: 50px;
  }

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