/* =========================================================
   JAM (Jendela Aplikasi Madrasah) - Modern OS Start Menu
   ========================================================= */

#app-drawer.start-menu-panel,
#app-drawer {
  position: fixed;
  bottom: calc(var(--taskbar-height) + 10px);
  left: 12px;
  width: min(620px, calc(100vw - 24px));
  height: min(590px, calc(100vh - var(--taskbar-height) - 20px));
  max-height: calc(100vh - var(--taskbar-height) - 20px);
  max-width: calc(100vw - 24px);
  background: #0f172a;
  background: rgba(15, 23, 42, 0.94);
  backdrop-filter: blur(28px);
  -webkit-backdrop-filter: blur(28px);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: var(--radius-xl);
  box-shadow: 0 24px 60px -12px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.08);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 2000;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(18px) scale(0.97);
  transition: all var(--duration-normal) var(--ease-spring);
}

#app-drawer.open {
  opacity: 1 !important;
  visibility: visible !important;
  pointer-events: auto !important;
  transform: translateY(0) scale(1) !important;
}

/* ---------------------------------------------------------
   1. Header Profil Madrasah & Sesi
   --------------------------------------------------------- */
.start-menu-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px 14px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.04) 0%, transparent 100%);
}

.start-user-profile {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.start-profile-avatar {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
  flex-shrink: 0;
  transition: transform var(--duration-fast) var(--ease-spring);
}

.start-profile-avatar:hover {
  transform: scale(1.06);
}

.start-profile-logo {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.start-profile-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.start-madrasah-title {
  font-family: var(--font-display);
  font-size: 14.5px;
  font-weight: 700;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: 0.2px;
}

.start-user-greeting {
  font-size: 11.5px;
  color: var(--text-muted);
  font-weight: 500;
}

.start-header-status {
  flex-shrink: 0;
}

.start-cloud-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 12px;
  background: rgba(15, 23, 42, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all var(--duration-fast);
  user-select: none;
}

.start-cloud-chip:hover {
  background: rgba(30, 41, 59, 0.85);
  border-color: rgba(56, 189, 248, 0.4);
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.2);
}

.start-cloud-text {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
}

/* ---------------------------------------------------------
   2. Spotlight Quick Search Bar (Atas)
   --------------------------------------------------------- */
.start-search-section {
  padding: 14px 20px 8px 20px;
}

.start-search-box {
  position: relative;
  display: flex;
  align-items: center;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-full);
  padding: 9px 16px;
  transition: all var(--duration-fast);
}

.start-search-box:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 16px var(--primary-glow);
  background: rgba(0, 0, 0, 0.5);
}

.start-search-icon {
  width: 17px;
  height: 17px;
  color: var(--text-muted);
  margin-right: 10px;
  flex-shrink: 0;
}

.start-search-input {
  flex: 1;
  background: transparent;
  color: var(--text-main);
  font-size: 13px;
  border: none;
  outline: none;
}

.start-search-input::placeholder {
  color: var(--text-dim);
}

.start-search-clear-btn {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-muted);
  border: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  cursor: pointer;
  transition: all var(--duration-fast);
  margin-left: 8px;
}

.start-search-clear-btn:hover {
  background: rgba(255, 255, 255, 0.25);
  color: #ffffff;
}

/* ---------------------------------------------------------
   3. Navigation View Switcher (Tabs: Pinned vs Semua Aplikasi)
   --------------------------------------------------------- */
.start-nav-tabs {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 20px 10px 20px;
}

.start-nav-tab {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
  font-family: var(--font-display);
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--duration-fast);
  user-select: none;
}

.start-nav-tab:hover {
  background: var(--surface-hover);
  color: var(--text-main);
}

.start-nav-tab.active {
  background: rgba(16, 185, 129, 0.18);
  border-color: rgba(16, 185, 129, 0.45);
  color: #34d399;
  box-shadow: 0 2px 10px rgba(16, 185, 129, 0.2);
}

/* ---------------------------------------------------------
   4. Area Konten Start Menu (Scrollable)
   --------------------------------------------------------- */
.start-content-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 4px 20px 12px 20px;
}

.start-content-scroll::-webkit-scrollbar {
  width: 5px;
}

.start-content-scroll::-webkit-scrollbar-track {
  background: transparent;
}

.start-content-scroll::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-full);
}

.start-view-container {
  display: flex;
  flex-direction: column;
}

.start-section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.start-heading-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

.start-view-all-link {
  background: transparent;
  border: none;
  color: var(--primary);
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  transition: color var(--duration-fast);
  padding: 2px 4px;
}

.start-view-all-link:hover {
  color: #7dd3fc;
  text-decoration: underline;
}

/* Grid Aplikasi (Pinned & All Apps) */
.start-pinned-grid,
.drawer-apps-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px 8px;
}

.drawer-app-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  padding: 10px 4px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--duration-fast);
  text-align: center;
  position: relative;
}

.drawer-app-card:hover {
  background: var(--surface-hover);
  transform: translateY(-2px);
}

.drawer-app-card:active {
  transform: scale(0.96);
}

.drawer-app-icon-box {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  transition: all var(--duration-fast);
  overflow: hidden;
}

.drawer-app-card:hover .drawer-app-icon-box {
  transform: scale(1.08);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45);
}

.drawer-app-icon-box img,
.drawer-app-icon-box svg {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.drawer-app-name {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-main);
  max-width: 82px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: 0.1px;
}

/* Kartu Tambah Web App (+) */
.drawer-add-app-card {
  border: none;
  background: transparent;
}

.drawer-add-app-card:hover {
  background: rgba(255, 255, 255, 0.05);
}

.drawer-add-icon-box {
  background: rgba(56, 189, 248, 0.08);
  border: 1.5px solid rgba(56, 189, 248, 0.35);
  color: #38bdf8;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--duration-fast) var(--ease-spring);
}

.drawer-add-app-card:hover .drawer-add-icon-box {
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.28), rgba(56, 189, 248, 0.16));
  border-color: #38bdf8;
  color: #ffffff;
  transform: scale(1.08);
  box-shadow: 0 0 16px rgba(56, 189, 248, 0.45), 0 4px 12px rgba(0, 0, 0, 0.4);
}

.drawer-add-app-card .drawer-app-name {
  color: #7dd3fc;
  font-weight: 600;
}

.drawer-add-app-card:hover .drawer-app-name {
  color: #ffffff;
}

/* ---------------------------------------------------------
   Section: Baru Digunakan (Recent Apps List)
   --------------------------------------------------------- */
.start-recent-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.start-recent-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  cursor: pointer;
  transition: all var(--duration-fast);
}

.start-recent-item:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.14);
  transform: translateX(3px);
}

.start-recent-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.start-recent-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.start-recent-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.start-recent-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.start-recent-title {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.start-recent-meta {
  font-size: 11px;
  color: var(--text-dim);
}

.start-recent-arrow {
  color: var(--text-dim);
  font-size: 14px;
  transition: transform var(--duration-fast);
}

.start-recent-item:hover .start-recent-arrow {
  color: var(--primary);
  transform: translateX(2px);
}

.start-recent-empty {
  padding: 14px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.02);
  border: 1px dashed rgba(255, 255, 255, 0.07);
  text-align: center;
  color: var(--text-dim);
  font-size: 11.5px;
}

/* Category Filter Tabs di All Apps View */
.start-categories-bar {
  display: flex;
  gap: 6px;
  margin-bottom: 14px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.start-categories-bar::-webkit-scrollbar {
  display: none;
}

.category-tab {
  padding: 5px 12px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid transparent;
  white-space: nowrap;
  transition: all var(--duration-fast);
  cursor: pointer;
}

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

.category-tab.active {
  background: var(--primary);
  color: var(--text-inverse);
  box-shadow: 0 2px 10px var(--primary-glow);
}

/* ---------------------------------------------------------
   5. Footer Quick Actions & Power Bar (Bawah)
   --------------------------------------------------------- */
.start-menu-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.3);
}

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

.start-footer-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: var(--radius-md);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
  font-family: var(--font-display);
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--duration-fast);
  user-select: none;
}

.start-footer-btn:hover {
  background: var(--surface-hover);
  color: var(--text-main);
  border-color: rgba(255, 255, 255, 0.1);
  transform: translateY(-1px);
}

.start-footer-btn.btn-power:hover {
  background: rgba(239, 68, 68, 0.18);
  color: #f87171;
  border-color: rgba(239, 68, 68, 0.35);
}

.start-footer-btn svg {
  flex-shrink: 0;
}

/* ---------------------------------------------------------
   Responsiveness untuk Monitor / Resolusi Laptop Kecil
   --------------------------------------------------------- */
@media (max-height: 720px) {
  #app-drawer.start-menu-panel,
  #app-drawer {
    height: 500px;
    bottom: calc(var(--taskbar-height) + 8px);
  }

  .start-pinned-grid,
  .drawer-apps-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}
