/*=============================================================================
  voton chat account - スタイルシート (style.css)
  モダンで未来的なダーク/ライト調のデザインシステムを構築
=============================================================================*/

/* CSS変数：カラーパレット、サイズ、フォントの定義 */
:root {
    --bg-color-dark: #0f172a;
    --bg-color-panel: #1e293b;
    --text-color-main: #f8fafc;
    --text-color-sub: #94a3b8;
    --accent-color: #3b82f6;
    --accent-hover: #2563eb;
    --danger-color: #ef4444;
    --danger-hover: #dc2626;
    --border-color: #334155;
    
    /* 各種ログインボタンのブランドカラー */
    --google-color: #4285f4;
    --apple-color: #000000;
    --microsoft-color: #00a4ef;
    
    /* ロールごとの色定義 */
    --admin-color-start: #ff4b2b;
    --admin-color-end: #ff416c;
    --admin-gold: #ffd700;
    --official-color: #10b981;
    
    --font-family: 'Segoe UI', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    --sidebar-width: 300px;
}

/* スタイリッシュなライトモード用のテーマ変数（bodyに.light-themeが付与された際に適用） */
body.light-theme {
    --bg-color-dark: #f1f5f9;
    --bg-color-panel: #ffffff;
    --text-color-main: #0f172a;
    --text-color-sub: #475569;
    --border-color: #cbd5e1;
}

/* 全体のリセットと基本設定 */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-family);
    background-color: var(--bg-color-dark);
    color: var(--text-color-main);
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    overflow: hidden;
    transition: background-color 0.3s, color 0.3s;
}

/* 隠し要素用クラス */
.hidden {
    display: none !important;
}

/*=============================================================================
  汎用ボタン・フォームスタイル
=============================================================================*/
button {
    cursor: pointer;
    border: none;
    outline: none;
    font-family: inherit;
    transition: background-color 0.2s, transform 0.1s, box-shadow 0.2s;
    border-radius: 6px;
    padding: 10px 20px;
    font-weight: bold;
    color: #fff;
}

button:active {
    transform: scale(0.97);
}

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

.btn-secondary {
    background-color: #475569;
}
.btn-secondary:hover {
    background-color: #334155;
}

.btn-danger {
    background-color: var(--danger-color);
}
.btn-danger:hover {
    background-color: var(--danger-hover);
}

.btn-small {
    padding: 6px 12px;
    font-size: 0.85rem;
}

.btn-full {
    width: 100%;
    margin-top: 10px;
}

.btn-icon {
    background: transparent;
    font-size: 1.2rem;
    padding: 6px;
}
.btn-icon:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

body.light-theme .btn-icon:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

.btn-delete-msg {
    background: transparent;
    color: var(--danger-color);
    font-size: 1rem;
    opacity: 0.5;
    padding: 4px;
}
.btn-delete-msg:hover {
    opacity: 1;
    background-color: rgba(239, 68, 68, 0.1);
}

/* テキスト・パスワード入力フォーム */
input[type="text"], 
input[type="email"], 
input[type="password"], 
select {
    width: 100%;
    padding: 12px 15px;
    margin-bottom: 12px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background-color: var(--bg-color-dark);
    color: var(--text-color-main);
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s, background-color 0.3s;
}
input[type="text"]:focus, 
input[type="email"]:focus, 
input[type="password"]:focus, 
select:focus {
    border-color: var(--accent-color);
}

/*=============================================================================
  オーバーレイ (ログイン画面など)
=============================================================================*/
.overlay {
    position: fixed;
    top: 0; left: 0; width: 100vw; height: 100vh;
    background-color: rgba(15, 23, 42, 0.95);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    overflow-y: auto;
}

.login-box {
    background: var(--bg-color-panel);
    padding: 40px;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    border: 1px solid var(--border-color);
    width: 100%;
    max-width: 450px;
}

.login-box h1 {
    margin-bottom: 10px;
    font-size: 2.2rem;
    background: linear-gradient(to right, #60a5fa, #a78bfa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 800;
}

.login-box p {
    margin-bottom: 25px;
    color: var(--text-color-sub);
    font-size: 0.95rem;
}

/* エラーボックス */
.error-box {
    background-color: rgba(239, 68, 68, 0.15);
    border: 1px solid var(--danger-color);
    color: #fca5a5;
    padding: 12px;
    border-radius: 6px;
    margin-bottom: 20px;
    font-size: 0.9rem;
    text-align: left;
    line-height: 1.4;
}

/* ログイン用タブリスト */
.login-tabs {
    display: flex;
    list-style: none;
    border-bottom: 2px solid var(--border-color);
    margin-bottom: 25px;
}

.login-tabs li {
    flex: 1;
    padding: 10px 0;
    cursor: pointer;
    font-weight: bold;
    color: var(--text-color-sub);
    transition: color 0.2s, border-bottom-color 0.2s;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
}

.login-tabs li:hover {
    color: var(--text-color-main);
}

.login-tabs li.active {
    color: var(--accent-color);
    border-bottom: 2px solid var(--accent-color);
}

/* タブコンテンツ */
.tab-content {
    animation: fadeIn 0.3s ease-in-out;
    text-align: left;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ソーシャルボタン */
.social-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.btn-social {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px;
    font-size: 1rem;
}

.btn-google {
    background-color: var(--google-color);
}
.btn-google:hover {
    background-color: #357ae8;
}

/* フォームのフッターアクション */
.form-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* トラブルシューティングガイド */
.config-guide {
    margin-top: 30px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    overflow: hidden;
    background-color: rgba(0, 0, 0, 0.2);
}

.guide-header {
    padding: 12px 15px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    color: var(--text-color-sub);
    user-select: none;
    transition: background-color 0.2s;
}

.guide-header:hover {
    background-color: rgba(255, 255, 255, 0.03);
    color: var(--text-color-main);
}

.guide-header .arrow {
    font-size: 0.7rem;
    transition: transform 0.2s;
}

.guide-header.open .arrow {
    transform: rotate(180deg);
}

.guide-body {
    padding: 15px;
    border-top: 1px solid var(--border-color);
    font-size: 0.8rem;
    color: var(--text-color-sub);
    line-height: 1.6;
    text-align: left;
}

.guide-body ol {
    margin-left: 20px;
}

.guide-body li {
    margin-bottom: 10px;
}

/*=============================================================================
  メインレイアウト構成 (2カラム)
=============================================================================*/
.container {
    display: flex;
    width: 100vw;
    height: 100vh;
    max-width: 1600px;
    background-color: var(--bg-color-dark);
}

/*=============================================================================
  左サイドバー
=============================================================================*/
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--bg-color-panel);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    transition: background-color 0.3s, border-color 0.3s;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sidebar-header-actions {
    display: flex;
    gap: 5px;
    align-items: center;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 10px;
    overflow: hidden;
}

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--border-color);
}

.user-info {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.user-name-wrapper {
    display: flex;
    align-items: center;
    gap: 4px;
    font-weight: bold;
    font-size: 1rem;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
}

.role-text {
    font-size: 0.75rem;
    color: var(--text-color-sub);
}

/* タブメニュー */
.sidebar-nav {
    border-bottom: 1px solid var(--border-color);
}

.tab-menu {
    list-style: none;
    display: flex;
}

.tab-menu li {
    flex: 1;
    text-align: center;
    padding: 12px 0;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--text-color-sub);
    transition: color 0.2s, border-bottom 0.2s;
    border-bottom: 2px solid transparent;
}

.tab-menu li:hover {
    color: var(--text-color-main);
    background-color: rgba(255, 255, 255, 0.05);
}

body.light-theme .tab-menu li:hover {
    background-color: rgba(0, 0, 0, 0.03);
}

.tab-menu li.active {
    color: var(--accent-color);
    border-bottom: 2px solid var(--accent-color);
    font-weight: bold;
}

/* ユーザー検索エリア（DM用） */
.dm-search-container {
    padding: 10px 15px;
    border-bottom: 1px solid var(--border-color);
    position: relative;
}

.dm-search-container input {
    margin-bottom: 0;
    padding: 8px 12px;
    font-size: 0.9rem;
}

.dm-search-results {
    list-style: none;
    position: absolute;
    top: 100%;
    left: 15px;
    right: 15px;
    background-color: var(--bg-color-panel);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    z-index: 10;
    max-height: 200px;
    overflow-y: auto;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.dm-search-results li {
    padding: 10px 15px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

body.light-theme .dm-search-results li {
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.dm-search-results li:hover {
    background-color: rgba(255, 255, 255, 0.08);
}

body.light-theme .dm-search-results li:hover {
    background-color: rgba(0, 0, 0, 0.03);
}

.dm-search-results li img {
    width: 25px;
    height: 25px;
    border-radius: 50%;
    object-fit: cover;
}

/* 部屋リスト */
.room-list-container {
    flex: 1;
    overflow-y: auto;
}

.room-list {
    list-style: none;
}

.room-list li {
    padding: 15px 20px;
    cursor: pointer;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    transition: background-color 0.2s;
    display: flex;
    align-items: center;
    gap: 10px;
}

body.light-theme .room-list li {
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.room-list li:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

body.light-theme .room-list li:hover {
    background-color: rgba(0, 0, 0, 0.02);
}

.room-list li.active {
    background-color: rgba(59, 130, 246, 0.1);
    border-left: 4px solid var(--accent-color);
}

/*=============================================================================
  中央メイン画面 (チャットエリア)
=============================================================================*/
.chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
    background-color: var(--bg-color-dark);
}

.chat-header {
    padding: 15px 20px;
    background-color: var(--bg-color-panel);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background-color 0.3s, border-color 0.3s;
}

.room-info h2 {
    font-size: 1.2rem;
    margin: 0;
}

.chat-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

/* メッセージ表示エリア */
.messages-area {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
    background: radial-gradient(circle at center, var(--bg-color-panel) 0%, var(--bg-color-dark) 100%);
    transition: background 0.3s;
}

/* 吹き出しの共通スタイル */
.message-wrapper {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    max-width: 70%;
}

/* 相手のメッセージ (左側) */
.message-wrapper.other {
    align-self: flex-start;
}
.message-wrapper.other .msg-content-box {
    background-color: var(--bg-color-panel);
    border: 1px solid var(--border-color);
    border-radius: 12px 12px 12px 0;
    color: var(--text-color-main);
}

/* 自分のメッセージ (右側) */
.message-wrapper.self {
    align-self: flex-end;
    flex-direction: row-reverse;
}
.message-wrapper.self .msg-content-box {
    background-color: var(--accent-color);
    border-radius: 12px 12px 0 12px;
    color: #ffffff;
}
.message-wrapper.self .msg-info {
    justify-content: flex-end;
}

/* メッセージの内部構造 */
.msg-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.msg-body {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.msg-info {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
}

.msg-name {
    font-weight: bold;
    color: var(--text-color-sub);
}
.message-wrapper.self .msg-name {
    color: var(--text-color-main);
}

.msg-time {
    font-size: 0.75rem;
    color: var(--text-color-sub);
}

.msg-content-box {
    padding: 10px 15px;
    line-height: 1.4;
    word-break: break-word;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    position: relative;
    transition: background-color 0.3s, border-color 0.3s;
}

.msg-actions {
    display: flex;
    align-items: center;
    margin: 0 5px;
}

/*=============================================================================
  ロールごとの演出デザイン (Admin, Official, User)
=============================================================================*/
.role-admin .msg-name,
.role-admin.user-name {
    background: linear-gradient(45deg, var(--admin-color-start), var(--admin-gold));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 900;
    text-shadow: 0px 0px 5px rgba(255, 215, 0, 0.2);
}

.badge-admin {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    margin-left: 2px;
    filter: drop-shadow(0 0 2px rgba(255, 215, 0, 0.8));
    animation: shine 2s infinite linear;
}

@keyframes shine {
    0% { filter: drop-shadow(0 0 2px rgba(255, 215, 0, 0.5)); }
    50% { filter: drop-shadow(0 0 6px rgba(255, 215, 0, 1)); }
    100% { filter: drop-shadow(0 0 2px rgba(255, 215, 0, 0.5)); }
}

.badge-official {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 14px;
    height: 14px;
    background-color: var(--official-color);
    border-radius: 50%;
    color: white;
    font-size: 10px;
    margin-left: 2px;
}
.badge-official::after {
    content: '✓';
    font-weight: bold;
}

/*=============================================================================
  チャットフッター (入力フォーム等)
=============================================================================*/
.chat-footer {
    padding: 15px 20px;
    background-color: var(--bg-color-panel);
    border-top: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 10px;
    transition: background-color 0.3s, border-color 0.3s;
}

.test-tools {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.85rem;
    padding: 8px;
    background-color: rgba(0, 0, 0, 0.1);
    border-radius: 6px;
    border: 1px dashed var(--border-color);
}

body.light-theme .test-tools {
    background-color: rgba(0, 0, 0, 0.02);
}

.test-label {
    color: var(--text-color-sub);
}

.select-box {
    padding: 4px 8px;
    margin-bottom: 0;
    width: auto;
}

.chat-form {
    display: flex;
    gap: 10px;
}

#chat-input {
    flex: 1;
    margin-bottom: 0;
}

/*=============================================================================
  通話モーダル (フロントモック)
=============================================================================*/
.modal {
    position: fixed;
    top: 0; left: 0; width: 100vw; height: 100vh;
    background-color: rgba(0, 0, 0, 0.85);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    backdrop-filter: blur(5px);
}

.call-content {
    background: #111;
    padding: 30px;
    border-radius: 20px;
    text-align: center;
    min-width: 300px;
    box-shadow: 0 0 30px rgba(0, 150, 255, 0.2);
    display: flex;
    flex-direction: column;
    gap: 20px;
    border: 1px solid #333;
}

.video-placeholder {
    width: 300px;
    height: 200px;
    background-color: #000;
    border-radius: 12px;
    position: relative;
    overflow: hidden;
    margin: 0 auto;
    border: 2px solid #222;
}

.scanning-line {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: rgba(0, 255, 0, 0.4);
    box-shadow: 0 0 10px rgba(0, 255, 0, 0.8);
    animation: scan 2s linear infinite;
}

@keyframes scan {
    0% { top: -10%; }
    100% { top: 110%; }
}

.camera-indicator {
    position: absolute;
    top: 10px;
    right: 10px;
    color: red;
    font-size: 0.8rem;
    font-weight: bold;
    animation: blink 1s infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

.call-controls {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 10px;
}

.call-controls .btn-icon {
    background-color: #333;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}
.call-controls .btn-icon:hover {
    background-color: #444;
}

/*=============================================================================
  管理者ダッシュボード & ユーザー設定
=============================================================================*/
.dashboard-content {
    background: var(--bg-color-panel);
    width: 80%;
    max-width: 900px;
    max-height: 80vh;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border-color);
    box-shadow: 0 10px 40px rgba(0,0,0,0.7);
    overflow: hidden;
    transition: background-color 0.3s, border-color 0.3s;
}

.dashboard-header {
    padding: 20px;
    background-color: rgba(0,0,0,0.1);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.dashboard-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

.dashboard-body h3 {
    margin-bottom: 15px;
    color: var(--accent-color);
}

.table-container {
    overflow-x: auto;
}

.user-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 600px;
}

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

.user-table th {
    background-color: rgba(255,255,255,0.02);
    font-weight: bold;
    color: var(--text-color-sub);
}

body.light-theme .user-table th {
    background-color: rgba(0,0,0,0.02);
}

.user-table td img.td-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    object-fit: cover;
}

.user-table td select {
    padding: 5px;
    font-size: 0.9rem;
    margin-bottom: 0;
}

.action-buttons {
    display: flex;
    gap: 5px;
}

/* トグルスイッチのCSS（テーマ設定で使用） */
.switch {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 24px;
}

.switch input { 
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  transition: .4s;
}

.slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 4px;
  bottom: 4px;
  background-color: white;
  transition: .4s;
}

input:checked + .slider {
  background-color: var(--accent-color);
}

input:focus + .slider {
  box-shadow: 0 0 1px var(--accent-color);
}

input:checked + .slider:before {
  transform: translateX(26px);
}

.slider.round {
  border-radius: 24px;
}

.slider.round:before {
  border-radius: 50%;
}
