/* ===================================
   西南交通大学MPA论文评审系统 - Styles
   =================================== */

/* CSS Variables */
:root {
  --primary: #8b5cf6;
  --primary-dark: #7c3aed;
  --primary-light: #a78bfa;
  --secondary: #64748b;
  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #ef4444;
  --bg: #f8fafc;
  --bg-card: #ffffff;
  --text: #1e293b;
  --text-light: #64748b;
  --border: #e2e8f0;
  --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
  --radius: 12px;
  --radius-sm: 8px;
}

/* Reset & Base */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

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

#app {
  min-height: 100vh;
}

/* ===================================
   Login Page
   =================================== */
.login-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  padding: 20px;
}

.login-box {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 420px;
  padding: 40px;
}

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

.login-header h1 {
  font-size: 24px;
  margin-bottom: 4px;
  color: var(--primary);
  font-weight: 600;
}

.login-header h2 {
  font-size: 18px;
  margin-bottom: 8px;
  color: var(--text);
  font-weight: 500;
}

.login-header p {
  color: var(--text-light);
  font-size: 14px;
}

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

.login-form label {
  display: block;
  font-weight: 500;
  margin-bottom: 8px;
  color: var(--text);
}

.login-form input {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 16px;
  transition: border-color 0.2s;
}

.login-form input:focus {
  outline: none;
  border-color: var(--primary);
}

.error-message {
  color: var(--danger);
  font-size: 14px;
  margin-bottom: 16px;
  min-height: 20px;
}

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

.login-footer code {
  background: var(--bg);
  padding: 2px 8px;
  border-radius: 4px;
  font-family: monospace;
}

/* ===================================
   Buttons
   =================================== */
.btn-primary {
  background: var(--primary);
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: var(--radius-sm);
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s;
  width: 100%;
}

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

.btn-secondary {
  background: var(--secondary);
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  cursor: pointer;
}

.btn-outline {
  background: transparent;
  color: var(--text-light);
  border: 1px solid var(--border);
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  cursor: pointer;
}

.btn-outline:hover {
  background: var(--bg);
}

.btn-back {
  background: transparent;
  border: none;
  color: var(--primary);
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
}

.btn-back:hover {
  text-decoration: underline;
}

/* ===================================
   Dashboard
   =================================== */
.dashboard-header {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  padding: 16px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.header-left h2 {
  font-size: 20px;
}

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

.header-right span {
  color: var(--text-light);
}

.dashboard-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 32px 24px;
}

.welcome-section {
  margin-bottom: 32px;
}

.welcome-section h3 {
  font-size: 24px;
  margin-bottom: 8px;
}

.welcome-section p {
  color: var(--text-light);
}

.welcome-section span {
  color: var(--primary);
  font-weight: 600;
}

.papers-section h3 {
  margin-bottom: 16px;
  font-size: 18px;
}

.papers-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}

.paper-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  transition: box-shadow 0.2s, transform 0.2s;
}

.paper-card:hover {
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}

.paper-status {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  margin-bottom: 12px;
}

.paper-status.pending {
  background: #fef3c7;
  color: #92400e;
}

.paper-status.in-progress {
  background: #dbeafe;
  color: #1e40af;
}

.paper-status.completed {
  background: #dcfce7;
  color: #166534;
}

.paper-card h4 {
  font-size: 16px;
  margin-bottom: 12px;
  line-height: 1.4;
}

.paper-meta {
  color: var(--text-light);
  font-size: 14px;
  margin-bottom: 4px;
}

.paper-card .btn-review {
  margin-top: 16px;
  width: 100%;
  background: var(--primary);
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-weight: 500;
}

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

/* ===================================
   Profile Page
   =================================== */
.profile-page,
.review-page {
  min-height: 100vh;
  background: var(--bg);
}

.page-header {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  padding: 16px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.page-header h2 {
  flex: 1;
  font-size: 20px;
}

.profile-content,
.review-content {
  max-width: 800px;
  margin: 0 auto;
  padding: 32px 24px;
}

.profile-form {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 32px;
  box-shadow: var(--shadow);
}

.form-section {
  margin-bottom: 32px;
}

.form-section:last-child {
  margin-bottom: 0;
}

.form-section h3 {
  font-size: 16px;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

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

.form-group label {
  display: block;
  font-weight: 500;
  margin-bottom: 8px;
  color: var(--text);
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 16px;
  font-family: inherit;
  transition: border-color 0.2s;
}

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

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

.form-note {
  background: #fef3c7;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  color: #92400e;
  font-size: 14px;
}

.form-actions {
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

.form-actions .btn-primary {
  max-width: 300px;
}

/* ===================================
   Review Page
   =================================== */
.paper-info {
  background: var(--bg-card);
  padding: 20px 24px;
  border-radius: var(--radius);
  margin-bottom: 24px;
  box-shadow: var(--shadow);
}

.paper-info h3 {
  font-size: 18px;
  margin-bottom: 8px;
}

.paper-info p {
  color: var(--text-light);
  font-size: 14px;
}

.review-layout {
  display: grid;
  grid-template-columns: 1fr 400px;
  gap: 24px;
  min-height: calc(100vh - 300px);
}

@media (max-width: 1024px) {
  .review-layout {
    grid-template-columns: 1fr;
  }
}

.pdf-panel {
  background: var(--bg-card);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 600px;
}

.pdf-toolbar {
  background: #f1f5f9;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--border);
}

.pdf-btn {
  background: white;
  border: 1px solid var(--border);
  padding: 6px 12px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
}

.pdf-btn:hover {
  background: var(--bg);
}

#pdf-zoom-level {
  font-size: 14px;
  color: var(--text-light);
  min-width: 50px;
  text-align: center;
}

.pdf-container {
  flex: 1;
  overflow: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #e2e8f0;
}

#pdf-viewer {
  width: 100%;
  height: 100%;
  min-height: 600px;
  border: none;
}

.pdf-placeholder {
  text-align: center;
  color: var(--text-light);
}

.pdf-placeholder p {
  font-size: 48px;
  margin-bottom: 16px;
}

.pdf-placeholder .hint {
  font-size: 14px;
}

.review-panel {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  max-height: calc(100vh - 200px);
  overflow-y: auto;
}

.review-form h4 {
  font-size: 16px;
  margin-bottom: 16px;
}

.section-hint {
  color: var(--text-light);
  font-size: 13px;
  margin-bottom: 16px;
}

.score-section {
  margin-bottom: 32px;
}

.score-item {
  margin-bottom: 16px;
}

.score-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.score-item label {
  font-weight: 500;
  color: var(--text);
}

.score-percent {
  font-size: 13px;
  color: var(--text-light);
  background: var(--bg);
  padding: 2px 8px;
  border-radius: 4px;
}

.score-input-wrapper {
  display: flex;
  align-items: center;
  gap: 16px;
}

.score-slider {
  flex: 1;
  height: 8px;
  -webkit-appearance: none;
  appearance: none;
  background: linear-gradient(to right, var(--primary-light), var(--primary));
  border-radius: 4px;
  outline: none;
}

.score-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  background: var(--primary);
  border: 2px solid white;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.score-value {
  font-size: 16px;
  font-weight: 600;
  color: var(--primary);
  min-width: 40px;
  text-align: right;
}

.score-item.overall {
  padding-top: 16px;
  border-top: 2px solid var(--border);
  margin-top: 20px;
}

.total-score {
  display: flex;
  justify-content: center;
  align-items: baseline;
  gap: 8px;
  margin-top: 20px;
  padding: 16px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  border-radius: var(--radius);
  color: white;
}

.total-score span:first-child {
  font-size: 16px;
}

.total-score span:nth-child(2) {
  font-size: 32px;
  font-weight: 700;
}

.total-score span:last-child {
  font-size: 14px;
  opacity: 0.9;
}

.comments-section {
  margin-bottom: 32px;
}

.comments-section .form-group {
  margin-bottom: 16px;
}

.comments-section textarea {
  font-size: 14px;
}

.opinion-section h4 {
  margin-bottom: 16px;
}

.opinion-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.radio-card {
  position: relative;
  display: block;
}

.radio-card input {
  position: absolute;
  opacity: 0;
}

.radio-label {
  display: block;
  padding: 12px 16px;
  background: var(--bg);
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 14px;
}

.radio-card input:checked + .radio-label {
  border-color: var(--primary);
  background: #eff6ff;
  color: var(--primary);
}

.radio-card:hover .radio-label {
  border-color: var(--primary-light);
}

/* ===================================
   Success/Error Messages
   =================================== */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 20px;
}

.alert-success {
  background: #dcfce7;
  color: #166534;
  border: 1px solid #86efac;
}

.alert-error {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fca5a5;
}

/* ===================================
   Responsive
   =================================== */
@media (max-width: 768px) {
  .form-row {
    grid-template-columns: 1fr;
  }
  
  .header-right {
    gap: 8px;
  }
  
  .header-right span {
    display: none;
  }
  
  .login-box {
    padding: 24px;
  }
  
  .review-layout {
    grid-template-columns: 1fr;
  }
  
  .opinion-options {
    grid-template-columns: 1fr;
  }
}

/* ===================================
   Loading State
   =================================== */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
}

.loading::after {
  content: '';
  width: 32px;
  height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* ===================================
   Modal
   =================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal {
  background: white;
  border-radius: var(--radius);
  padding: 32px;
  max-width: 500px;
  width: 90%;
  box-shadow: var(--shadow-lg);
}

.modal h3 {
  margin-bottom: 16px;
}

.modal-actions {
  display: flex;
  gap: 12px;
  margin-top: 24px;
}

.modal-actions button {
  flex: 1;
}

/* ===================================
   Admin Dashboard Styles
   =================================== */
.admin-login {
  background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
}

.admin-login .login-box {
  max-width: 400px;
}

.admin-dashboard {
  min-height: 100vh;
  background: var(--bg);
}

.admin-header {
  background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
  color: white;
  padding: 16px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.admin-header .header-left h2 {
  font-size: 18px;
  color: white;
}

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

.admin-header .header-right span {
  color: rgba(255,255,255,0.8);
}

.admin-header .btn-secondary {
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.3);
  color: white;
}

.admin-header .btn-secondary:hover {
  background: rgba(255,255,255,0.2);
}

.admin-header .btn-outline {
  border-color: rgba(255,255,255,0.3);
  color: white;
}

.admin-header .btn-outline:hover {
  background: rgba(255,255,255,0.1);
}

.admin-nav {
  background: white;
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  display: flex;
  gap: 8px;
}

.nav-btn {
  background: none;
  border: none;
  padding: 16px 24px;
  font-size: 14px;
  color: var(--text-light);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s;
}

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

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

.nav-icon {
  font-size: 18px;
}

.admin-content {
  padding: 24px;
  max-width: 1400px;
  margin: 0 auto;
}

.admin-section {
  background: white;
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.section-header h3 {
  font-size: 18px;
}

.header-actions {
  display: flex;
  gap: 12px;
}

.admin-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  padding: 20px;
  border-radius: var(--radius);
  text-align: center;
}

.stat-number {
  display: block;
  font-size: 32px;
  font-weight: 700;
}

.stat-label {
  font-size: 13px;
  opacity: 0.9;
}

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

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

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

.admin-table th {
  background: var(--bg);
  font-weight: 600;
  font-size: 13px;
  color: var(--text-light);
  text-transform: uppercase;
}

.admin-table tbody tr:hover {
  background: var(--bg);
}

.admin-table .actions {
  display: flex;
  gap: 8px;
}

.admin-table .btn-action {
  padding: 4px 12px;
  font-size: 12px;
  border-radius: 4px;
  border: none;
  cursor: pointer;
}

.admin-table .btn-action.edit {
  background: var(--primary);
  color: white;
}

.admin-table .btn-action.delete {
  background: var(--danger);
  color: white;
}

.admin-table .btn-action.view {
  background: var(--success);
  color: white;
}

/* Modal Large */
.modal-large {
  max-width: 700px;
}

/* File Upload */
.file-upload-wrapper {
  width: 100%;
}

.file-upload-area {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 40px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
}

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

.file-upload-area.dragover {
  border-color: var(--primary);
  background: #eff6ff;
}

.file-upload-area p {
  margin-bottom: 8px;
}

/* Checkbox Group */
.checkbox-group {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.checkbox-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.checkbox-item:hover {
  background: #e2e8f0;
}

.checkbox-item input[type="checkbox"] {
  width: 18px;
  height: 18px;
}

/* Review Detail */
.review-detail-content {
  max-height: 60vh;
  overflow-y: auto;
}

.review-detail-section {
  margin-bottom: 20px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.review-detail-section:last-child {
  border-bottom: none;
  margin-bottom: 0;
}

.review-detail-section h4 {
  font-size: 14px;
  color: var(--text-light);
  margin-bottom: 8px;
}

.review-detail-section .score-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.review-detail-section .score-item {
  display: flex;
  justify-content: space-between;
  padding: 8px 12px;
  background: var(--bg);
  border-radius: 4px;
}

.review-detail-section .score-item .label {
  color: var(--text-light);
}

.review-detail-section .score-item .value {
  font-weight: 600;
  color: var(--primary);
}

.review-detail-section .opinion-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 14px;
}

.review-detail-section .opinion-pass {
  background: #dcfce7;
  color: #166534;
}

.review-detail-section .opinion-minor-revise {
  background: #fef3c7;
  color: #92400e;
}

.review-detail-section .opinion-major-revise {
  background: #fed7aa;
  color: #c2410c;
}

.review-detail-section .opinion-fail {
  background: #fee2e2;
  color: #991b1b;
}

/* Status Badges */
.status-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 12px;
}

.status-badge.pending {
  background: #fef3c7;
  color: #92400e;
}

.status-badge.reviewed,
.status-badge.completed {
  background: #dcfce7;
  color: #166534;
}

.status-badge.has-pdf {
  background: #dcfce7;
  color: #166534;
}

.status-badge.no-pdf {
  background: #fee2e2;
  color: #991b1b;
}

/* Responsive Admin */
@media (max-width: 768px) {
  .admin-nav {
    overflow-x: auto;
    padding: 0 16px;
  }
  
  .nav-btn {
    padding: 12px 16px;
    white-space: nowrap;
  }
  
  .admin-content {
    padding: 16px;
  }
  
  .section-header {
    flex-direction: column;
    gap: 12px;
    align-items: flex-start;
  }
  
  .admin-table {
    font-size: 13px;
  }
  
  .admin-table th,
  .admin-table td {
    padding: 8px 12px;
  }
}
