/* ========== Global & Layout ========== */
* { -webkit-tap-highlight-color: transparent; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: #f0f7ff;
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
}

#app-container {
  position: relative;
  width: 100%;
  min-height: 100vh;
  overflow: hidden;
}

/* ========== Page Layers ========== */
.page {
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  opacity: 0;
  pointer-events: none;
  transition: none;
  will-change: transform, opacity;
}

.page.active {
  position: relative;
  opacity: 1;
  pointer-events: auto;
  z-index: 1;
}

/* ========== Page Transition Keyframes ========== */
@keyframes slideOutLeft {
  from { transform: translateX(0); opacity: 1; }
  to   { transform: translateX(-40%); opacity: 0; }
}
@keyframes slideInRight {
  from { transform: translateX(100%); opacity: 0; }
  to   { transform: translateX(0); opacity: 1; }
}
@keyframes slideOutRight {
  from { transform: translateX(0); opacity: 1; }
  to   { transform: translateX(100%); opacity: 0; }
}
@keyframes slideInLeft {
  from { transform: translateX(-40%); opacity: 0; }
  to   { transform: translateX(0); opacity: 1; }
}

.page.anim-slide-out-left {
  animation: slideOutLeft 0.35s cubic-bezier(0.4, 0, 0.2, 1) forwards;
  pointer-events: none;
}
.page.anim-slide-in-right {
  animation: slideInRight 0.35s cubic-bezier(0.4, 0, 0.2, 1) forwards;
  pointer-events: auto;
}
.page.anim-slide-out-right {
  animation: slideOutRight 0.35s cubic-bezier(0.4, 0, 0.2, 1) forwards;
  pointer-events: none;
}
.page.anim-slide-in-left {
  animation: slideInLeft 0.35s cubic-bezier(0.4, 0, 0.2, 1) forwards;
  pointer-events: auto;
}

/* ========== Utility Shadows ========== */
.icon-shadow {
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.05), 0 8px 10px -6px rgba(0, 0, 0, 0.05);
}
.input-shadow {
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.02);
}
.soft-shadow {
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.05), 0 8px 10px -6px rgba(0, 0, 0, 0.03);
}
.soft-shadow-sm {
  box-shadow: 0px 4px 12px rgba(0, 0, 0, 0.04);
}

/* ========== Accent Color (Login / Main pages) ========== */
:root {
  --bjtu-blue: #4A9EFF;
}
.bg-bjtu-blue { background-color: var(--bjtu-blue); }
.text-bjtu-blue { color: var(--bjtu-blue); }
.border-bjtu-blue { border-color: var(--bjtu-blue); }

/* ========== Material Symbols Base ========== */
.material-symbols-outlined {
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
}

/* ========== Glass Card ========== */
.glass-card {
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.3);
}

/* ========== Input Focus Ring ========== */
.input-transition:focus-within {
  border-color: #003f87;
  box-shadow: 0px 0px 0px 4px rgba(0, 63, 135, 0.1);
}

/* ========== Hide Scrollbar ========== */
.hide-scrollbar::-webkit-scrollbar { display: none; }
.hide-scrollbar { -ms-overflow-style: none; scrollbar-width: none; }
.no-scrollbar::-webkit-scrollbar { display: none; }
.no-scrollbar { -ms-overflow-style: none; scrollbar-width: none; }

/* ========== Page-Specific Backgrounds ========== */
.page-login {
  background: linear-gradient(180deg, #FFFFFF 0%, #F8FAFC 100%);
}
.page-register {
  background-color: #f9f9ff;
  font-family: 'Hanken Grotesk', sans-serif;
}
.page-main {
  background: linear-gradient(180deg, #f0f7ff 0%, #ffffff 100%);
}
.page-profile {
  background-color: #f8f9ff;
  font-family: 'Noto Sans', sans-serif;
}
.page-upload {
  background-color: #f8f9ff;
  font-family: 'Noto Sans', sans-serif;
}

/* ========== Folder Icon Gradient (Main page) ========== */
.folder-icon-bg {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
}

/* ========== Register Decorative Background ========== */
.register-bg-decor {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}
.register-bg-decor .blob-1 {
  position: absolute;
  top: -10%; right: -10%;
  width: 50%; height: 40%;
  background: #e5eeff;
  border-radius: 9999px;
  filter: blur(100px);
  opacity: 0.4;
}
.register-bg-decor .blob-2 {
  position: absolute;
  bottom: 0%; left: -10%;
  width: 60%; height: 40%;
  background: #d7e2ff;
  border-radius: 9999px;
  filter: blur(120px);
  opacity: 0.2;
}

/* ========== Loading Spinner ========== */
@keyframes spin {
  to { transform: rotate(360deg); }
}
.spinner {
  width: 20px; height: 20px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  display: inline-block;
}
.spinner-dark {
  width: 20px; height: 20px;
  border: 2px solid rgba(0,0,0,0.1);
  border-top-color: #003f87;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  display: inline-block;
}

/* ========== Toast Notification ========== */
.toast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(-120px);
  background: #151c27;
  color: white;
  padding: 12px 24px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 500;
  z-index: 9999;
  pointer-events: none;
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 10px 25px rgba(0,0,0,0.15);
}
.toast.show {
  transform: translateX(-50%) translateY(0);
}
.toast.success {
  background: #059669;
}

/* ========== Clickable Card ========== */
.clickable-card {
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.clickable-card:active {
  transform: scale(0.98);
}

/* ========== Search Clear Button ========== */
#search-clear-btn {
  cursor: pointer;
}
#search-clear-btn.visible {
  opacity: 1;
  pointer-events: auto;
}

/* ========== Breadcrumb ========== */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 4px;
  overflow-x: auto;
  padding: 4px 0;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.breadcrumb::-webkit-scrollbar { display: none; }

.breadcrumb-segment {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  padding: 6px 14px;
  border-radius: 9999px;
  font-size: 13px;
  font-weight: 500;
  color: #64748b;
  background: rgba(74, 158, 255, 0.08);
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
  white-space: nowrap;
}
.breadcrumb-segment:active {
  background: rgba(74, 158, 255, 0.18);
  transform: scale(0.96);
}
.breadcrumb-segment.home {
  background: rgba(74, 158, 255, 0.12);
  color: #4A9EFF;
  font-weight: 600;
}
.breadcrumb-segment.active {
  background: var(--bjtu-blue);
  color: #ffffff;
  font-weight: 600;
  cursor: default;
}
.breadcrumb-segment.active:active {
  transform: none;
}

.breadcrumb-separator {
  flex-shrink: 0;
  color: #cbd5e1;
  font-size: 13px;
  font-weight: 400;
  padding: 0 2px;
  user-select: none;
}

/* ========== File / Folder Cards (content view) ========== */

/* File type icon colors (used in both list and card views) */
.file-icon-pdf  { background: #ef4444; }
.file-icon-docx { background: #3b82f6; }
.file-icon-zip  { background: #8b5cf6; }
.file-icon-xlsx { background: #10b981; }
.file-icon-pptx { background: #f59e0b; }
.file-icon-txt  { background: #64748b; }
.file-icon-default { background: #94a3b8; }

/* File card icon */
.file-card-icon {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: #ffffff;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
}

/* Content folder card icon (matches root folder-icon-bg) */
.content-folder-icon {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  box-shadow: 0 4px 10px rgba(37, 99, 235, 0.25);
}

/* Empty state */
.empty-folder {
  grid-column: 1 / -1;
  text-align: center;
  color: #94a3b8;
  font-size: 14px;
  padding: 2rem 0;
}

/* Smooth visibility swap for grid/content */
#folder-grid-container,
#folder-content {
  transition: opacity 0.25s ease;
}

/* ========== Purchase Modal ========== */
@keyframes scaleIn {
  from { transform: scale(0.9); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}

#purchase-modal.show,
#points-modal.show,
#qr-modal.show,
#feedback-modal.show {
  display: flex !important;
}
#purchase-modal.show .modal-content,
#points-modal.show .modal-content,
#qr-modal.show .modal-content,
#feedback-modal.show .modal-content {
  animation: scaleIn 0.2s ease-out;
}

/* ========== Price Badge ========== */
.price-badge {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
}
.price-badge.paid {
  background: #fef3c7;
  color: #b45309;
}
.price-badge.free {
  background: #dcfce7;
  color: #15803d;
}
