/* ==================== 全局样式 ==================== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --primary-color: #00a8ff;
  --primary-dark: #0097e6;
  --primary-light: #48dbfb;
  --secondary-color: #00d2d3;
  --success-color: #10b981;
  --warning-color: #f59e0b;
  --danger-color: #ef4444;
  --info-color: #3b82f6;
  --bg-color: #f0f4f8;
  --card-bg: #ffffff;
  --text-primary: #1a1a2e;
  --text-secondary: #6b7280;
  --border-color: #e1e8ed;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 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-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif;
  background: var(--bg-color);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
}

/* ==================== 登录页面 ==================== */
.login-page {
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.login-container {
  width: 100%;
  max-width: 420px;
}

.login-card {
  background: var(--card-bg);
  border-radius: var(--radius-xl);
  padding: 40px;
  box-shadow: var(--shadow-xl);
  animation: slideUp 0.5s ease;
}

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

.login-header {
  text-align: center;
  margin-bottom: 32px;
}

.login-header h1 {
  font-size: 1.75rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 8px;
  position: relative;
  z-index: 1;
}

.login-header p {
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.login-form {
  margin-bottom: 24px;
}

.login-footer {
  text-align: center;
  padding-top: 24px;
  border-top: 1px solid var(--border-color);
}

.login-footer p {
  color: var(--text-secondary);
  font-size: 0.85rem;
}

/* ==================== 主页面 ==================== */
.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 20px;
}

header {
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
  color: white;
  padding: 16px 20px;
  border-radius: var(--radius-lg);
  margin-bottom: 16px;
  box-shadow: var(--shadow-lg);
  position: relative;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.header-left h1 {
  font-size: 1.25rem;
  font-weight: 700;
  margin: 0;
  line-height: 1.2;
}

.header-left p {
  display: none;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.15);
  padding: 6px 12px;
  border-radius: var(--radius-md);
  backdrop-filter: blur(10px);
}

.user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
}

.user-name {
  font-size: 0.9rem;
  font-weight: 500;
}

.mobile-menu-btn {
  display: none;
  position: absolute;
  top: 15px;
  right: 15px;
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  padding: 10px 14px;
  font-size: 1.3rem;
  cursor: pointer;
  border-radius: var(--radius-md);
  transition: all 0.3s;
}

.mobile-menu-btn:hover {
  background: rgba(255, 255, 255, 0.3);
}

.nav-menu {
  display: flex;
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  padding: 6px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-md);
  gap: 4px;
}

.nav-item {
  flex: 1;
  padding: 10px 16px;
  border: none;
  background: none;
  font-size: 0.9rem;
  cursor: pointer;
  border-radius: var(--radius-md);
  transition: all 0.3s;
  color: var(--text-secondary);
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.nav-item:hover {
  background: var(--bg-color);
}

.nav-item.active {
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  color: white;
  box-shadow: var(--shadow-sm);
}

.tab-content {
  display: block;
  animation: fadeIn 0.3s ease;
}

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

.tab-content.hidden {
  display: none;
}

/* ==================== 表单样式 ==================== */
.filter-bar {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.filter-bar select {
  flex: 1;
  min-width: 200px;
  padding: 10px 14px;
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  background: var(--card-bg);
  color: var(--text-primary);
  transition: all 0.3s;
  cursor: pointer;
}

.filter-bar select:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.requirement-form,
.department-form,
.user-form {
  background: var(--card-bg);
  padding: 32px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  margin-bottom: 24px;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  color: var(--text-primary);
  font-size: 0.95rem;
}

.input-wrapper {
  position: relative;
}

.input-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.1rem;
  z-index: 1;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 1rem;
  transition: all 0.3s;
  background: var(--card-bg);
  color: var(--text-primary);
}

.form-group textarea {
  resize: vertical;
  min-height: 100px;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.form-group.input-with-icon input,
.form-group.input-with-icon select {
  padding-left: 44px;
}

.form-group.inline {
  display: flex;
  gap: 12px;
  align-items: flex-end;
  margin-bottom: 0;
}

.form-group.inline input {
  flex: 1;
}

.form-actions {
  display: flex;
  gap: 12px;
  margin-top: 28px;
}

/* ==================== 按钮样式 ==================== */
.btn {
  padding: 12px 24px;
  border: none;
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.3s;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: var(--shadow-sm);
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  color: white;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

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

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.btn-secondary {
  background: var(--bg-color);
  color: var(--text-primary);
}

.btn-secondary:hover {
  background: #e5e7eb;
}

.btn-full {
  width: 100%;
}

.btn-danger {
  background: #1e40af;
  color: white;
  padding: 8px 16px;
  font-size: 0.9rem;
}

.btn-danger:hover {
  background: #1e3a8a;
}

.btn-edit {
  background: #1e40af;
  color: white;
  padding: 8px 16px;
  font-size: 0.9rem;
}

.btn-edit:hover {
  background: #1e3a8a;
}

/* ==================== 卡片样式 ==================== */
.requirements-list {
  display: grid;
  gap: 20px;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
}

.requirement-card {
  background: var(--card-bg);
  padding: 24px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  transition: all 0.3s;
  border: 1px solid var(--border-color);
}

.requirement-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--primary-light);
}

.requirement-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 12px;
}

.requirement-title {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-primary);
  flex: 1;
  min-width: 200px;
  line-height: 1.5;
}

.requirement-badges {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.badge {
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0;
}

.badge-department {
  background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
  color: white;
}

.badge-product {
  background: linear-gradient(135deg, var(--warning-color), #fbbf24);
  color: white;
}

.badge-dev {
  background: linear-gradient(135deg, var(--success-color), #34d399);
  color: white;
}

.badge-dev.waiting {
  background: linear-gradient(135deg, #9ca3af, #d1d5db);
}

.badge-dev.reviewed {
  background: linear-gradient(135deg, var(--info-color), #60a5fa);
}

.badge-dev.developing {
  background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
}

.badge-dev.online {
  background: linear-gradient(135deg, var(--success-color), #34d399);
}

.badge-dev.planning {
  background: linear-gradient(135deg, var(--warning-color), #fbbf24);
}

.requirement-info {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
  padding: 14px;
  background: var(--bg-color);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.requirement-content {
  background: var(--bg-color);
  padding: 14px;
  border-radius: var(--radius-md);
  margin-bottom: 12px;
  color: var(--text-primary);
  line-height: 1.6;
  font-size: 0.95rem;
}

.requirement-remarks {
  color: var(--text-secondary);
  font-style: italic;
  font-size: 0.9rem;
  padding: 12px;
  background: rgba(99, 102, 241, 0.05);
  border-left: 3px solid var(--primary-color);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

.requirement-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border-color);
}

.departments-list,
.users-list {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}

.department-item,
.user-item {
  background: var(--card-bg);
  padding: 20px;
  border-radius: var(--radius-lg);
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border-color);
  transition: all 0.3s;
}

.department-item:hover,
.user-item:hover {
  box-shadow: var(--shadow-lg);
  border-color: var(--primary-light);
}

.department-name,
.user-info-text {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  flex: 1;
}

.user-info-text .detail {
  font-weight: 400;
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-top: 4px;
}

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

/* ==================== 模态框 ==================== */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(4px);
}

.modal.active {
  display: flex;
}

.modal-content {
  background: var(--card-bg);
  border-radius: var(--radius-xl);
  padding: 32px;
  max-width: 550px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-xl);
  animation: modalSlideIn 0.3s ease;
}

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

.modal-content h3 {
  margin-bottom: 24px;
  color: var(--text-primary);
  font-size: 1.5rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ==================== 无数据提示 ==================== */
.no-data {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-secondary);
  font-size: 1.1rem;
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  border: 2px dashed var(--border-color);
}

/* ==================== 响应式设计 ==================== */
@media (max-width: 1024px) {
  .requirements-list {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  }

  .departments-list,
  .users-list {
    grid-template-columns: 1fr;
  }
}

/* ==================== 悬浮新增按钮 ==================== */
.fab-button {
  position: fixed;
  bottom: 40px;
  right: 40px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
  color: white;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(0, 168, 255, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s;
  z-index: 100;
}

.fab-button:hover {
  transform: scale(1.1) rotate(90deg);
  box-shadow: 0 6px 20px rgba(0, 168, 255, 0.6);
}

.fab-button:active {
  transform: scale(0.95);
}

.fab-icon {
  font-size: 28px;
  font-weight: bold;
}

@media (max-width: 768px) {
  .container {
    padding: 12px;
  }
  
  .login-card {
    padding: 28px;
  }
  
  .login-header h1 {
    font-size: 1.4rem;
  }

  header {
    padding: 16px;
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap;
  }

  .header-left {
    flex: 1;
    min-width: 0;
  }

  .header-left h1 {
    font-size: 1.1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .header-right {
    flex: 0;
    align-items: center;
    margin-top: 0;
  }

  .user-info {
    display: none;
  }

  .user-name {
    display: none;
  }

  .mobile-menu-btn {
    display: block;
    position: static;
    padding: 8px 12px;
  }

  .nav-menu {
    display: none;
    flex-direction: row;
    gap: 2px;
    padding: 4px;
    margin-bottom: 12px;
  }

  .nav-menu.active {
    display: flex;
  }

  .nav-item {
    text-align: center;
    justify-content: center;
    padding: 8px 10px;
    font-size: 0.85rem;
  }

  .filter-bar {
    flex-direction: column;
    margin-bottom: 12px;
  }

  .filter-bar select {
    width: 100%;
    min-width: auto;
    padding: 8px 12px;
    font-size: 0.9rem;
  }

  .requirement-form,
  .department-form,
  .user-form {
    padding: 20px;
  }

  .requirement-header {
    flex-direction: column;
  }

  .requirement-badges {
    width: 100%;
  }

  .requirement-info {
    grid-template-columns: 1fr;
  }

  .form-actions {
    flex-direction: column;
  }

  /* 在 header 中的按钮不需要宽度 100% */
  .header-right .btn {
    width: auto;
    padding: 6px 14px;
    font-size: 0.85rem;
  }

  .btn:not(.header-right .btn) {
    width: 100%;
  }
  
  .modal-content {
    padding: 20px;
    margin: 10px;
  }
  
  .departments-list,
  .users-list {
    grid-template-columns: 1fr;
  }
  
  .department-item,
  .user-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  
  .department-item .btn,
  .user-item-actions {
    width: 100%;
  }
  
  .btn-danger,
  .btn-edit {
    width: 100%;
  }
  
  .user-item-actions {
    flex-direction: row;
  }
}

@media (max-width: 480px) {
  .login-card {
    padding: 24px 20px;
  }
  
  .login-header h1 {
    font-size: 1.25rem;
  }
  
  header h1 {
    font-size: 1.2rem;
  }
  
  .requirement-title {
    font-size: 1rem;
  }
  
  .badge {
    font-size: 0.75rem;
    padding: 4px 10px;
  }
  
  .requirements-list {
    grid-template-columns: 1fr;
  }
  
  .form-group.inline {
    flex-direction: column;
    align-items: stretch;
  }
  
  .form-group.inline .btn {
    width: 100%;
  }
}

/* ==================== 滚动条美化 ==================== */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-color);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb {
  background: var(--primary-light);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--primary-color);
}

/* ==================== 辅助类 ==================== */
.text-center {
  text-align: center;
}

.mt-2 {
  margin-top: 8px;
}

.mt-4 {
  margin-top: 16px;
}
