/* EPUB导入工具 - 移动端优先UI样式 */

:root {
  --primary-color: #667eea;
  --primary-dark: #5a67d8;
  --secondary-color: #764ba2;
  --success-color: #48bb78;
  --warning-color: #ed8936;
  --danger-color: #f56565;
  --info-color: #4299e1;

  --bg-primary: #ffffff;
  --bg-secondary: #f7fafc;
  --bg-gradient-start: #f5f7fa;
  --bg-gradient-end: #c3cfe2;

  --text-primary: #2d3748;
  --text-secondary: #718096;
  --text-muted: #a0aec0;

  --border-radius-sm: 8px;
  --border-radius-md: 12px;
  --border-radius-lg: 16px;
  --border-radius-xl: 20px;

  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07);
  --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);

  --transition-fast: 0.15s ease;
  --transition-normal: 0.3s ease;

  --max-width: 600px;
}

* {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  box-sizing: border-box;
}

html {
  font-size: 16px;
}

body {
  font-family: "Noto Sans SC", -apple-system, BlinkMacSystemFont, sans-serif;
  background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
  min-height: 100vh;
  color: var(--text-primary);
  line-height: 1.5;
  margin: 0;
  padding: 0;
}

.mobile-container {
  max-width: var(--max-width);
  margin: 0 auto;
  width: 100%;
  padding: 0 10px;
}

.main-content .mobile-container {
  display: block;
}

.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(5px);
  z-index: 9999;
  display: none;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  gap: 1rem;
}

.loading-overlay.active {
  display: flex;
}

.loading-spinner {
  width: 48px;
  height: 48px;
  border: 3px solid #e2e8f0;
  border-top-color: var(--primary-color);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.loading-text {
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 500;
}

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

.message-container {
  position: fixed;
  top: 70px;
  left: 12px;
  right: 12px;
  z-index: 10000;
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.message {
  padding: 12px 16px;
  border-radius: var(--border-radius-md);
  box-shadow: var(--shadow-lg);
  animation: slideInDown 0.3s ease-out;
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 500;
  font-size: 0.9rem;
}

.message.success {
  background: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
  color: white;
}

.message.error {
  background: linear-gradient(135deg, #f56565 0%, #e53e3e 100%);
  color: white;
}

.message.info {
  background: linear-gradient(135deg, #4299e1 0%, #3182ce 100%);
  color: white;
}

.message.warning {
  background: linear-gradient(135deg, #ed8936 0%, #dd6b20 100%);
  color: white;
}

.message i { font-size: 1.1rem; }

@keyframes slideInDown {
  from { transform: translateY(-100%); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

@keyframes slideOutUp {
  from { transform: translateY(0); opacity: 1; }
  to { transform: translateY(-100%); opacity: 0; }
}

.message.hiding { animation: slideOutUp 0.3s ease-in forwards; }

.upload-zone {
  border: 2px dashed #e2e8f0;
  border-radius: var(--border-radius-lg);
  padding: 2rem 1rem;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition-normal);
  background: var(--bg-secondary);
}

.upload-zone:hover,
.upload-zone.dragover {
  border-color: var(--primary-color);
  background: linear-gradient(135deg, #f0f4ff 0%, #e8edff 100%);
}

.upload-zone i {
  font-size: 3rem;
  color: var(--primary-color);
  margin-bottom: 0.5rem;
}

.upload-zone p {
  color: var(--text-secondary);
  margin: 0;
  font-size: 0.9rem;
}

.file-info {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 1rem;
  padding: 0.75rem;
  background: white;
  border-radius: var(--border-radius-sm);
  box-shadow: var(--shadow-sm);
}

.file-info i {
  font-size: 1.5rem;
  color: var(--success-color);
}

.file-info span {
  font-weight: 600;
  color: var(--text-primary);
}

.file-info small {
  color: var(--text-muted);
}

.card {
  background: var(--bg-primary);
  border: none;
  border-radius: var(--border-radius-md);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  margin-bottom: 0.75rem;
}

.card-header {
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  padding: 0.875rem 1rem;
  font-weight: 600;
  font-size: 0.9rem;
}

.card-body { padding: 0.875rem 1rem; }

.btn {
  border-radius: 10px;
  font-weight: 500;
  padding: 0.5rem 1rem;
  transition: all var(--transition-fast);
  border: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  font-size: 0.875rem;
}

.btn:active { transform: scale(0.95); }

.btn-primary {
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
  box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.btn-success {
  background: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
  box-shadow: 0 2px 8px rgba(72, 187, 120, 0.3);
}

.btn-outline-secondary {
  border: 1.5px solid #dee2e6;
  color: var(--text-secondary);
  background: transparent;
}

.btn-outline-primary {
  border: 1.5px solid var(--primary-color);
  color: var(--primary-color);
  background: transparent;
}

.btn-outline-danger {
  border: 1.5px solid var(--danger-color);
  color: var(--danger-color);
  background: transparent;
}

.btn-sm {
  padding: 0.4rem 0.6rem;
  font-size: 0.8rem;
}

.btn-lg {
  padding: 0.75rem 1.25rem;
  font-size: 1rem;
}

.flex-fill {
  flex: 1 1 auto;
}

.gap-2 {
  gap: 0.5rem !important;
}

.form-control,
.form-select {
  border-radius: 10px;
  border: 1.5px solid #e2e8f0;
  padding: 0.625rem 0.875rem;
  font-size: 1rem;
  transition: all var(--transition-normal);
}

.form-control:focus,
.form-select:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-label {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 0.375rem;
}

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

.row {
  margin-left: -0.5rem;
  margin-right: -0.5rem;
}

.row > * {
  padding-left: 0.5rem;
  padding-right: 0.5rem;
}

.mb-3 {
  margin-bottom: 0.75rem !important;
}

hr {
  margin: 0.75rem 0;
  border-color: #e2e8f0;
}

.navbar {
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
  z-index: 1000;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  width: 100%;
  max-width: var(--max-width);
  height: 40px;
}

.navbar .mobile-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
}

.navbar-brand {
  font-size: 1.1rem;
  font-weight: 600;
  color: white !important;
}

.navbar-brand i { font-size: 1.25rem; }

.navbar .btn-outline-light {
  border-color: rgba(255, 255, 255, 0.5);
  color: white;
  padding: 0.4rem 0.6rem;
  min-width: 36px;
  min-height: 36px;
}

.navbar .btn-outline-light:hover,
.navbar .btn-outline-light:active {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.8);
}

.nav-link {
  color: rgba(255, 255, 255, 0.9) !important;
  font-weight: 500;
  padding: 0.5rem 0.75rem !important;
  border-radius: 8px;
  font-size: 0.9rem;
}

.nav-link:active { background: rgba(255, 255, 255, 0.2); }

.navbar-toggler {
  border: none;
  padding: 0.375rem;
}

.navbar-toggler:focus { box-shadow: none; }

.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  background: white;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.08);
  z-index: 1000;
  padding: 0.25rem 0;
  padding-bottom: calc(0.25rem + env(safe-area-inset-bottom));
  width: 100%;
  max-width: var(--max-width);
  height: 60px;
  display: flex;
}

.bottom-nav .nav-item {
  flex: 1;
  text-align: center;
  color: var(--text-muted);
  text-decoration: none;
  padding: 0.25rem;
  transition: all var(--transition-normal);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

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

.bottom-nav .nav-item i { font-size: 1.25rem; display: block; margin-bottom: 2px; line-height: 1; }

.bottom-nav .nav-item span { font-size: 0.7rem; line-height: 1; }

.main-content {
  padding-top: 40px;
  padding-bottom: calc(60px + env(safe-area-inset-bottom));
  max-width: var(--max-width);
  margin: 0 auto;
}

.novel-list-item {
  display: flex;
  gap: 12px;
  padding: 12px;
  background: white;
  border-radius: var(--border-radius-md);
  margin-bottom: 10px;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-fast);
}

.novel-list-item:active { transform: scale(0.98); }

.novel-list-item .cover {
  width: 70px;
  height: 95px;
  border-radius: var(--border-radius-sm);
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.novel-list-item .cover i { font-size: 1.75rem; color: white; }

.novel-list-item .info { flex: 1; min-width: 0; }

.novel-list-item .title {
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.novel-list-item .meta {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.novel-list-item .meta span {
  margin-right: 8px;
}

.novel-list-item .stats {
  display: flex;
  gap: 12px;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.novel-list-item .actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.cache-status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 16px;
  font-size: 0.75rem;
  font-weight: 600;
}

.cache-status.cached {
  background: linear-gradient(135deg, #c6f6d5 0%, #9ae6b4 100%);
  color: #22543d;
}

.cache-status.partial {
  background: linear-gradient(135deg, #feebc8 0%, #fbd38d 100%);
  color: #744210;
}

.cache-status.empty {
  background: linear-gradient(135deg, #fed7d7 0%, #fc8181 100%);
  color: #742a2a;
}

.chapter-list {
  padding-right: 4px;
}

.chapter-list::-webkit-scrollbar { width: 4px; }

.chapter-list::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 2px;
}

.chapter-list::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, var(--primary-color), var(--secondary-color));
  border-radius: 2px;
}

.chapter-item {
  padding: 10px 12px;
  border-radius: var(--border-radius-sm);
  margin-bottom: 6px;
  background: white;
  border: 1px solid #e2e8f0;
  transition: all var(--transition-fast);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.chapter-item:active { transform: scale(0.98); }

.chapter-item:hover,
.chapter-item:active {
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  border-color: var(--primary-color);
}

.chapter-item .flex-grow-1 {
  min-width: 0;
  flex: 1;
}

.chapter-item .flex-grow-1 span {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chapter-item > div:last-child {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.chapter-item .btn-sm {
  padding: 0.4rem 0.5rem;
  min-width: 32px;
  min-height: 32px;
}

.empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
}

.empty-state i {
  font-size: 5rem;
  color: var(--primary-color);
  opacity: 0.6;
  animation: float 3s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

.empty-state h4 {
  color: var(--text-primary);
  margin-bottom: 0.5rem;
  font-size: 1.25rem;
  font-weight: 600;
}

.empty-state p {
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
  font-size: 0.95rem;
}

.empty-state .btn-primary {
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
  padding: 0.75rem 2rem;
  font-size: 1rem;
  border-radius: 25px;
  transition: all 0.3s ease;
}

.empty-state .btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.5);
}

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

.empty-state .btn-primary i {
  font-size: 1.1rem;
  opacity: 1;
  animation: none;
}

.divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, #e2e8f0, transparent);
  margin: 1.5rem 0;
}

.badge {
  padding: 0.4em 0.8em;
  border-radius: 12px;
  font-weight: 500;
  font-size: 0.75rem;
}

.text-truncate-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.modal-content {
  border: none;
  border-radius: var(--border-radius-md);
}

.modal-header {
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  padding: 0.875rem 1rem;
}

.modal-header .modal-title {
  font-size: 1rem;
  font-weight: 600;
}

.modal-body { padding: 0.875rem 1rem; }

.modal-footer {
  padding: 0.75rem 1rem;
  gap: 0.5rem;
}

.modal-footer .btn {
  flex: 1;
  min-width: 80px;
}

@media (max-width: 576px) {
  .modal-dialog {
    margin: 0.5rem;
  }
  
  .modal-dialog-scrollable {
    max-height: calc(100vh - 1rem);
  }
}

@media (min-width: 601px) {
  body {
    background: #f0f2f5;
  }

  .mobile-wrapper {
    max-width: var(--max-width);
    margin: 0 auto;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    min-height: 100vh;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.1);
  }

  .main-content {
    padding-top: 40px;
    padding-bottom: calc(60px + env(safe-area-inset-bottom));
  }

  .bottom-nav {
    box-shadow: 0 -1px 5px rgba(0, 0, 0, 0.05);
  }
}

@media (max-width: 360px) {
  html { font-size: 14px; }

  .novel-list-item .cover {
    width: 60px;
    height: 80px;
  }

  .btn {
    padding: 0.4rem 0.75rem;
    font-size: 0.8rem;
  }

  .card-body {
    padding: 0.75rem;
  }
}

@media (max-width: 320px) {
  .chapter-item .btn-sm {
    padding: 0.3rem 0.4rem;
    min-width: 28px;
    min-height: 28px;
    font-size: 0.75rem;
  }

  .chapter-item small {
    font-size: 0.7rem;
  }
}

@media (hover: none) {
  .novel-list-item:hover { transform: none; }
  .chapter-item:hover { transform: none; }
  .btn:hover { transform: none; }
}
