/* Decks - Apple & Google Style Design System */
:root {
  --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Google Sans", "Plus Jakarta Sans", -apple-system, sans-serif;
  --font-mono: "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;

  /* Apple Light Palette */
  --bg-app: #fbfbfd;
  --bg-card: #ffffff;
  --bg-card-hover: #ffffff;
  --bg-subtle: #f5f5f7;
  --bg-active: #e8e8ed;
  --border-hairline: rgba(0, 0, 0, 0.08);
  --border-card: rgba(0, 0, 0, 0.06);

  --text-main: #1d1d1f;
  --text-secondary: #6e6e73;
  --text-tertiary: #86868b;

  --accent: #0071e3;
  --accent-hover: #0077ed;
  --accent-light: rgba(0, 113, 227, 0.08);

  --badge-public-bg: #e8f0fe;
  --badge-public-text: #1967d2;
  --badge-pass-bg: #fef7e0;
  --badge-pass-text: #b06000;
  --badge-internal-bg: #f1f3f4;
  --badge-internal-text: #5f6368;

  --nav-height: 64px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-pill: 9999px;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.04);
  --shadow-card: 0 4px 18px -2px rgba(0, 0, 0, 0.05), 0 2px 6px -1px rgba(0, 0, 0, 0.02);
  --shadow-card-hover: 0 12px 30px -4px rgba(0, 0, 0, 0.1), 0 4px 12px -2px rgba(0, 0, 0, 0.04);
  --shadow-modal: 0 24px 60px -10px rgba(0, 0, 0, 0.25);
}

[data-theme="dark"] {
  --bg-app: #000000;
  --bg-card: #1c1c1e;
  --bg-card-hover: #242426;
  --bg-subtle: #161618;
  --bg-active: #2c2c2e;
  --border-hairline: rgba(255, 255, 255, 0.08);
  --border-card: rgba(255, 255, 255, 0.06);

  --text-main: #f5f5f7;
  --text-secondary: #a1a1a6;
  --text-tertiary: #86868b;

  --accent: #2997ff;
  --accent-hover: #47a3ff;
  --accent-light: rgba(41, 151, 255, 0.15);

  --badge-public-bg: rgba(66, 133, 244, 0.18);
  --badge-public-text: #8ab4f8;
  --badge-pass-bg: rgba(251, 188, 4, 0.18);
  --badge-pass-text: #fdd663;
  --badge-internal-bg: rgba(255, 255, 255, 0.1);
  --badge-internal-text: #bdc1c6;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.4);
  --shadow-card: 0 4px 20px rgba(0, 0, 0, 0.4);
  --shadow-card-hover: 0 14px 36px rgba(0, 0, 0, 0.6);
  --shadow-modal: 0 30px 80px rgba(0, 0, 0, 0.8);
}

*, *::before, *::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0;
  background-color: var(--bg-app);
  color: var(--text-main);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.5;
  transition: background-color 0.25s ease, color 0.25s ease;
}

/* ==========================================================================
   Header & Navigation (Apple Glassmorphism)
   ========================================================================== */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--nav-height);
  background: rgba(251, 251, 253, 0.82);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid var(--border-hairline);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  transition: background 0.25s ease;
}

[data-theme="dark"] .app-header {
  background: rgba(0, 0, 0, 0.78);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--text-main);
  user-select: none;
}

.brand-icon {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  box-shadow: 0 2px 8px rgba(0, 113, 227, 0.25);
}

.brand-name {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.brand-sub {
  font-size: 13px;
  color: var(--text-tertiary);
  margin-left: 2px;
  font-weight: 500;
}

/* Google / Apple Style Search Capsule */
.search-capsule {
  position: relative;
  width: 380px;
  max-width: 100%;
}

.search-input {
  width: 100%;
  height: 40px;
  padding: 0 40px 0 38px;
  background: var(--bg-subtle);
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  font-family: inherit;
  font-size: 14px;
  color: var(--text-main);
  outline: none;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.search-input:focus {
  background: var(--bg-card);
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}

.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-tertiary);
  pointer-events: none;
}

.search-shortcut {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 11px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 6px;
  background: var(--border-hairline);
  color: var(--text-tertiary);
  pointer-events: none;
}

/* Right Nav Controls */
.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.btn-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-pill);
  background: transparent;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all 0.15s ease;
}

.btn-icon:hover {
  background: var(--bg-subtle);
  color: var(--text-main);
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 18px;
  background: var(--accent);
  color: #ffffff;
  font-size: 14px;
  font-weight: 600;
  border-radius: var(--radius-pill);
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 2px 8px rgba(0, 113, 227, 0.2);
}

.btn-primary:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 113, 227, 0.3);
}

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

.user-avatar-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-pill);
  background: linear-gradient(135deg, #0071e3, #60a5fa);
  color: #ffffff;
  font-size: 14px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  cursor: pointer;
  position: relative;
}

/* ==========================================================================
   Main Content Layout
   ========================================================================== */
.main-wrapper {
  max-width: 1440px;
  margin: 0 auto;
  padding: 32px 36px 64px 36px;
}

/* Top Sub-bar: Category Tabs & Filters */
.toolbar-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
  gap: 16px;
  flex-wrap: wrap;
}

.category-tabs {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-subtle);
  padding: 5px;
  border-radius: var(--radius-pill);
  overflow-x: auto;
}

.category-tab {
  padding: 7px 16px;
  border-radius: var(--radius-pill);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  background: transparent;
  border: none;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.category-tab:hover {
  color: var(--text-main);
}

.category-tab.active {
  background: var(--bg-card);
  color: var(--text-main);
  box-shadow: var(--shadow-sm);
}

.view-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.select-pill {
  padding: 8px 14px;
  background: var(--bg-subtle);
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  color: var(--text-main);
  font-size: 13px;
  font-weight: 500;
  outline: none;
  cursor: pointer;
  transition: all 0.15s ease;
}

.select-pill:focus {
  background: var(--bg-card);
  border-color: var(--accent);
}

/* ==========================================================================
   Deck Card Grid (The Showcase)
   ========================================================================== */
.deck-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 26px;
}

.deck-card {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  position: relative;
  text-decoration: none;
  color: inherit;
}

.deck-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-card-hover);
  border-color: rgba(0, 113, 227, 0.3);
}

/* 16:9 Slide Preview Container */
.deck-thumb-wrap {
  width: 100%;
  aspect-ratio: 16 / 9;
  position: relative;
  overflow: hidden;
  background: #111;
}

.deck-thumb-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.deck-card:hover .deck-thumb-img {
  transform: scale(1.02);
}

/* Visibility Pill Badge on Preview */
.badge-visibility {
  position: absolute;
  top: 14px;
  right: 14px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 600;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.badge-public {
  background: var(--badge-public-bg);
  color: var(--badge-public-text);
}

.badge-password {
  background: var(--badge-pass-bg);
  color: var(--badge-pass-text);
}

.badge-internal {
  background: var(--badge-internal-bg);
  color: var(--badge-internal-text);
}

/* Card Content Area */
.deck-content {
  padding: 20px 22px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.deck-category {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent);
  margin-bottom: 6px;
}

.deck-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.02em;
  margin: 0 0 8px 0;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.deck-desc {
  font-size: 13.5px;
  color: var(--text-secondary);
  margin: 0 0 16px 0;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.deck-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: auto;
  margin-bottom: 16px;
}

.tag-chip {
  font-size: 11.5px;
  font-weight: 500;
  padding: 3px 9px;
  border-radius: 6px;
  background: var(--bg-subtle);
  color: var(--text-secondary);
}

/* Bottom Card Meta Line */
.deck-footer {
  padding-top: 14px;
  border-top: 1px solid var(--border-hairline);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12.5px;
  color: var(--text-tertiary);
}

.footer-author {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 500;
  color: var(--text-secondary);
}

.footer-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-card-action {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  color: var(--text-tertiary);
  transition: all 0.15s ease;
}

.btn-card-action:hover {
  background: var(--bg-subtle);
  color: var(--text-main);
}

/* ==========================================================================
   Apple Sheet / Modal Dialogs
   ========================================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.modal-overlay.active {
  display: flex;
  opacity: 1;
}

.modal-card {
  background: var(--bg-card);
  border: 1px solid var(--border-hairline);
  border-radius: 24px;
  box-shadow: var(--shadow-modal);
  width: 100%;
  max-width: 620px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 32px 36px;
  transform: scale(0.96);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-overlay.active .modal-card {
  transform: scale(1);
}

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

.modal-head h2 {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0;
}

.btn-close {
  background: var(--bg-subtle);
  border: none;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-pill);
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
}

.btn-close:hover {
  background: var(--bg-active);
  color: var(--text-main);
}

/* Form Controls */
.form-group {
  margin-bottom: 20px;
}

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

.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  background: var(--bg-subtle);
  border: 1px solid transparent;
  color: var(--text-main);
  font-family: inherit;
  font-size: 14.5px;
  outline: none;
  transition: all 0.2s ease;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  background: var(--bg-card);
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}

/* File Drop Zone (Apple Style) */
.dropzone {
  border: 2px dashed var(--border-hairline);
  border-radius: var(--radius-lg);
  padding: 36px 20px;
  text-align: center;
  cursor: pointer;
  background: var(--bg-subtle);
  transition: all 0.2s ease;
}

.dropzone:hover, .dropzone.dragover {
  border-color: var(--accent);
  background: var(--accent-light);
}

.dropzone-icon {
  width: 44px;
  height: 44px;
  margin-bottom: 12px;
  color: var(--accent);
}

.dropzone-text {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 4px;
}

.dropzone-sub {
  font-size: 12.5px;
  color: var(--text-tertiary);
}

/* Visibility Switcher Radio Grid */
.visibility-options {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.vis-card {
  border: 1.5px solid var(--border-hairline);
  border-radius: var(--radius-md);
  padding: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
}

.vis-card.selected {
  border-color: var(--accent);
  background: var(--accent-light);
}

.vis-card-title {
  font-size: 13.5px;
  font-weight: 600;
  display: block;
  margin-bottom: 4px;
}

.vis-card-desc {
  font-size: 11.5px;
  color: var(--text-tertiary);
  line-height: 1.35;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 80px 24px;
}

.empty-icon {
  width: 64px;
  height: 64px;
  color: var(--text-tertiary);
  margin-bottom: 16px;
}

.empty-title {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 8px;
}

.empty-desc {
  color: var(--text-secondary);
  font-size: 14px;
  max-width: 400px;
  margin: 0 auto 24px auto;
}
