/* 
 * 文字武侠 - 主样式表
 */

/* 基础样式重置 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  line-height: 1.6;
  color: #333;
  background-color: #f5f5f5;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1rem;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 0;
  margin-bottom: 2rem;
}

h1 {
  color: #8B4513; /* 棕色主题 */
  font-size: 2rem;
  font-weight: bold;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.1);
}

main {
  flex: 1;
}

footer {
  text-align: center;
  padding: 1rem 0;
  margin-top: 2rem;
  color: #666;
  font-size: 0.9rem;
}

/* 通用组件样式 */
.btn {
  padding: 0.5rem 1rem;
  background-color: #8B4513;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 1rem;
  transition: background-color 0.3s;
}

.btn:hover {
  background-color: #A0522D;
}

.btn-secondary {
  background-color: #666;
}

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

.btn-small {
  padding: 0.25rem 0.5rem;
  font-size: 0.85rem;
}

.section {
  background-color: white;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  padding: 2rem;
  margin-bottom: 2rem;
}

.hidden {
  display: none !important;
}

.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: bold;
  color: #555;
}

.form-group input {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 1rem;
}

.form-actions {
  margin-top: 1.5rem;
  display: flex;
  gap: 0.5rem;
}

/* 标签页样式 */
.tabs {
  display: flex;
  margin-bottom: 1rem;
  border-bottom: 1px solid #ddd;
}

.tab-btn {
  padding: 0.5rem 1rem;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  font-size: 1rem;
  color: #666;
}

.tab-btn.active {
  color: #8B4513;
  border-bottom-color: #8B4513;
  font-weight: bold;
}

/* 模态框样式 */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 1000;
}

.modal-content {
  background-color: white;
  margin: 10% auto;
  padding: 2rem;
  border-radius: 8px;
  max-width: 500px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
  position: relative;
}

.close-btn {
  position: absolute;
  top: 15px;
  right: 20px;
  font-size: 1.5rem;
  color: #999;
  cursor: pointer;
}

.close-btn:hover {
  color: #333;
}

/* 身份验证区域样式 */
.auth-form {
  padding: 1rem 0;
}

/* 实时战斗记录 */
.battle-logs {
  background-color: #fcf9f5;
  border-radius: 6px;
  padding: 1rem;
  height: 450px;
  overflow-y: auto;
  border: 1px solid #ddd;
  box-shadow: inset 0 0 8px rgba(139, 69, 19, 0.1);
  transition: all 0.3s ease;
  scroll-behavior: smooth;
}

.battle-log-entry {
  padding: 0.75rem;
  margin-bottom: 0.5rem;
  border-left: 3px solid #8B4513;
  background-color: rgba(139, 69, 19, 0.05);
  white-space: pre-wrap;
  line-height: 1.4;
  border-radius: 0 4px 4px 0;
  animation: fadeIn 0.3s ease-in;
}

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

.battle-time {
  font-size: 0.8rem;
  color: #999;
  margin-bottom: 0.3rem;
}

.battle-participants {
  font-weight: bold;
  margin: 0.3rem 0;
  color: #8B4513;
}

.battle-result {
  font-size: 0.92rem;
}

.loading {
  text-align: center;
  color: #999;
  padding: 1rem;
  font-style: italic;
}

/* 首屏标题增强 */
#battle-logs-section h2 {
  color: #8B4513;
  border-bottom: 2px solid #8B4513;
  padding-bottom: 0.5rem;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
}

#battle-logs-section h2::before {
  content: "🔥";
  margin-right: 0.5rem;
  font-size: 1.2em;
}

/* 游戏区域样式 */
.game-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  margin-bottom: 2rem;
}

.game-section {
  background-color: white;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  padding: 1.5rem;
  margin-bottom: 2rem;
}

.game-section h2 {
  color: #8B4513;
}

/* 战斗提示信息 */
.battle-prompt {
  text-align: center;
  padding: 2rem;
  color: #666;
  font-style: italic;
  background-color: rgba(139, 69, 19, 0.03);
  border-radius: 4px;
  margin-bottom: 1rem;
}

/* 角色信息样式 */
.character-stats {
  margin: 1rem 0;
}

.stat-row {
  display: flex;
  align-items: center;
  margin-bottom: 0.5rem;
}

.stat-label {
  width: 80px;
  font-weight: bold;
  color: #666;
}

progress {
  height: 10px;
  width: 150px;
  margin-right: 0.5rem;
}

progress::-webkit-progress-bar {
  background-color: #eee;
  border-radius: 5px;
}

progress::-webkit-progress-value {
  background-color: #8B4513;
  border-radius: 5px;
}

.character-skills h4 {
  margin-top: 1rem;
  color: #666;
}

.character-skills ul {
  list-style-type: none;
  margin-top: 0.5rem;
}

.character-skills li {
  padding: 0.25rem 0;
  color: #444;
}

/* 战斗区域样式 */
.battle-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.battle-player, .battle-opponent {
  flex: 1;
}

.battle-vs {
  font-size: 1.5rem;
  font-weight: bold;
  color: #8B4513;
  margin: 0 1rem;
}

.battle-log {
  padding: 1rem;
  margin-bottom: 1rem;
  scroll-behavior: smooth;
}

.battle-actions {
  margin-top: 1rem;
  display: flex;
  justify-content: space-between;
}

.battle-actions .btn {
  flex: 1;
  margin: 0 0.5rem;
}

.skill-buttons {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.5rem;
  margin-top: 1rem;
}

/* 排行榜样式 */
.leaderboard-tabs {
  margin-bottom: 1rem;
}

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

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

th, td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid #eee;
}

th {
  font-weight: bold;
  color: #666;
  background-color: #f5f5f5;
}

tr:hover {
  background-color: #f9f9f9;
}

/* 消息提示框 */
.message-box {
  position: fixed;
  bottom: 70px;
  left: 50%;
  transform: translateX(-50%);
  background-color: rgba(0, 0, 0, 0.8);
  color: white;
  padding: 0.75rem 1.5rem;
  border-radius: 4px;
  z-index: 1000;
  font-size: 0.9rem;
  max-width: 80%;
  text-align: center;
}

/* 角色列表 */
.character-list {
  border-radius: 6px;
  margin-bottom: 1rem;
  overflow: visible;
}

.character-list h3 {
  color: #8B4513;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid #eee;
  font-size: 1.2rem;
}

.character-list-container {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 15px;
  margin-bottom: 1rem;
}

.character-card:hover {
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
  transform: translateY(-2px);
}

.character-card h4 {
  color: #8B4513;
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.character-card-stats {
  font-size: 0.85rem;
  color: #666;
  display: flex;
  flex-direction: column;
  flex: 1;
  justify-content: space-around;
}

.character-card-stats div {
  margin-bottom: 0.25rem;
}

.character-list-actions .btn {
  background-color: #8B4513;
  color: white;
  font-weight: bold;
}

.character-list-actions .btn:hover {
  background-color: #A0522D;
}

.character-card-info {
  display: flex;
  flex-direction: column;
}

.character-card-name {
  font-weight: bold;
  margin-bottom: 0.5rem;
}

.character-card-details {
  font-size: 0.85rem;
  color: #666;
}

.character-card-actions {
  margin-top: 0.5rem;
}

.character-create-form {
  background-color: #f9f9f9;
  border-radius: 6px;
  padding: 1.5rem;
}

.empty-list-message {
  text-align: center;
  padding: 2rem;
  color: #777;
  font-style: italic;
}

.select-character-btn {
  background-color: #8B4513;
  color: white;
  border: none;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  cursor: pointer;
}

.select-character-btn:hover {
  background-color: #A0522D;
}

.btn-danger {
  background-color: #d9534f;
}

.btn-danger:hover {
  background-color: #c9302c;
}

.admin-actions {
  margin-top: 1rem;
  display: flex;
  justify-content: center;
}

.btn-primary {
  background-color: #4CAF50;
}

.btn-primary:hover {
  background-color: #45a049;
}

#battle-btn {
  background-color: #d9534f;
}

#battle-btn:hover {
  background-color: #c9302c;
}

/* 战斗日志样式增强 */
.battle-result-message {
  padding: 0.8rem;
  margin: 1rem 0;
  background-color: #f8f0e3;
  border: 1px solid #ddd;
  border-radius: 4px;
  text-align: center;
  font-weight: bold;
  color: #8B4513;
  font-size: 1.2rem;
}

.battle-reward-message {
  padding: 0.5rem;
  margin: 0.5rem 0;
  background-color: #f0f8e3;
  border: 1px solid #ddd;
  border-radius: 4px;
  text-align: center;
  color: #4CAF50;
}

.error-message {
  padding: 1rem;
  background-color: #ffebee;
  border-left: 3px solid #f44336;
  color: #d32f2f;
  margin: 1rem 0;
  border-radius: 4px;
}

/* 顶部导航栏 */
.main-nav {
  display: flex;
  gap: 1.5rem;
}

.nav-link {
  color: #666;
  text-decoration: none;
  font-size: 1rem;
  padding: 0.5rem 0;
  position: relative;
  transition: color 0.3s;
}

.nav-link:hover {
  color: #8B4513;
}

.nav-link.active {
  color: #8B4513;
  font-weight: bold;
}

.nav-link.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 2px;
  background-color: #8B4513;
}

/* 战斗记录样式 */
.battle-records-container {
  max-height: 500px;
  overflow-y: auto;
  background-color: #fcf9f5;
  border: 1px solid #e0d0b1;
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 1rem;
}

.battle-records-list {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  will-change: transform;
  transition: transform 0.3s ease-out;
}

.battle-record {
  padding: 0.8rem;
  border-radius: 8px;
  background-color: #f4efe4;
  border-left: 4px solid #d4b483;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.battle-record:hover {
  transform: translateX(4px);
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.1);
}

.new-record {
  animation: newRecordSlideIn 0.8s ease-out forwards;
  background-color: #f8f2e0;
  border-left: 4px solid #c1a270;
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
  z-index: 1;
}

.new-record::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(90deg, 
                             rgba(255,255,255,0) 0%, 
                             rgba(255,255,255,0.4) 50%, 
                             rgba(255,255,255,0) 100%);
  transform: translateX(-100%);
  animation: shimmer 1.5s ease-in-out infinite;
  z-index: 1;
}

.battle-record-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.5rem;
  color: #8b7355;
  font-size: 0.85rem;
}

.battle-record-content {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.battle-participants {
  font-size: 1rem;
  line-height: 1.5;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
}

.battle-winner {
  color: #6b4226;
  font-weight: bold;
}

.battle-vs {
  color: #8b7d6b;
  margin: 0 0.5rem;
}

.battle-loser {
  color: #7d6954;
}

.battle-details {
  font-size: 0.9rem;
  color: #8b7955;
}

.battle-turns {
  font-weight: bold;
  color: #6b4226;
}

.loading-more {
  text-align: center;
  padding: 0.8rem;
  color: #8b7355;
  font-style: italic;
  animation: pulse 1.5s infinite;
}

/* 动画效果 */
@keyframes newRecordSlideIn {
  0% {
    opacity: 0;
    transform: translateY(-30px);
  }
  70% {
    opacity: 1;
    transform: translateY(5px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes shimmer {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(100%);
  }
}

@keyframes pulse {
  0% {
    opacity: 0.6;
  }
  50% {
    opacity: 1;
  }
  100% {
    opacity: 0.6;
  }
}

/* 媒体查询 - 适配大屏幕 */
@media (min-width: 1200px) {
  .character-list {
    /*height: 600px;*/
  }
  
  .character-card {
    height: 180px;
  }
  
  .character-list-container {
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1.5rem;
  }
  
  .battle-log {
    height: 600px;
  }
}

/* 媒体查询 - 适配小屏幕 */
@media (max-width: 768px) {
  .character-list {
    /*height: 400px;*/
  }
  
  .character-card {
    height: 140px;
  }
  
  .battle-log {
    height: 400px;
  }
  
  .character-list-container {
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 10px;
  }
} 