@import "./styles/ball.css";
@import "./styles/balloon.css";
@import "./styles/card.css";
@import "./styles/gift.css";
@import "./styles/grid.css";
@import "./styles/light.css";
@import "./styles/list.css";
@import "./styles/matrix.css";
@import "./styles/number.css";
@import "./styles/race.css";
@import "./styles/rainbow.css";
@import "./styles/roller.css";
@import "./styles/spin.css";
@import "./styles/star.css";
@import "./styles/type.css";
@import "./styles/wheel.css";

:root {
  /* Modern Professional Color Palette (Dark Background, Light Panels) */
  --bg: #0f172a; /* Slate 900 */
  --bg-panel: #ffffff;
  --bg-panel-weak: #f8fafc; /* Slate 50 */
  --border: #e2e8f0; /* Slate 200 */
  --text-main: #1e293b; /* Slate 800 */
  --text-sub: #64748b; /* Slate 500 */
  --accent: #6366f1; /* Indigo 500 */
  --accent-strong: #4f46e5; /* Indigo 600 */
  --accent-soft: rgba(99, 102, 241, 0.1);
  --success: #10b981; /* Emerald 500 */
  --danger: #ef4444; /* Red 500 */
  --warning: #f59e0b; /* Amber 500 */
  
  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-glow: 0 0 20px rgba(99, 102, 241, 0.3);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  background-image: 
    radial-gradient(at 0% 0%, rgba(99, 102, 241, 0.15) 0px, transparent 50%),
    radial-gradient(at 100% 0%, rgba(16, 185, 129, 0.15) 0px, transparent 50%),
    radial-gradient(at 100% 100%, rgba(245, 158, 11, 0.15) 0px, transparent 50%),
    radial-gradient(at 0% 100%, rgba(239, 68, 68, 0.15) 0px, transparent 50%);
  color: var(--text-main);
  min-height: 100vh;
  line-height: 1.5;
}

.app {
  max-width: 1280px;
  margin: 0 auto;
  padding: 24px 20px 60px;
}

/* 主容器布局 */
.main-container {
  display: flex;
  gap: 24px;
  margin-top: 24px;
}

/* 左侧边栏 */
.sidebar {
  width: 320px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* 侧边栏标题样式 */
.sidebar-header {
  text-align: center;
  padding: 24px 20px;
  background: var(--bg-panel);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
}

.sidebar-header h1 {
  margin: 0 0 8px;
  font-size: 22px;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.5px;
}

.sidebar-header .sub {
  font-size: 13px;
  color: var(--text-sub);
  margin-bottom: 0;
}

/* 右侧主内容区 */
.main-content {
  flex: 1;
  min-width: 0;
}

/* 垂直列布局模式 */
.vertical-modes-container {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 10px 0 20px;
}

/* 垂直布局中的面板样式 */
.vertical-modes-container .panel {
  margin-bottom: 0;
  position: relative;
  padding: 20px 24px;
  min-height: 80px;
  background: var(--bg-panel);
  border-radius: 16px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  transition: all 0.2s ease;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
}

.vertical-modes-container .panel:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  border-color: var(--accent-soft);
}

/* 默认隐藏所有面板的游戏容器和结果 */
.vertical-modes-container .panel:not(.active) > *:not(.panel-left):not(.panel-right) {
  display: none !important;
}

/* 垂直布局中的左侧内容区 */
.vertical-modes-container .panel-left {
  flex: 1;
  padding-right: 24px;
}

/* 游戏容器和结果区域应该换行显示，占据整行 */
.vertical-modes-container .panel > .game-container-wrapper,
.vertical-modes-container .panel > [class*="-container"],
.vertical-modes-container .panel > [class*="-display"],
.vertical-modes-container .panel > .result {
  flex-basis: 100% !important;
  width: 100% !important;
  max-width: 100% !important;
  order: 10 !important;
  margin-top: 24px !important;
  box-sizing: border-box !important;
}

/* 垂直布局中的面板标题样式 */
.vertical-modes-container .panel h2 {
  font-size: 18px;
  margin: 0 0 8px 0;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-main);
  font-weight: 600;
}

.vertical-modes-container .panel h2 span.emoji {
  font-size: 24px;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.1));
}

/* 垂直布局中的说明文字 */
.vertical-modes-container .panel .panel-tip {
  font-size: 13px;
  color: var(--text-sub);
  margin-bottom: 0;
  line-height: 1.5;
}

/* 垂直布局中的按钮区域 */
.vertical-modes-container .panel-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

/* 按钮通用样式 */
button {
  font-family: inherit;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 500;
  border-radius: 12px;
  border: none;
  background: var(--accent);
  color: white;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 6px -1px rgba(99, 102, 241, 0.4);
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-strong);
  transform: translateY(-1px);
  box-shadow: 0 10px 15px -3px rgba(99, 102, 241, 0.5);
}

.btn-primary:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: 0 2px 4px -1px rgba(99, 102, 241, 0.4);
}

.btn-primary:disabled {
  background: var(--text-sub);
  cursor: not-allowed;
  opacity: 0.7;
  box-shadow: none;
}

/* 响应式设计 */
@media (max-width: 900px) {
  .main-container {
    flex-direction: column;
  }
  
  .sidebar {
    width: 100%;
  }
  
  .vertical-modes-container .panel {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }
  
  .vertical-modes-container .panel-right {
    align-self: flex-start;
    width: 100%;
  }
  
  .vertical-modes-container .btn-primary {
    width: 100%;
  }
}

/* 工具栏 */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
}

.toolbar button {
  border: 1px solid var(--border);
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 500;
  border-radius: 10px;
  cursor: pointer;
  background: var(--bg-panel);
  color: var(--text-main);
  transition: all 0.2s ease;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  gap: 6px;
}

.toolbar button:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow);
  border-color: var(--accent);
  color: var(--accent);
}

.toolbar button.active {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

/* 左右布局容器 */
.mode-layout {
  display: flex;
  gap: 24px;
  margin-bottom: 24px;
  align-items: flex-start;
}

.toolbar-column {
  flex: 1;
}

.random-mode-column {
  width: 300px;
  flex-shrink: 0;
}

@media (max-width: 768px) {
  .mode-layout {
    flex-direction: column-reverse;
  }
  
  .random-mode-column {
    width: 100%;
    margin-bottom: 16px;
  }
}

/* 面板通用样式 */
.panel {
  background: var(--bg-panel);
  border-radius: 16px;
  padding: 20px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

.panel h2 {
  margin: 0 0 12px;
  font-size: 18px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-main);
  font-weight: 600;
}

.panel-tip {
  font-size: 13px;
  color: var(--text-sub);
  margin-bottom: 12px;
}

/* 随机抽签大按钮区域 */
.random-mode-container {
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  border-radius: 16px;
  padding: 6px; /* Reduced padding for wrapper */
  box-shadow: 0 10px 30px rgba(99, 102, 241, 0.3);
  text-align: center;
  position: relative;
  overflow: hidden;
}

.btn-random-mode {
  border: none;
  width: 100%;
  padding: 16px;
  border-radius: 12px;
  cursor: pointer;
  font-size: 18px;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  color: white;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.btn-random-mode:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: translateY(-1px);
}

.btn-random-mode:active {
  transform: translateY(0);
}

/* 结果展示 */
.result {
  margin-top: 16px;
  padding: 16px;
  background: var(--bg-panel-weak);
  border-radius: 12px;
  text-align: center;
  font-size: 18px;
  font-weight: 700;
  color: var(--accent);
  border: 1px dashed var(--border);
}

.name-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 20px;
  background: #e0e7ff; /* Indigo 100 */
  color: var(--accent-strong);
  margin: 4px;
  font-size: 13px;
  font-weight: 500;
}

.names-line {
  margin-bottom: 8px;
  font-size: 13px;
  color: var(--text-sub);
}

/* 名单管理 */
.student-textarea {
  min-height: 140px;
  width: 100%;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.6;
  resize: vertical;
  background: var(--bg-panel-weak);
  color: var(--text-main);
  font-family: inherit;
  transition: border-color 0.2s;
}

.student-textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
  background: white;
}

/* 已抽中人员列表样式 */
.selected-list {
  max-height: 240px;
  overflow-y: auto;
  margin-bottom: 12px;
  padding: 8px;
  background: var(--bg-panel-weak);
  border-radius: 12px;
  border: 1px solid var(--border);
}

.selected-list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  margin-bottom: 8px;
  background: white;
  border-radius: 8px;
  box-shadow: var(--shadow-sm);
  font-size: 14px;
  color: var(--text-main);
  transition: transform 0.1s;
}

.selected-list-item:hover {
  transform: translateX(2px);
}

.selected-list-item:last-child {
  margin-bottom: 0;
}

.remove-item-btn {
  border: none;
  background: #fee2e2; /* Red 100 */
  color: #ef4444; /* Red 500 */
  width: 24px;
  height: 24px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.remove-item-btn:hover {
  background: #ef4444;
  color: white;
}

/* 庆祝模态窗口样式 */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(15, 23, 42, 0.8);
  backdrop-filter: blur(4px);
  z-index: 1000;
  justify-content: center;
  align-items: center;
  animation: fadeIn 0.3s ease;
}

.modal.show {
  display: flex;
}

.modal-content {
  background: white;
  border-radius: 24px;
  padding: 40px;
  text-align: center;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  animation: modalSlideIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  max-width: 90%;
  width: 480px;
  overflow: hidden;
}

.celebration-title {
  font-size: 36px;
  margin-bottom: 16px;
  color: var(--accent);
  font-weight: 800;
}

.celebration-winner {
  font-size: 48px;
  margin-bottom: 16px;
  color: var(--text-main);
  font-weight: 800;
  line-height: 1.2;
}

.celebration-message {
  font-size: 18px;
  margin-bottom: 32px;
  color: var(--text-sub);
}

#closeModal {
  padding: 12px 32px;
  font-size: 16px;
  border-radius: 99px;
  box-shadow: 0 10px 25px -5px rgba(99, 102, 241, 0.5);
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes modalSlideIn {
  from { transform: translateY(20px) scale(0.95); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}

/* Confetti */
.confetti-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.confetti {
  position: absolute;
  top: -10px;
  border-radius: 2px;
  animation: fall linear forwards;
}

@keyframes fall {
  to { transform: translateY(100vh) rotate(720deg); }
}

@keyframes pulse-gold {
  0% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.7); transform: scale(1); }
  50% { transform: scale(1.05); }
  70% { box-shadow: 0 0 0 10px rgba(245, 158, 11, 0); transform: scale(1.05); }
  100% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0); transform: scale(1); }
}

.winner-pulse {
  animation: pulse-gold 1.5s infinite;
  background: var(--warning) !important;
  color: white !important;
  border-color: var(--warning) !important;
  z-index: 10;
}
