/* ========================================
   医院投诉处理系统 - 样式表
   参照12345政务服务热线模板 (严格遵循设计)
   ======================================== */

/* CSS Variables */
:root {
  --primary: #1565c0;
  /* 头部主色 */
  --primary-dark: #0d47a1;
  --primary-light: #42a5f5;
  --primary-bg: #e3f2fd;
  --accent: #ff6f00;
  --success: #2e7d32;
  --success-bg: #e8f5e9;
  --warning: #f57f17;
  --warning-bg: #fff8e1;
  --danger: #c62828;
  --danger-bg: #ffebee;
  --text-primary: #333333;
  --text-secondary: #666666;
  --text-light: #999999;
  --bg-body: #f5f5f5;
  /* 严格按照12345模板的浅灰背景色 */
  --bg-card: #ffffff;
  /* 纯白表单容器区 */
  --border: #e0e0e0;
  /* 扁平化边框线 */
  --border-focus: #1565c0;
  --shadow: none;
  /* 取消现代阴影，保留政务扁平风格 */
  --shadow-hover: none;
  --radius: 0px;
  /* 取消圆角，变为直角边框 */
  --radius-lg: 0px;
  --transition: all 0.2s ease;
}

/* Reset */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: "Microsoft YaHei", "PingFang SC", "Helvetica Neue", Arial, sans-serif;
  color: var(--text-primary);
  background: var(--bg-body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: var(--transition);
}

a:hover {
  text-decoration: underline;
}

/* ========== Layout ========== */
.container {
  max-width: 1160px;
  /* 匹配 Dazhou 12345 的宽度 1160px */
  margin: 20px auto;
  padding: 0;
}

.container-wide {
  max-width: 1200px;
}

/* ========== Header ========== */
.header {
  background: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=') repeat;
  /* Placeholder pattern */
  background-color: #2b7bc4;
  /* Dazhou 12345 header 纯蓝色底 */
  color: white;
  padding: 24px 0;
  border-bottom: 2px solid #1a5e9a;
}

.header-content {
  max-width: 1160px;
  margin: 0 auto;
  padding: 0 15px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.header-icon {
  font-size: 32px;
  background: rgba(255, 255, 255, 0.2);
  width: 50px;
  height: 50px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.header-text h1 {
  font-size: 26px;
  font-weight: 600;
  letter-spacing: 1px;
}

.header-text p {
  opacity: 0.85;
  font-size: 14px;
  margin-top: 4px;
}

/* ========== Navigation ========== */
.nav-bar {
  background: #ffffff;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-bar-content {
  max-width: 1160px;
  margin: 0 auto;
  display: flex;
  gap: 0px;
}

.nav-item {
  padding: 16px 24px;
  color: var(--text-primary);
  font-weight: 500;
  border-bottom: 3px solid transparent;
  cursor: pointer;
}

.nav-item:hover {
  color: var(--primary);
  text-decoration: none;
}

.nav-item.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

/* ========== Card Structure ========== */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 24px;
  overflow: hidden;
}

.card-header {
  padding: 15px 20px;
  border-bottom: 1px solid var(--border);
  background: #fafafa;
  display: flex;
  align-items: center;
  gap: 12px;
}

.card-header h2 {
  font-size: 18px;
  color: var(--primary-dark);
  font-weight: bold;
}

.card-header-icon {
  font-size: 20px;
}

.card-body {
  padding: 24px 40px;
  /* 增加内边距，匹配12345宽松的留白 */
}

/* ========== Type Selector Tabs ========== */
.type-selector {
  display: flex;
  gap: 16px;
  margin: 10px 0 40px 0;
  flex-wrap: wrap;
}

.type-btn {
  background: #c9c9c9;
  /* Inactive grey */
  color: #ffffff;
  padding: 10px 32px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 16px;
  transition: var(--transition);
  border: none;
}

.type-btn:hover {
  background: #b3b3b3;
}

.type-btn.active {
  background: #469ef9;
  /* Active bright blue matching screenshot */
  color: #ffffff;
}

/* ========== Info Banner (Tip Box) ========== */
.info-banner {
  background: #fffdf4;
  border: 1px solid #f6e5ad;
  padding: 15px 20px;
  border-radius: var(--radius);
  color: #8a6d3b;
  font-size: 14px;
  margin-bottom: 24px;
  line-height: 1.8;
}

.info-banner p {
  margin-bottom: 8px;
}

.info-banner p:last-child {
  margin-bottom: 0;
}

/* ========== Form Elements ========== */
.form-section {
  display: flex;
  margin-bottom: 20px;
  align-items: flex-start;
}

.form-label {
  width: 130px;
  flex-shrink: 0;
  text-align: right;
  padding-right: 15px;
  padding-top: 8px;
  color: var(--text-primary);
  font-weight: bold;
}

.form-content {
  flex: 1;
}

.required {
  color: var(--danger);
  margin-right: 4px;
  font-weight: bold;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  max-width: 618px;
  /* 参照 12345 宽带限制 */
  padding: 10px 12px;
  border: 1px solid #cccccc;
  border-radius: var(--radius);
  font-size: 14px;
  transition: var(--transition);
  background-color: #fff;
}

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

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--primary-light);
}

/* Radio & Checkbox Groups */
.radio-group {
  display: flex;
  gap: 24px;
  padding-top: 8px;
}

.radio-label {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  color: var(--text-secondary);
}

.radio-label input[type="radio"] {
  cursor: pointer;
  width: 16px;
  height: 16px;
}

/* ========== Buttons ========== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 24px;
  border: none;
  border-radius: 3px;
  /* 扁平硬朗按钮样式 */
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
}

.btn:hover {
  text-decoration: none;
}

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

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

.btn-secondary {
  background: #e0e0e0;
  color: #333;
}

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

.btn-success {
  background: var(--success);
  color: white;
}

.btn-success:hover {
  background: #1b5e20;
}

.btn-block {
  width: 100%;
}

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

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

/* ========== File Upload ========== */
.upload-area {
  border: 1px dashed #cccccc;
  border-radius: var(--radius);
  padding: 24px;
  text-align: center;
  background: #fafafa;
  cursor: pointer;
  transition: var(--transition);
  max-width: 618px;
}

.upload-area:hover {
  border-color: var(--primary);
  background: var(--primary-bg);
}

.upload-icon {
  font-size: 32px;
  color: var(--primary-light);
  margin-bottom: 8px;
}

.upload-text {
  color: var(--text-secondary);
  font-size: 14px;
}

.upload-hint {
  color: var(--text-light);
  font-size: 12px;
  margin-top: 8px;
}

.file-input {
  display: none;
}

.upload-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 16px;
}

.upload-preview-item {
  position: relative;
  width: 80px;
  height: 80px;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
}

.upload-preview-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.remove-btn {
  position: absolute;
  top: 4px;
  right: 4px;
  background: rgba(0, 0, 0, 0.6);
  color: white;
  border: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

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

/* ========== Form Actions ========== */
.form-actions {
  display: flex;
  justify-content: center;
  gap: 16px;
  padding: 24px 0 10px;
  border-top: 1px dashed var(--border);
  margin-top: 24px;
}

/* ========== Table Styles (Admin) ========== */
.filter-bar {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
  padding-bottom: 20px;
  border-bottom: 1px dashed var(--border);
}

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

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  border: 1px solid var(--border);
}

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

.data-table th {
  background: #f8f9fa;
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
}

.data-table tr:hover td {
  background: var(--primary-bg);
}

.action-link {
  color: var(--primary);
  text-decoration: none;
  cursor: pointer;
  margin-right: 12px;
  font-weight: 500;
}

.action-link:last-child {
  margin-right: 0;
}

.action-link:hover {
  text-decoration: underline;
}

/* ========== Status Badges ========== */
.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
}

.badge-pending {
  background: var(--warning-bg);
  color: var(--warning);
  border: 1px solid #ffd54f;
}

.badge-processing {
  background: var(--primary-bg);
  color: var(--primary);
  border: 1px solid #90caf9;
}

.badge-done {
  background: var(--success-bg);
  color: var(--success);
  border: 1px solid #a5d6a7;
}

/* ========== Stats Grid (Admin) ========== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg-card);
  padding: 24px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.stat-icon {
  font-size: 32px;
  margin-bottom: 12px;
}

.stat-value {
  font-size: 28px;
  font-weight: bold;
  color: var(--primary);
  margin-bottom: 4px;
}

.stat-label {
  color: var(--text-secondary);
  font-size: 14px;
}

.stat-pending .stat-value {
  color: var(--warning);
}

.stat-processing .stat-value {
  color: #8e24aa;
}

.stat-done .stat-value {
  color: var(--success);
}

/* ========== Modals (Admin) ========== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: var(--transition);
}

.modal-overlay.show {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: var(--bg-card);
  width: 90%;
  max-width: 700px;
  max-height: 90vh;
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.modal-header {
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #fafafa;
}

.modal-header h3 {
  font-size: 18px;
  color: var(--primary-dark);
}

.modal-close {
  background: none;
  border: none;
  font-size: 24px;
  color: var(--text-light);
  cursor: pointer;
}

.modal-close:hover {
  color: var(--danger);
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  background: #fafafa;
}

/* Detail View Styles */
.detail-row {
  display: flex;
  margin-bottom: 16px;
  border-bottom: 1px dashed #eee;
  padding-bottom: 16px;
}

.detail-row:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.detail-label {
  width: 100px;
  color: var(--text-secondary);
  flex-shrink: 0;
}

.detail-value {
  flex: 1;
  color: var(--text-primary);
}

/* ========== Section Titles ========== */
.section-title {
  font-size: 18px;
  color: var(--primary-dark);
  border-left: 4px solid var(--primary);
  padding-left: 12px;
  margin: 32px 0 20px;
  font-weight: bold;
}

/* ========== Success/Empty States ========== */
.success-container {
  text-align: center;
  padding: 40px 20px;
}

.success-icon {
  font-size: 64px;
  color: var(--success);
  margin-bottom: 16px;
}

.success-msg {
  color: var(--text-secondary);
  font-size: 16px;
  margin-bottom: 32px;
}

.success-info {
  background: #fafafa;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  max-width: 400px;
  margin: 0 auto 32px;
  text-align: left;
}

.info-item {
  display: flex;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px dashed #eee;
}

.info-item:last-child {
  border-bottom: none;
}

.info-label {
  color: var(--text-secondary);
}

.info-value {
  font-weight: bold;
  color: var(--text-primary);
}

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-light);
}

.empty-icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.5;
}

/* ========== Login Screen ========== */
.login-container {
  min-height: calc(100vh - 160px);
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-card {
  background: var(--bg-card);
  padding: 40px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  width: 100%;
  max-width: 400px;
  text-align: center;
}

.login-icon {
  font-size: 48px;
  margin-bottom: 16px;
}

.login-subtitle {
  color: var(--text-secondary);
  margin-bottom: 24px;
}

.login-error {
  color: var(--danger);
  background: var(--danger-bg);
  padding: 10px;
  border-radius: var(--radius);
  margin-bottom: 16px;
  display: none;
  font-size: 14px;
}

.login-card .form-group {
  text-align: left;
  margin-bottom: 20px;
}

/* ========== Footer ========== */
.footer {
  text-align: center;
  padding: 30px 20px;
  color: var(--text-light);
  font-size: 13px;
  margin-top: 40px;
  border-top: 1px solid var(--border);
}

/* ========== Helpers ========== */
.char-counter {
  font-size: 12px;
  color: var(--text-light);
  text-align: right;
  margin-top: 4px;
}

.char-counter.warning {
  color: var(--warning);
}

.char-counter.danger {
  color: var(--danger);
}

.loading {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: #fff;
  animation: spin 1s ease-in-out infinite;
  margin-right: 8px;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.toast {
  position: fixed;
  top: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.8);
  color: white;
  padding: 12px 24px;
  border-radius: 20px;
  font-size: 14px;
  z-index: 9999;
  transition: var(--transition);
}

.toast.success {
  background: var(--success);
}

.toast.error {
  background: var(--danger);
}

/* ========== Responsive Adjustments ========== */
@media (max-width: 768px) {
  .form-section {
    flex-direction: column;
    align-items: stretch;
    margin-bottom: 16px;
  }

  .form-label {
    width: 100%;
    text-align: left;
    padding: 0 0 8px 0;
  }

  .container {
    margin: 15px auto;
  }

  .card-body {
    padding: 16px;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }
}