/* === ChuTalk Rooms - 中部特機産業スタイル === */
/* 通信の総合サービス - 地域密着 */

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --primary: #e7ae00;
  --primary-dark: #c99600;
  --primary-light: #ffd740;
  --navy: #14328c;
  --navy-dark: #0d2266;
  --accent: #fff8e1;
  --success: #28a745;
  --danger: #dc3545;
  --white: #ffffff;
  --gray-50: #fafafa;
  --gray-100: #f5f5f5;
  --gray-200: #eeeeee;
  --gray-300: #dddddd;
  --gray-400: #aaaaaa;
  --gray-500: #888888;
  --gray-600: #666666;
  --gray-700: #444444;
  --gray-800: #333333;
  --gray-900: #222222;
  --shadow: 0 2px 8px rgba(0,0,0,0.1);
  --shadow-lg: 0 4px 16px rgba(0,0,0,0.12);
  --radius: 5px;
}

html, body {
  height: 100%;
  font-family: 'Hiragino Kaku Gothic ProN', 'Hiragino Sans', 'Meiryo', sans-serif;
  background: var(--white);
  color: var(--gray-800);
  font-size: 14px;
  line-height: 1.6;
}

/* === Screens === */
.screen {
  display: none;
  min-height: 100vh;
}
.screen.active {
  display: flex;
}

/* === Buttons === */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 24px;
  border: none;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: var(--gray-900);
  box-shadow: 0 2px 8px rgba(231, 174, 0, 0.3);
}
.btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(231, 174, 0, 0.4);
}

.btn-secondary {
  background: var(--white);
  color: var(--gray-700);
  border: 2px solid var(--primary);
}
.btn-secondary:hover:not(:disabled) {
  background: var(--accent);
}

.btn-danger {
  background: var(--danger);
  color: var(--white);
}
.btn-danger:hover:not(:disabled) {
  opacity: 0.9;
}

.btn-block {
  width: 100%;
}

.btn-large {
  padding: 16px 32px;
  font-size: 15px;
}

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  background: transparent;
  border: none;
  border-radius: var(--radius);
  color: var(--gray-500);
  cursor: pointer;
  transition: all 0.2s ease;
}
.btn-icon:hover {
  background: var(--accent);
  color: var(--primary-dark);
}

/* === Corporate Header === */
.corporate-header {
  background: linear-gradient(135deg, var(--gray-900) 0%, var(--gray-800) 100%);
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.corporate-logo {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-mark {
  width: 44px;
  height: 44px;
  background: var(--primary);
  color: var(--gray-900);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(231, 174, 0, 0.4);
}

.logo-text {
  color: var(--white);
  line-height: 1.3;
}

.logo-main {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.logo-sub {
  font-size: 11px;
  color: var(--primary);
  font-weight: 500;
}

.header-tagline {
  background: rgba(231, 174, 0, 0.15);
  border: 1px solid rgba(231, 174, 0, 0.3);
  padding: 6px 14px;
  border-radius: 20px;
}

.header-tagline span {
  color: var(--primary);
  font-size: 12px;
  font-weight: 600;
}

/* === Home Screen === */
.home-container {
  width: 100%;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, var(--gray-50) 0%, var(--white) 50%, var(--gray-50) 100%);
}

.home-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
}

/* === Hero Section === */
.hero-section {
  text-align: center;
  margin-bottom: 32px;
}

.hero-icon {
  width: 80px;
  height: 80px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
  color: var(--gray-900);
  box-shadow: 0 4px 20px rgba(231, 174, 0, 0.3);
}

.hero-title {
  font-size: 28px;
  font-weight: 700;
  color: var(--gray-800);
  margin-bottom: 8px;
}

.hero-subtitle {
  font-size: 15px;
  color: var(--gray-600);
  margin-bottom: 20px;
}

.hero-features {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}

.feature-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--white);
  border: 1px solid var(--gray-200);
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 12px;
  color: var(--gray-700);
  font-weight: 500;
}

.feature-badge svg {
  color: var(--primary-dark);
}

/* === Home Card === */
.home-card {
  width: 100%;
  max-width: 420px;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  padding: 32px;
  position: relative;
  overflow: hidden;
}

.home-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--primary) 0%, var(--primary-dark) 100%);
}

.card-section {
  margin-bottom: 20px;
}
.card-section:last-child {
  margin-bottom: 0;
}

.card-divider {
  display: flex;
  align-items: center;
  margin: 24px 0;
  color: var(--gray-400);
  font-size: 13px;
}
.card-divider::before,
.card-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--gray-200);
}
.card-divider span {
  padding: 0 16px;
}

.input-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 6px;
}

.input-group {
  display: flex;
  gap: 8px;
}

.input-group input {
  flex: 1;
}

input[type="text"] {
  padding: 12px 14px;
  border: 2px solid var(--gray-200);
  border-radius: var(--radius);
  font-size: 14px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
input[type="text"]:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(231, 174, 0, 0.15);
}
input[type="text"]::placeholder {
  color: var(--gray-400);
}

.input-full {
  width: 100%;
}

#input-room-code {
  font-family: 'Menlo', 'Consolas', monospace;
  font-size: 18px;
  letter-spacing: 4px;
  text-align: center;
  font-weight: 600;
}

/* === Footer === */
.home-footer {
  padding: 20px 24px;
  background: var(--gray-900);
  color: var(--white);
}

.footer-info {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-bottom: 8px;
}

.footer-company-name {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
}

.footer-company-name svg {
  color: var(--primary);
}

.footer-areas {
  font-size: 12px;
  color: var(--gray-400);
  padding-left: 16px;
  border-left: 1px solid var(--gray-600);
}

.footer-services {
  text-align: center;
  font-size: 11px;
  color: var(--gray-500);
  letter-spacing: 1px;
}

/* === Lobby Screen === */
.lobby-container {
  width: 100%;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--gray-50);
}

.lobby-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
}

.btn-back {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 12px;
  background: transparent;
  border: none;
  border-radius: var(--radius);
  font-size: 14px;
  color: var(--gray-600);
  cursor: pointer;
  font-weight: 500;
}
.btn-back:hover {
  background: var(--accent);
  color: var(--primary-dark);
}

.brand-small {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--gray-700);
}

.brand-logo-small {
  width: 28px;
  height: 28px;
  background: var(--primary);
  color: var(--gray-900);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lobby-main {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.lobby-card {
  width: 100%;
  max-width: 500px;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  padding: 32px;
}

.lobby-title {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 18px;
  font-weight: 700;
  color: var(--gray-800);
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 3px solid var(--primary);
}

.lobby-title svg {
  color: var(--primary-dark);
}

.meeting-info {
  background: linear-gradient(135deg, var(--accent) 0%, rgba(231, 174, 0, 0.1) 100%);
  border: 1px solid rgba(231, 174, 0, 0.3);
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 24px;
}

.meeting-code-section,
.meeting-link-section {
  margin-bottom: 16px;
}
.meeting-link-section {
  margin-bottom: 0;
}

.meeting-info label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--gray-600);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.meeting-code-display {
  display: flex;
  align-items: center;
  gap: 8px;
}

.meeting-code-display span {
  font-family: 'Menlo', 'Consolas', monospace;
  font-size: 32px;
  font-weight: 700;
  letter-spacing: 8px;
  color: var(--gray-900);
}

.meeting-link-display {
  display: flex;
  gap: 8px;
}

.meeting-link-display input {
  flex: 1;
  padding: 10px 12px;
  background: var(--white);
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
  font-size: 12px;
  color: var(--gray-600);
}

.preview-section {
  margin-bottom: 24px;
}

.preview-video-wrapper {
  position: relative;
  width: 100%;
  aspect-ratio: 16/9;
  background: var(--gray-900);
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 16px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.preview-video-wrapper video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1);
}

.preview-avatar {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--gray-800) 0%, var(--gray-900) 100%);
}

.preview-avatar span {
  width: 80px;
  height: 80px;
  background: var(--primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  font-weight: 700;
  color: var(--gray-900);
  box-shadow: 0 4px 12px rgba(231, 174, 0, 0.4);
}

.preview-controls {
  display: flex;
  justify-content: center;
  gap: 16px;
}

.btn-control {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  background: var(--gray-100);
  border: 2px solid var(--gray-300);
  border-radius: 50%;
  color: var(--gray-600);
  cursor: pointer;
  transition: all 0.2s ease;
}
.btn-control:hover {
  background: var(--gray-200);
}
.btn-control.active {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--gray-900);
}
.btn-control.active:hover {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
}
.btn-control.muted {
  background: var(--danger);
  border-color: var(--danger);
  color: var(--white);
}
.btn-control .icon-off {
  display: none;
}
.btn-control.muted .icon-on {
  display: none;
}
.btn-control.muted .icon-off {
  display: block;
}

/* === Room Screen === */
#screen-room {
  display: none;
  background: var(--gray-900);
}
#screen-room.active {
  display: block;
}

.room-layout {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

.room-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 16px;
  background: linear-gradient(135deg, var(--gray-900) 0%, var(--gray-800) 100%);
  border-bottom: 2px solid var(--primary);
  flex-shrink: 0;
}

.room-info {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--white);
  font-size: 13px;
  font-weight: 500;
}

.brand-mini {
  display: flex;
}

.brand-logo-mini {
  width: 28px;
  height: 28px;
  background: var(--primary);
  color: var(--gray-900);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.room-code {
  font-family: 'Menlo', 'Consolas', monospace;
  background: rgba(231, 174, 0, 0.2);
  border: 1px solid rgba(231, 174, 0, 0.4);
  padding: 4px 12px;
  border-radius: 4px;
  color: var(--primary);
  font-weight: 600;
}

.room-separator {
  color: var(--gray-600);
}

.participant-count {
  color: var(--gray-400);
}

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

.btn-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: var(--radius);
  color: var(--white);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}
.btn-header:hover {
  background: rgba(255,255,255,0.2);
}
.btn-leave {
  background: var(--danger);
  border-color: var(--danger);
}
.btn-leave:hover {
  background: #c82333;
}

.chat-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  background: var(--primary);
  border-radius: 9px;
  font-size: 11px;
  font-weight: 700;
  color: var(--gray-900);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
}
.chat-badge.hidden {
  display: none;
}

/* === Video Grid === */
.video-grid-container {
  flex: 1;
  padding: 12px;
  overflow: hidden;
}

.video-grid {
  display: grid;
  gap: 8px;
  height: 100%;
  grid-template-columns: 1fr;
}

.video-grid[data-count="2"] {
  grid-template-columns: repeat(2, 1fr);
}
.video-grid[data-count="3"],
.video-grid[data-count="4"] {
  grid-template-columns: repeat(2, 1fr);
  grid-template-rows: repeat(2, 1fr);
}
.video-grid[data-count="5"],
.video-grid[data-count="6"] {
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(2, 1fr);
}
.video-grid[data-count="7"],
.video-grid[data-count="8"],
.video-grid[data-count="9"] {
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
}
.video-grid[data-count="10"] {
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(3, 1fr);
}

.video-tile {
  position: relative;
  background: var(--gray-800);
  border-radius: 8px;
  overflow: hidden;
  border: 2px solid transparent;
}

.video-tile.speaking {
  border-color: var(--primary);
  box-shadow: 0 0 20px rgba(231, 174, 0, 0.5);
}

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

.video-tile.local video {
  transform: scaleX(-1);
}

.video-tile .avatar {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: none;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--gray-800) 0%, var(--gray-900) 100%);
}

.video-tile .avatar span {
  width: 64px;
  height: 64px;
  background: var(--primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: 700;
  color: var(--gray-900);
}

.video-tile .name-tag {
  position: absolute;
  bottom: 8px;
  left: 8px;
  background: rgba(0,0,0,0.75);
  padding: 4px 12px;
  border-radius: 4px;
  font-size: 12px;
  color: var(--white);
  font-weight: 500;
}

.video-tile .status-icons {
  position: absolute;
  top: 8px;
  right: 8px;
  display: flex;
  gap: 4px;
}

.video-tile .status-icon {
  width: 28px;
  height: 28px;
  background: rgba(0,0,0,0.6);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}

.video-tile .status-icon.muted {
  background: var(--danger);
}

/* === Control Bar === */
.control-bar {
  display: flex;
  justify-content: center;
  padding: 16px;
  background: rgba(0,0,0,0.9);
  flex-shrink: 0;
}

.control-group {
  display: flex;
  gap: 16px;
}

.btn-control-main {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 14px 28px;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 8px;
  color: var(--white);
  cursor: pointer;
  transition: all 0.2s ease;
}
.btn-control-main:hover {
  background: rgba(255,255,255,0.2);
}
.btn-control-main.active {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--gray-900);
}
.btn-control-main.muted {
  background: var(--danger);
  border-color: var(--danger);
  color: var(--white);
}
.btn-control-main .icon-off {
  display: none;
}
.btn-control-main.muted .icon-on {
  display: none;
}
.btn-control-main.muted .icon-off {
  display: block;
}

.control-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.5px;
}

/* === Chat Panel === */
.chat-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: 360px;
  height: 100%;
  background: var(--white);
  display: flex;
  flex-direction: column;
  box-shadow: -4px 0 20px rgba(0,0,0,0.2);
  z-index: 100;
}
.chat-panel.hidden {
  display: none;
}

.chat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  background: var(--gray-900);
  color: var(--white);
}
.chat-header h3 {
  font-size: 15px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}
.chat-header h3::before {
  content: '';
  width: 4px;
  height: 16px;
  background: var(--primary);
  border-radius: 2px;
}
.chat-header .btn-icon {
  color: var(--white);
}
.chat-header .btn-icon:hover {
  background: rgba(255,255,255,0.15);
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  background: var(--gray-50);
}

.chat-message {
  margin-bottom: 16px;
}
.chat-message .sender {
  font-size: 12px;
  font-weight: 600;
  color: var(--primary-dark);
  margin-bottom: 4px;
}
.chat-message .text {
  background: var(--white);
  border: 1px solid var(--gray-200);
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 14px;
  color: var(--gray-800);
  line-height: 1.5;
}
.chat-message.self .sender {
  text-align: right;
}
.chat-message.self .text {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--gray-900);
}
.chat-message .time {
  font-size: 11px;
  color: var(--gray-400);
  margin-top: 4px;
}
.chat-message.self .time {
  text-align: right;
}

.chat-input {
  display: flex;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid var(--gray-200);
  background: var(--white);
}
.chat-input input {
  flex: 1;
  padding: 10px 12px;
  border: 2px solid var(--gray-200);
  border-radius: var(--radius);
  font-size: 14px;
}
.chat-input input:focus {
  outline: none;
  border-color: var(--primary);
}

.btn-send {
  width: 44px;
  height: 44px;
  background: var(--primary);
  border: none;
  border-radius: var(--radius);
  color: var(--gray-900);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease;
}
.btn-send:hover {
  background: var(--primary-dark);
}

/* === Modal === */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
}
.modal.hidden {
  display: none;
}

.modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.6);
}

.modal-content {
  position: relative;
  background: var(--white);
  padding: 32px;
  border-radius: 12px;
  text-align: center;
  max-width: 380px;
  width: 90%;
  box-shadow: 0 20px 40px rgba(0,0,0,0.3);
}
.modal-content::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--danger);
  border-radius: 12px 12px 0 0;
}
.modal-content h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--gray-800);
  margin-bottom: 24px;
}

.modal-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
}
.modal-actions .btn {
  min-width: 120px;
}

/* === Responsive === */
@media (max-width: 640px) {
  .corporate-header {
    padding: 10px 16px;
  }

  .logo-text {
    display: none;
  }

  .header-tagline {
    display: none;
  }

  .hero-section {
    margin-bottom: 24px;
  }

  .hero-icon {
    width: 64px;
    height: 64px;
  }

  .hero-icon svg {
    width: 32px;
    height: 32px;
  }

  .hero-title {
    font-size: 22px;
  }

  .home-card,
  .lobby-card {
    padding: 24px;
  }

  .meeting-code-display span {
    font-size: 24px;
    letter-spacing: 6px;
  }

  .chat-panel {
    width: 100%;
  }

  .video-grid {
    gap: 4px;
  }

  .control-bar {
    padding: 12px;
  }

  .btn-control-main {
    padding: 12px 20px;
  }

  .room-header {
    padding: 8px 12px;
  }

  .btn-header span:not(.chat-badge) {
    display: none;
  }

  .footer-info {
    flex-direction: column;
    gap: 8px;
  }

  .footer-areas {
    border-left: none;
    padding-left: 0;
  }
}
