* { box-sizing: border-box; }

[hidden] { display: none !important; }

body {
  margin: 0;
  font-family: var(--font-family);
  background: var(--bg-page);
  color: var(--text-primary);
}

button {
  font-family: inherit;
  cursor: pointer;
}

input[type="text"] {
  font-family: inherit;
  background: var(--bg-surface-2);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  border-radius: var(--radius-sm);
  padding: 0.55rem 0.7rem;
}

input[type="text"]::placeholder {
  color: var(--text-muted);
}

input[type="text"]:focus {
  outline: none;
  border-color: var(--accent-purple);
}

.btn-primary {
  background: var(--accent-purple);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 0.55rem 1rem;
  font-weight: 600;
  white-space: nowrap;
}

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

.icon-btn {
  background: var(--bg-surface-2);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.9rem;
  white-space: nowrap;
}

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

.icon-btn.danger {
  background: var(--accent-danger);
  border-color: var(--accent-danger);
  color: #fff;
}

/* Topbar */
.topbar {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  padding: 0.7rem 1rem;
}

.brand-logo {
  width: 28px;
  height: 28px;
  border-radius: 8px;
}

.brand-name {
  font-weight: 700;
  font-size: 1.05rem;
}

.status-pill {
  margin: 0 0 0 auto;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.sidebar-toggle {
  display: none;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 1.2rem;
  padding: 0.2rem 0.4rem;
}

/* Layout */
.layout {
  display: flex;
  height: calc(100vh - 58px);
}

.sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  background: var(--bg-surface);
  border-right: 1px solid var(--border-color);
  padding: 1rem;
  overflow-y: auto;
}

#create-room-form {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.room-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.room-list li {
  padding: 0.6rem 0.7rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-secondary);
}

.room-list li:hover {
  background: var(--bg-surface-2);
}

.room-list li.active {
  background: var(--accent-purple-soft);
  color: var(--text-primary);
}

.room-list li small {
  color: var(--text-muted);
  white-space: nowrap;
}

/* Main room column */
.room {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.room-header {
  padding: 0.9rem 1.2rem;
  border-bottom: 1px solid var(--border-color);
}

.room-header h2 {
  margin: 0;
  font-size: 1.1rem;
}

.mobile-tabs {
  display: none;
}

.room-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 1rem 1.2rem;
  gap: 1rem;
  overflow-y: auto;
}

/* Video */
.video-panel {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.6rem;
}

.video-tile {
  position: relative;
  background: #000;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  aspect-ratio: 4 / 3;
}

.video-tile video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.video-tile .tile-label {
  position: absolute;
  bottom: 6px;
  left: 8px;
  color: #fff;
  font-size: 0.75rem;
  background: rgba(0, 0, 0, 0.45);
  padding: 0.1rem 0.4rem;
  border-radius: var(--radius-sm);
}

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

.call-controls {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* Chat */
.chat-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 200px;
}

.messages {
  flex: 1;
  overflow-y: auto;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.7rem;
  margin-bottom: 0.6rem;
}

.msg {
  margin: 0.3rem 0;
  color: var(--text-secondary);
}

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

.msg.mine {
  text-align: right;
}

.message-form {
  display: flex;
  gap: 0.5rem;
}

.message-form input {
  flex: 1;
  min-width: 0;
}

/* Gifts placeholder panel */
.gifts-panel {
  width: var(--gifts-width);
  flex-shrink: 0;
  background: var(--bg-surface);
  border-left: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
}

.gifts-placeholder {
  text-align: center;
  color: var(--text-muted);
}

.gifts-icon {
  font-size: 2rem;
  display: block;
  margin-bottom: 0.4rem;
}

.gifts-placeholder p {
  margin: 0;
  color: var(--text-secondary);
  font-weight: 600;
}

.sidebar-backdrop {
  display: none;
}
