/**
 * EdgeLink (极连) Modern Console Design System
 * Tencent Cloud EdgeOne KV & Blob Native
 */

:root {
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: #eff6ff;
  --primary-glow: rgba(37, 99, 235, 0.15);
  --success: #10b981;
  --success-light: #ecfdf5;
  --warning: #f59e0b;
  --warning-light: #fffbeb;
  --danger: #ef4444;
  --danger-light: #fef2f2;
  --bg-main: #f8fafc;
  --bg-card: #ffffff;
  --bg-sidebar: #0f172a;
  --border-color: #e2e8f0;
  --border-light: #f1f5f9;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -2px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.03);
  --transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background-color: var(--bg-main);
  color: var(--text-main);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-overflow-scrolling: touch;
  overflow-x: clip;
}

.app-container {
  display: flex;
  min-height: 100vh;
  width: 100%;
  position: relative;
}

/* Mobile Sidebar Backdrop Overlay */
.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  z-index: 80;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.sidebar-overlay.show {
  display: block;
  opacity: 1;
}

/* Sidebar Navigation */
.sidebar {
  width: 250px;
  background-color: var(--bg-sidebar);
  color: #ffffff;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 90;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.sidebar-header {
  padding: 24px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.logo-badge {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: linear-gradient(135deg, #2563eb, #3b82f6);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4);
  flex-shrink: 0;
}

.logo-text h1 {
  font-size: 16px;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: -0.01em;
}

.logo-text p {
  font-size: 11px;
  color: #94a3b8;
  margin-top: 1px;
}

.nav-menu {
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 16px;
  border-radius: var(--radius-md);
  color: #94a3b8;
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: var(--transition);
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  cursor: pointer;
}

.nav-item:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.06);
}

.nav-item.active {
  color: #ffffff;
  background: var(--primary);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
  font-weight: 600;
}

.nav-item .icon {
  font-size: 17px;
  width: 22px;
  text-align: center;
}

.sidebar-footer {
  padding: 18px 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: #64748b;
}

/* Main Content Area */
.main-wrapper {
  flex: 1;
  margin-left: 250px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Top Sticky Header */
.top-header {
  height: 64px;
  background: #ffffff;
  border-bottom: 1px solid var(--border-color);
  padding: 0 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 40;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

/* Mobile Hamburger Toggle */
.mobile-menu-btn {
  display: none;
  background: none;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 7px 10px;
  font-size: 18px;
  cursor: pointer;
  color: var(--text-main);
}

.page-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-main);
}

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

.status-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 20px;
  background: #f1f5f9;
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 2px var(--success-light);
}

.user-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px;
  border-radius: 20px;
  background: var(--primary-light);
  color: var(--primary);
  font-size: 13px;
  font-weight: 600;
}

/* Body Content View */
.content-body {
  padding: 28px;
  flex: 1;
  max-width: 1400px;
  width: 100%;
}

.tab-pane {
  display: none;
  animation: fadeIn 0.25s ease;
}

.tab-pane.active {
  display: block;
}

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

/* ⚡ 1-Click Quick Short URL Generator */
.quick-generate-box {
  background: linear-gradient(135deg, #1e293b, #0f172a);
  color: #ffffff;
  padding: 24px 28px;
  border-radius: var(--radius-lg);
  margin-bottom: 24px;
  box-shadow: 0 10px 25px -5px rgba(15, 23, 42, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.quick-generate-title {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: #60a5fa;
  flex-wrap: wrap;
}

.quick-generate-form {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.quick-generate-input {
  flex: 1;
  min-width: 280px;
  padding: 13px 18px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  font-size: 14px;
  outline: none;
  transition: var(--transition);
}

.quick-generate-input:focus {
  background: rgba(255, 255, 255, 0.14);
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.3);
}

.quick-generate-btn {
  padding: 13px 24px;
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
}

/* Metrics Grid Cards */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}

.metric-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 22px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}

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

.metric-info h3 {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.metric-val {
  font-size: 26px;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.1;
  margin-bottom: 6px;
}

.metric-sub {
  font-size: 12px;
  color: var(--text-muted);
}

.metric-sub strong {
  color: var(--primary);
  font-weight: 700;
}

.metric-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.icon-blue { background: var(--primary-light); color: var(--primary); }
.icon-green { background: var(--success-light); color: var(--success); }
.icon-purple { background: #f3e8ff; color: #9333ea; }
.icon-orange { background: var(--warning-light); color: var(--warning); }

/* Table Container & Perfect Responsiveness */
.card-table {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  margin-bottom: 24px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
}

.table-scroll-hint {
  display: none;
  background: #eff6ff;
  color: #1d4ed8;
  font-size: 11px;
  font-weight: 600;
  text-align: center;
  padding: 6px 12px;
  border-bottom: 1px solid #dbeafe;
}

@media (max-width: 900px) {
  .table-scroll-hint {
    display: block;
  }
}

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

.section-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-main);
}

.search-bar {
  flex: 1;
  max-width: 380px;
  min-width: 220px;
}

.search-input {
  width: 100%;
  padding: 10px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  font-size: 14px;
  background: #ffffff;
  outline: none;
  transition: var(--transition);
}

.search-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

/* Responsive Table Wrapper with Horizontal Scroll */
.table-responsive {
  display: block;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-x: auto !important;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x pan-y;
  position: relative;
}

.table-responsive::-webkit-scrollbar {
  height: 6px;
}

.table-responsive::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}

table {
  width: 100%;
  min-width: 860px; /* Guarantees columns will never be clipped or forced wrap */
  border-collapse: collapse;
  text-align: left;
}

thead {
  background: #f8fafc;
  border-bottom: 1px solid var(--border-color);
}

th {
  padding: 14px 18px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
}

td {
  padding: 15px 18px;
  font-size: 14px;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-main);
  vertical-align: middle;
}

tr:last-child td {
  border-bottom: none;
}

tr:hover td {
  background: #fcfdfe;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 9px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.badge-success { background: var(--success-light); color: var(--success); }
.badge-warning { background: var(--warning-light); color: var(--warning); }
.badge-danger { background: var(--danger-light); color: var(--danger); }
.badge-primary { background: var(--primary-light); color: var(--primary); }
.badge-secondary { background: #f1f5f9; color: #475569; }

/* Switch Toggle */
.switch {
  position: relative;
  display: inline-block;
  width: 42px;
  height: 22px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #cbd5e1;
  transition: 0.25s;
  border-radius: 24px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: 0.25s;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

input:checked + .slider {
  background-color: var(--primary);
}

input:checked + .slider:before {
  transform: translateX(20px);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: var(--transition);
  border: none;
  white-space: nowrap;
}

.btn-primary {
  background: var(--primary);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
}
.btn-primary:hover {
  background: var(--primary-hover);
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.35);
}

.btn-secondary {
  background: #ffffff;
  color: var(--text-main);
  border: 1px solid var(--border-color);
}
.btn-secondary:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
}

.btn-danger {
  background: var(--danger-light);
  color: var(--danger);
  border: 1px solid rgba(239, 68, 68, 0.2);
}
.btn-danger:hover {
  background: var(--danger);
  color: #ffffff;
}

.btn-sm {
  padding: 5px 10px;
  font-size: 12px;
  border-radius: var(--radius-sm);
}

/* Modals Base */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  padding: 16px;
  -webkit-overflow-scrolling: touch;
}

.modal-backdrop.show {
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  background: #ffffff;
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 580px;
  max-height: 88vh;
  height: auto;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  animation: modalScale 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
  position: relative;
}

.modal-card-large {
  max-width: 760px;
}

.modal-card form {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
}

@keyframes modalScale {
  from { transform: scale(0.96) translateY(8px); }
  to { transform: scale(1) translateY(0); }
}

.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  background: #ffffff;
  z-index: 10;
}

.modal-header h3 {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-main);
}

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

.modal-body {
  padding: 20px;
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch !important;
  flex: 1 1 auto;
  max-height: calc(88vh - 120px) !important;
  touch-action: pan-y;
}

.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  background: #f8fafc;
  flex-shrink: 0;
  z-index: 10;
}

/* Forms */
.form-group {
  margin-bottom: 18px;
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 7px;
}

.form-label small {
  font-weight: 400;
  color: var(--text-muted);
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  font-size: 14px;
  background: #ffffff;
  color: var(--text-main);
  transition: var(--transition);
  outline: none;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

/* Result Box */
.result-box {
  background: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  text-align: center;
  margin-bottom: 16px;
}

.result-url {
  font-size: 16px;
  font-weight: 700;
  color: var(--primary);
  word-break: break-all;
  margin-bottom: 8px;
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  background: #ffffff;
  border-radius: var(--radius-md);
  padding: 12px 18px;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 500;
  min-width: 260px;
  pointer-events: auto;
  animation: toastIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.toast-success { border-left: 4px solid var(--success); }
.toast-error { border-left: 4px solid var(--danger); }
.toast-info { border-left: 4px solid var(--primary); }

/* Code Blocks & API Documentation Styles */
.code-block-container {
  background: #0f172a;
  border-radius: var(--radius-md);
  overflow: hidden;
  margin: 12px 0 20px;
  border: 1px solid #1e293b;
}

.code-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  background: #1e293b;
  color: #94a3b8;
  font-size: 12px;
}

.code-content {
  padding: 16px;
  color: #f8fafc;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, Courier, monospace;
  font-size: 13px;
  line-height: 1.6;
  overflow-x: auto;
}

/* Phone Simulator */
.phone-simulator-container {
  display: flex;
  justify-content: center;
  padding: 10px;
}

.iphone-frame {
  width: 340px;
  max-width: 90vw;
  height: 640px;
  max-height: 82vh;
  border: 10px solid #1e293b;
  border-radius: 40px;
  overflow: hidden;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.35);
  background: #ededed;
  position: relative;
}

.iphone-notch {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 120px;
  height: 20px;
  background: #1e293b;
  border-bottom-left-radius: 12px;
  border-bottom-right-radius: 12px;
  z-index: 10;
}

.iphone-screen {
  width: 100%;
  height: 100%;
  border: none;
  background: #ededed;
}

/* Auth Card */
.auth-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, #0f172a, #1e293b);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.auth-card {
  background: #ffffff;
  border-radius: var(--radius-xl);
  padding: 36px 30px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
  text-align: center;
}

.auth-card .logo-badge {
  margin: 0 auto 16px;
  width: 48px;
  height: 48px;
  font-size: 24px;
}

.login-error-alert {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #dc2626;
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  animation: loginShake 0.4s ease;
}

@keyframes loginShake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-6px); }
  40%, 80% { transform: translateX(6px); }
}

/* Modal Form Flex */
.modal-card form {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

/* Subcode Cards in Create Modal */
.subcode-card-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px;
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  margin-bottom: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.03);
  transition: border-color 0.2s;
}
.subcode-card-item:hover {
  border-color: var(--primary);
}
.subcode-thumb-box {
  position: relative;
  width: 64px;
  height: 64px;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}
.subcode-thumb-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}
.subcode-order-badge {
  position: absolute;
  top: 2px;
  left: 2px;
  background: rgba(15, 23, 42, 0.75);
  color: #ffffff;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 4px;
}
.subcode-content-box {
  flex: 1;
  min-width: 0;
}
.subcode-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}
.subcode-fields-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
@media (max-width: 600px) {
  .subcode-fields-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }
}
.subcode-field-label {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 4px;
  font-weight: 600;
}
.subcode-input {
  width: 100%;
  padding: 6px 10px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 12px;
  background: #f8fafc;
}
.subcode-input:focus {
  background: #ffffff;
  border-color: var(--primary);
  outline: none;
}
.subcode-dropzone {
  border: 2px dashed #cbd5e1;
  border-radius: var(--radius-md);
  padding: 24px 16px;
  text-align: center;
  background: #ffffff;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.subcode-dropzone:hover {
  border-color: var(--primary);
  background: #f0f7ff;
}

/* Empty State */
.empty-state {
  padding: 48px 20px;
  text-align: center;
  color: var(--text-muted);
}
.empty-icon {
  font-size: 40px;
  margin-bottom: 10px;
}

/* ============================================================= */
/* 📱 Small Screen & Mobile Responsiveness Rules                */
/* ============================================================= */
html, body {
  width: 100%;
  min-height: 100%;
  -webkit-overflow-scrolling: touch;
}

.app-container {
  width: 100%;
  min-height: 100vh;
}

@media (max-width: 992px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.5);
  }
  .main-wrapper {
    margin-left: 0;
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }
  .mobile-menu-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
  .top-header {
    padding: 0 14px;
  }
  .content-body {
    padding: 14px 10px;
  }
  .quick-generate-box {
    padding: 16px 14px;
  }
  .quick-generate-form {
    flex-direction: column;
  }
  .quick-generate-input {
    min-width: 100%;
  }
  .quick-generate-btn {
    width: 100%;
  }
  .metrics-grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }
  .metric-card {
    padding: 14px;
  }
  .metric-val {
    font-size: 20px;
  }
}

@media (max-width: 768px) {
  .top-header {
    height: 56px;
    padding: 0 12px;
  }
  .page-title {
    font-size: 15px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 130px;
  }
  .header-right {
    gap: 6px;
  }
  .header-right .status-pill {
    display: none;
  }
  .header-right .user-badge {
    display: none;
  }
  .header-right .btn-sm {
    padding: 5px 8px;
    font-size: 11px;
    white-space: nowrap;
  }

  .section-header {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    margin-bottom: 14px;
  }
  .section-header .search-bar {
    width: 100% !important;
    max-width: 100% !important;
  }
  .section-header > div:last-child {
    display: flex;
    flex-direction: column;
    width: 100%;
    gap: 8px;
  }
  .section-header .btn {
    width: 100%;
    justify-content: center;
  }

  .card-table {
    border-radius: var(--radius-md);
  }

  /* Modal Mobile Bottom-Sheet with Smooth Up/Down Scroll */
  .modal-backdrop {
    padding: 0 !important;
    align-items: flex-end !important;
  }
  .modal-card {
    width: 100% !important;
    max-width: 100% !important;
    height: 90vh !important;
    max-height: 90vh !important;
    border-bottom-left-radius: 0 !important;
    border-bottom-right-radius: 0 !important;
    border-top-left-radius: 20px !important;
    border-top-right-radius: 20px !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
  }
  .modal-card form {
    display: flex !important;
    flex-direction: column !important;
    flex: 1 1 auto !important;
    min-height: 0 !important;
    height: 100% !important;
    overflow: hidden !important;
  }
  .modal-header {
    padding: 14px 18px !important;
    flex-shrink: 0 !important;
  }
  .modal-body {
    padding: 16px 14px !important;
    flex: 1 1 auto !important;
    max-height: calc(90vh - 120px) !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    touch-action: pan-y !important;
  }
  .modal-footer {
    padding: 12px 14px !important;
    flex-direction: row !important;
    gap: 8px !important;
    flex-shrink: 0 !important;
  }
  .modal-footer .btn {
    flex: 1 !important;
    justify-content: center !important;
    padding: 10px !important;
  }

  /* Subcode Cards in Create Modal Mobile */
  .subcode-card-item {
    flex-direction: column;
    align-items: stretch;
    padding: 12px;
    gap: 10px;
  }
  .subcode-thumb-box {
    width: 100%;
    height: 100px;
  }
  .subcode-thumb-img {
    max-height: 100px;
  }
  .subcode-fields-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .subcode-card-item .btn-danger {
    width: 100%;
    justify-content: center;
  }

  #blobGalleryContainer {
    grid-template-columns: 1fr !important;
  }
}

@media (max-width: 576px) {
  .metrics-grid {
    grid-template-columns: 1fr;
  }
  .auth-card {
    padding: 24px 18px;
    max-width: 95vw;
  }
}

/* ============================================================= */
/* 📤 Enhanced Image Upload & Real Progress Bar Styles          */
/* ============================================================= */
.upload-dropzone-box {
  border: 2px dashed #cbd5e1;
  border-radius: var(--radius-lg);
  padding: 32px 20px;
  text-align: center;
  background: #ffffff;
  cursor: pointer;
  transition: all 0.25s ease;
  margin-bottom: 20px;
}
.upload-dropzone-box:hover, .upload-dropzone-box.dragover {
  border-color: var(--primary);
  background: #f0f7ff;
}

.upload-progress-container {
  display: none;
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
  animation: fadeIn 0.25s ease;
}
.upload-progress-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: 600;
}
.upload-progress-track {
  width: 100%;
  height: 10px;
  background: #f1f5f9;
  border-radius: 5px;
  overflow: hidden;
  position: relative;
}
.upload-progress-fill {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, #2563eb, #38bdf8);
  border-radius: 5px;
  transition: width 0.15s ease;
}
.upload-progress-detail {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 6px;
  display: flex;
  justify-content: space-between;
}

/* ============================================================= */
/* 🎛️ Toggle Switch Component                                    */
/* ============================================================= */
.switch {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 26px;
}
.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}
.slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: #cbd5e1;
  transition: .3s;
  border-radius: 26px;
}
.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 4px;
  bottom: 4px;
  background-color: white;
  transition: .3s;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
input:checked + .slider {
  background-color: var(--primary);
}
input:checked + .slider:before {
  transform: translateX(22px);
}

/* ============================================================= */
/* 📱 Responsive Dual View (Desktop Table vs Mobile Cards)       */
/* ============================================================= */
.desktop-table-container {
  display: block;
  width: 100%;
}
.mobile-cards-container {
  display: none;
  width: 100%;
}

@media (max-width: 820px) {
  .desktop-table-container {
    display: none !important;
  }
  .mobile-cards-container {
    display: flex !important;
    flex-direction: column;
    gap: 12px;
    width: 100%;
    margin-bottom: 24px;
  }
}

/* Mobile Data Card Styles */
.mobile-data-card {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 16px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-sizing: border-box;
}

.mobile-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.mobile-card-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.4;
  word-break: break-all;
}

.mobile-card-date {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 3px;
}

.mobile-short-url-box {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.mobile-short-url-link {
  font-size: 14px;
  font-weight: 700;
  color: var(--primary);
  text-decoration: none;
  word-break: break-all;
}

.mobile-target-url-text {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mobile-card-stats {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  border-top: 1px dashed var(--border-color);
  border-bottom: 1px dashed var(--border-color);
  font-size: 12px;
  color: var(--text-muted);
}

.mobile-card-actions {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.mobile-card-actions .btn {
  padding: 8px 2px;
  font-size: 12px;
  justify-content: center;
  white-space: nowrap;
}

/* Subcode Items inside Drawer (zima) */
.zima-subcode-card {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.03);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.zima-card-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px;
}

.zima-card-main-content {
  display: flex;
  align-items: center;
  gap: 14px;
}

.zima-card-qr-thumb {
  width: 64px;
  height: 64px;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}

.zima-card-actions-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  border-top: 1px solid #f1f5f9;
  padding-top: 10px;
}

.zima-card-actions-grid .btn {
  padding: 7px 4px;
  font-size: 12px;
  justify-content: center;
}
