/* CSS Reset & Variable Definitions */
:root {
  --bg-dark: #eaf6f0; /* Soft Macaron Mint Green */
  --bg-panel: rgba(255, 255, 255, 0.7); /* Translucent white glass */
  --bg-card: rgba(255, 255, 255, 0.45);
  --bg-card-hover: rgba(255, 255, 255, 0.85);
  --border-glass: rgba(0, 0, 0, 0.05);
  --border-glass-bright: rgba(0, 0, 0, 0.1);
  
  --text-primary: #1e293b; /* Deep slate */
  --text-secondary: #475569; /* Slate secondary */
  --text-muted: #64748b; /* Slate muted */
  
  --primary: #f06a28; /* Warm Brand Orange from Logo */
  --primary-light: #f7854d;
  --primary-glow: rgba(240, 106, 40, 0.15);
  --primary-hover: #d85616;
  
  --accent: #5c60f5; /* Premium Indigo Accent */
  --accent-glow: rgba(92, 96, 245, 0.12);
  
  --success: #10b981;
  --success-glow: rgba(16, 185, 129, 0.12);
  --danger: #f43f5e;
  --danger-hover: #e11d48;
  --danger-glow: rgba(244, 63, 94, 0.12);

  --font-display: 'Outfit', 'Inter', system-ui, sans-serif;
  --font-body: 'Inter', 'Noto Sans SC', system-ui, sans-serif;
  
  --shadow-premium: 0 20px 40px -15px rgba(12, 45, 28, 0.06), 0 0 30px 0 rgba(240, 106, 40, 0.02);
  --shadow-inset: inset 0 1px 0 0 rgba(255, 255, 255, 0.6);
  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 8px;
}

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

body {
  background-color: var(--bg-dark);
  color: var(--text-primary);
  font-family: var(--font-body);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* Base custom scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg-dark);
}
::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.08);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.16);
}

/* Ambient Lights in Background */
.ambient-glow {
  position: fixed;
  border-radius: 50%;
  filter: blur(140px);
  z-index: -1;
  pointer-events: none;
  opacity: 0.75;
}
.glow-1 {
  width: 50vw;
  height: 50vw;
  left: -10vw;
  top: -10vw;
  background: radial-gradient(circle, var(--primary-glow) 0%, transparent 70%);
  animation: floatGlow 20s infinite alternate;
}
.glow-2 {
  width: 60vw;
  height: 60vw;
  right: -15vw;
  bottom: -15vw;
  background: radial-gradient(circle, var(--accent-glow) 0%, transparent 70%);
  animation: floatGlow 25s infinite alternate-reverse;
}

@keyframes floatGlow {
  0% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(3%, 5%) scale(1.1); }
  100% { transform: translate(-2%, -3%) scale(0.95); }
}

/* App Header Section */
.app-header {
  backdrop-filter: blur(16px);
  background-color: rgba(255, 255, 255, 0.65);
  border-bottom: 1px solid var(--border-glass);
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 0.85rem 2rem; /* slightly tighter header padding to look highly premium with the logo */
}
.header-container {
  max-width: 1300px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.logo-area {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.logo-img {
  height: 38px;
  width: auto;
  object-fit: contain;
}
.logo-divider {
  width: 1.5px;
  height: 22px;
  background: rgba(30, 41, 59, 0.15);
  margin: 0 0.5rem;
  display: inline-block;
}
.logo-text {
  font-family: var(--font-body); /* Noto Sans SC matches the Chinese text perfectly */
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--primary);
}

/* Premium Buttons Styling */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 600;
  padding: 0.65rem 1.25rem;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  outline: none;
  box-shadow: var(--shadow-inset);
}
.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-hover));
  color: #fff;
  border-color: rgba(255, 255, 255, 0.1);
  box-shadow: 0 4px 20px -4px var(--primary-glow);
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 24px -2px var(--primary-glow);
  filter: brightness(1.1);
}
.btn-primary:active {
  transform: translateY(0);
}
.btn-secondary {
  background: rgba(0, 0, 0, 0.04);
  color: var(--text-primary);
  border-color: var(--border-glass-bright);
}
.btn-secondary:hover {
  background: rgba(0, 0, 0, 0.08);
  transform: translateY(-2px);
}
.btn-tertiary {
  background: transparent;
  color: var(--text-secondary);
  border-color: transparent;
  box-shadow: none;
}
.btn-tertiary:hover {
  color: var(--text-primary);
  background: rgba(0, 0, 0, 0.04);
}
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}
.btn-icon {
  width: 18px;
  height: 18px;
}

/* App Main Container */
.app-main {
  max-width: 1300px;
  margin: 0 auto;
  padding: 2.5rem 2rem;
}

/* Toolbar & Filters */
.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1.5rem;
  margin-bottom: 2.5rem;
}
.search-bar {
  position: relative;
  flex: 1;
  max-width: 480px;
  min-width: 280px;
}
.search-icon {
  position: absolute;
  left: 1.1rem;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--text-muted);
  pointer-events: none;
  transition: color 0.3s;
}
.search-bar input {
  width: 100%;
  background: var(--bg-panel);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem 0.75rem 2.8rem;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.95rem;
  outline: none;
  transition: all 0.3s;
  backdrop-filter: blur(8px);
}
.search-bar input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 15px -3px var(--primary-glow);
}
.search-bar input:focus + .search-icon {
  color: var(--primary-light);
}

.sort-selector {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.sort-selector label {
  color: var(--text-secondary);
  font-size: 0.9rem;
}
.sort-selector select {
  background: var(--bg-panel);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 0.65rem 1.5rem 0.65rem 1rem;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.9rem;
  outline: none;
  cursor: pointer;
  transition: all 0.3s;
  backdrop-filter: blur(8px);
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' xmlns='http://www.w3.org/2000/svg'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 16px;
}
.sort-selector select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 15px -3px var(--primary-glow);
}

/* Card Grid Layout */
.grid-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 2rem;
  position: relative;
  min-height: 200px;
}

/* Courseware Cards CSS */
.courseware-card {
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow-premium), var(--shadow-inset);
  transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
  display: flex;
  flex-direction: column;
  height: 292px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.courseware-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  opacity: 0;
  transition: opacity 0.4s;
}

.courseware-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-glass-bright);
  transform: translateY(-6px);
  box-shadow: 0 25px 45px -12px rgba(12, 45, 28, 0.12), 0 0 25px 0 rgba(240, 106, 40, 0.08);
}

.courseware-card:hover::before {
  opacity: 1;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1rem;
}

.card-header.has-cover {
  display: block;
  height: 118px;
  margin: -1.5rem -1.5rem 1rem;
  overflow: hidden;
  position: relative;
}

.card-header.has-cover .btn-delete-card {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  background: rgba(255, 255, 255, 0.88);
  color: var(--text-secondary);
  border: 1px solid rgba(255, 255, 255, 0.75);
  backdrop-filter: blur(8px);
}

.card-cover {
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.04);
}

.card-cover img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.card-icon-box {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  background: rgba(240, 106, 40, 0.08);
  border: 1px solid rgba(240, 106, 40, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  transition: all 0.3s;
}

.courseware-card:hover .card-icon-box {
  background: var(--primary);
  color: #fff;
  transform: scale(1.05);
  box-shadow: 0 0 15px rgba(240, 106, 40, 0.2);
}

.card-icon {
  width: 24px;
  height: 24px;
}

/* Delete Card Button */
.btn-delete-card {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px;
  border-radius: 50%;
  transition: all 0.3s;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 5; /* click capability override */
}
.btn-delete-card:hover {
  background: var(--danger-glow);
  color: var(--danger);
  transform: scale(1.1);
}
.btn-delete-card svg {
  width: 18px;
  height: 18px;
}

.card-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 0.5rem;
}

.card-title {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 600;
  line-height: 1.4;
  color: var(--text-primary);
  word-break: break-all;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  height: 3.22rem;
  overflow: hidden;
  margin-bottom: 0;
}

.card-intro {
  color: var(--text-secondary);
  font-size: 0.86rem;
  line-height: 1.45;
  height: 1.25rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-top: -0.15rem;
}

.card-intro.is-empty {
  visibility: hidden;
}

.card-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: auto;
}

.card-date {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.card-size {
  background: rgba(255, 255, 255, 0.05);
  padding: 2px 6px;
  border-radius: 4px;
}

/* Loading Spinner */
.loading-spinner-container {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4rem 0;
  color: var(--text-secondary);
  gap: 1rem;
}
.spinner {
  width: 45px;
  height: 45px;
  border: 3.5px solid rgba(0, 0, 0, 0.05);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Empty State Styling */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 5rem 2rem;
  background: var(--bg-panel);
  border: 1px dashed var(--border-glass-bright);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(8px);
  max-width: 600px;
  margin: 2rem auto;
  box-shadow: var(--shadow-premium);
}
.empty-icon-container {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.03);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1.5rem;
  border: 1px solid var(--border-glass);
}
.empty-icon {
  width: 36px;
  height: 36px;
  color: var(--text-muted);
}
.empty-state h2 {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}
.empty-state p {
  color: var(--text-secondary);
  font-size: 0.95rem;
  margin-bottom: 1.5rem;
  max-width: 400px;
}

/* Modal Windows Setup */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(12, 30, 20, 0.35);
  backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 1;
  transition: opacity 0.3s;
}

.modal-card {
  background: #ffffff;
  border: 1px solid var(--border-glass-bright);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 520px;
  max-height: calc(100vh - 2rem);
  overflow-y: auto;
  box-shadow: 0 30px 60px -15px rgba(12, 45, 28, 0.15), 0 0 50px 0 rgba(240, 106, 40, 0.04);
  padding: 2rem;
  animation: modalScaleUp 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
  color: var(--text-primary);
}

@keyframes modalScaleUp {
  from { transform: scale(0.9) translateY(20px); opacity: 0; }
  to { transform: scale(1) translateY(0); opacity: 1; }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}
.modal-header h3 {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.btn-close {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 1.8rem;
  cursor: pointer;
  transition: color 0.3s;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  line-height: 1;
}
.btn-close:hover {
  color: var(--danger);
}

/* Forms CSS */
.form-group {
  margin-bottom: 1.5rem;
}
.label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.5rem;
}
.form-group label {
  display: block;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}
.label-row label {
  margin-bottom: 0;
}
.label-optional {
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 500;
}
.char-count {
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
}
.char-count.is-over {
  color: var(--danger);
}
.form-group input[type="text"] {
  width: 100%;
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.95rem;
  outline: none;
  transition: all 0.3s;
}
.form-group input[type="text"]:focus {
  border-color: var(--primary);
  box-shadow: 0 0 15px -3px var(--primary-glow);
}
.form-group input[type="text"].is-invalid {
  border-color: var(--danger);
  box-shadow: 0 0 15px -3px var(--danger-glow);
}

/* Optional Cover Upload */
.cover-upload-zone {
  min-height: 118px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: var(--radius-md);
  background: rgba(0, 0, 0, 0.02);
  cursor: pointer;
  overflow: hidden;
  position: relative;
  transition: border-color 0.3s, background 0.3s, box-shadow 0.3s;
}
.cover-upload-zone:hover {
  border-color: var(--primary-light);
  background: rgba(240, 106, 40, 0.04);
  box-shadow: 0 0 18px rgba(240, 106, 40, 0.05);
}
.cover-upload-placeholder {
  min-height: 118px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 0.55rem;
  padding: 1.2rem;
  color: var(--text-muted);
  text-align: center;
  font-size: 0.82rem;
}
.cover-upload-icon {
  width: 34px;
  height: 34px;
  color: var(--primary-light);
}
.cover-preview {
  position: absolute;
  inset: 0;
  background: #ffffff;
}
.cover-preview img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}
.cover-file-name {
  position: absolute;
  left: 0.75rem;
  bottom: 0.75rem;
  max-width: calc(100% - 4.5rem);
  padding: 0.25rem 0.55rem;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.88);
  color: var(--text-primary);
  font-size: 0.78rem;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  backdrop-filter: blur(8px);
}
.btn-remove-cover {
  position: absolute;
  top: 0.65rem;
  right: 0.65rem;
  width: 30px;
  height: 30px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  line-height: 1;
  transition: all 0.3s;
  backdrop-filter: blur(8px);
}
.btn-remove-cover:hover {
  background: var(--danger-glow);
  color: var(--danger);
}

/* Custom Drag and Drop zone */
.drag-drop-zone {
  border: 2px dashed rgba(0, 0, 0, 0.1);
  border-radius: var(--radius-md);
  padding: 2.2rem 1.5rem;
  text-align: center;
  cursor: pointer;
  background: rgba(0, 0, 0, 0.02);
  transition: all 0.3s;
  position: relative;
}
.drag-drop-zone.dragover {
  border-color: var(--primary-light);
  background: rgba(240, 106, 40, 0.06);
  box-shadow: 0 0 20px rgba(240, 106, 40, 0.05);
}
.hidden-file-input {
  display: none;
}
.upload-cloud-icon {
  width: 42px;
  height: 42px;
  color: var(--text-muted);
  margin-bottom: 1rem;
  transition: color 0.3s, transform 0.3s;
}
.drag-drop-zone:hover .upload-cloud-icon,
.drag-drop-zone.dragover .upload-cloud-icon {
  color: var(--primary-light);
  transform: translateY(-3px);
}
.drag-text-main {
  font-size: 0.92rem;
  font-weight: 500;
  margin-bottom: 0.3rem;
  color: var(--text-secondary);
}
.drag-text-main span {
  color: var(--primary-light);
  text-decoration: underline;
  font-weight: 600;
}
.drag-text-sub {
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* File Selected Status Inside D&D Area */
.file-status {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #ffffff;
  border-radius: var(--radius-md);
  border: 1px solid rgba(0, 0, 0, 0.05);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 1.5rem;
  animation: fadeIn 0.25s ease-out;
}
.file-icon {
  width: 32px;
  height: 32px;
  color: var(--primary-light);
}
.file-name {
  font-weight: 600;
  font-size: 0.95rem;
  max-width: 70%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.btn-remove-file {
  background: rgba(0, 0, 0, 0.04);
  border: none;
  color: var(--text-secondary);
  font-size: 1.3rem;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s;
}
.btn-remove-file:hover {
  background: var(--danger-glow);
  color: var(--danger);
}

/* Upload Progress */
.upload-progress-container {
  background: rgba(0, 0, 0, 0.01);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 1rem;
  margin-bottom: 1.5rem;
}
.progress-bar-bg {
  width: 100%;
  height: 6px;
  background: rgba(0, 0, 0, 0.05);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 0.6rem;
}
.progress-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  border-radius: 3px;
  transition: width 0.2s ease-out;
}
.progress-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
}
.progress-status {
  color: var(--text-secondary);
}
.progress-percent {
  font-weight: 700;
  color: var(--accent);
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 2rem;
}

/* Interactive Viewport Simulator Overlay */
.player-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: var(--bg-dark);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Top Bar Controls */
.player-controls {
  height: 60px;
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 1.5rem;
  z-index: 1010;
}
.player-title {
  font-family: var(--font-body);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
  max-width: 250px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.viewport-toggles {
  display: flex;
  background: rgba(0, 0, 0, 0.03);
  border: 1px solid rgba(0, 0, 0, 0.06);
  padding: 3px;
  border-radius: var(--radius-md);
  gap: 2px;
}

.viewport-btn {
  background: transparent;
  border: none;
  outline: none;
  cursor: pointer;
  padding: 0.45rem 1rem;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.82rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  transition: all 0.3s;
}
.viewport-btn svg {
  width: 16px;
  height: 16px;
}
.viewport-btn:hover {
  color: var(--text-primary);
}
.viewport-btn.active {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 2px 10px var(--primary-glow);
}

.player-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.action-btn {
  background: rgba(0, 0, 0, 0.03);
  border: 1px solid rgba(0, 0, 0, 0.06);
  color: var(--text-secondary);
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s;
}
.action-btn:hover {
  background: rgba(0, 0, 0, 0.06);
  color: var(--text-primary);
  transform: translateY(-1px);
}
.action-btn.btn-danger:hover {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}
.action-btn svg {
  width: 18px;
  height: 18px;
}

/* Viewport Simulator Wrapper */
.simulator-wrapper {
  flex: 1;
  background: var(--bg-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  overflow: auto;
  position: relative;
}

/* Beautiful Device Simulator Frame */
.device-frame {
  background: #000;
  width: 100%;
  height: 100%;
  border-radius: 0;
  overflow: hidden;
  box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.9);
  transition: width 0.4s cubic-bezier(0.25, 0.8, 0.25, 1), 
              height 0.4s cubic-bezier(0.25, 0.8, 0.25, 1), 
              border-radius 0.4s ease, 
              border 0.4s ease;
  position: relative;
}

.device-frame iframe {
  width: 100%;
  height: 100%;
  border: none;
  background: #fff;
}

/* Simulator Sizes definitions */
.device-frame.desktop {
  width: 100%;
  height: 100%;
  border: none;
  border-radius: 0;
}

.device-frame.tablet {
  width: 768px;
  height: 1024px;
  max-height: 100%;
  border: 12px solid #1e293b;
  border-radius: 28px;
}

.device-frame.mobile {
  width: 375px;
  height: 720px;
  max-height: 100%;
  border: 12px solid #1e293b;
  border-radius: 36px;
}

/* Fullscreen Simulation override */
.player-overlay.fullscreen-mode {
  padding: 0;
}
.player-overlay.fullscreen-mode .player-controls {
  display: none; /* Hide controls in pure fullscreen */
}
.player-overlay.fullscreen-mode .simulator-wrapper {
  padding: 0;
}
.player-overlay.fullscreen-mode .device-frame {
  width: 100% !important;
  height: 100% !important;
  border: none !important;
  border-radius: 0 !important;
}

/* Floating escape helper in pure fullscreen */
.btn-exit-fullscreen-helper {
  position: fixed;
  top: 1.5rem;
  right: 1.5rem;
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  border-radius: 50%;
  width: 42px;
  height: 42px;
  font-size: 1.2rem;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(8px);
  z-index: 2000;
  transition: background 0.3s, transform 0.3s;
}
.btn-exit-fullscreen-helper:hover {
  background: var(--danger);
  transform: scale(1.1);
}

/* Toast Notifications System */
.toast-container {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  z-index: 2000;
}
.toast {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-left: 4px solid var(--primary);
  border-radius: var(--radius-md);
  padding: 0.85rem 1.5rem;
  color: var(--text-primary);
  backdrop-filter: blur(10px);
  box-shadow: 0 15px 35px -5px rgba(12, 45, 28, 0.1);
  font-size: 0.88rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 250px;
  max-width: 400px;
  animation: toastSlideIn 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  transition: all 0.3s;
}

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

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

/* Hidden Utility */
.hidden {
  display: none !important;
}

/* Responsive Utilities */
@media (max-width: 640px) {
  .app-header {
    padding: 1rem;
  }
  .header-container {
    flex-direction: column;
    gap: 1rem;
    align-items: stretch;
  }
  .logo-area {
    justify-content: center;
  }
  .app-main {
    padding: 1.5rem 1rem;
  }
  .toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 1rem;
  }
  .search-bar {
    max-width: 100%;
  }
  .sort-selector {
    justify-content: space-between;
  }
  .viewport-toggles span {
    display: none; /* Hide device labels on small devices to keep bar clean */
  }
}
