/* =========================================================
   JAM (Jendela Aplikasi Madrasah) - Desktop Environment & Widgets
   ========================================================= */

#desktop-container {
  position: relative;
  width: 100vw;
  height: calc(100vh - var(--taskbar-height));
  overflow: hidden;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  transition: background-image 0.5s ease;
}

/* Subtle overlay gradient to match Android Q / DeX style */
#desktop-overlay {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 80% 20%, rgba(56, 189, 248, 0.08) 0%, transparent 60%),
              linear-gradient(180deg, rgba(9, 13, 22, 0.2) 0%, rgba(9, 13, 22, 0.5) 100%);
  pointer-events: none;
  z-index: 1;
}

/* Desktop Widgets Layer */
.desktop-widgets-layer {
  position: absolute;
  inset: 0;
  padding: 28px 36px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  pointer-events: none;
  z-index: var(--z-desktop-widgets);
}

.desktop-widget {
  pointer-events: auto;
}

/* Search Bar Widget (Top Left) */
.widget-search-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface-panel);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-full);
  padding: 8px 18px;
  width: 380px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.4);
  transition: all var(--duration-normal) var(--ease-spring);
}

.widget-search-bar:focus-within {
  border-color: var(--primary);
  box-shadow: 0 10px 30px -5px var(--primary-glow);
  width: 420px;
}

.search-brand-icon {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-full);
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  color: #2563eb;
  font-size: 15px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.widget-search-input {
  flex: 1;
  background: transparent;
  color: var(--text-main);
  font-size: 14px;
}

.widget-search-input::placeholder {
  color: var(--text-muted);
}

.search-mic-btn {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: all var(--duration-fast);
}

.search-mic-btn:hover {
  background: var(--surface-hover);
  color: var(--primary);
}

/* Weather & Clock Widget (Top Right) */
.widget-info-card {
  background: var(--surface-panel);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 16px 22px;
  min-width: 250px;
  box-shadow: var(--glass-shadow);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.weather-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.weather-condition {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-main);
}

.weather-location {
  font-size: 12px;
  color: var(--text-dim);
  max-width: 170px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.weather-icon-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.weather-icon-wrapper:hover {
  background: rgba(255, 255, 255, 0.08);
  transform: scale(1.08);
}

.weather-icon-dynamic {
  width: 32px;
  height: 32px;
}

.weather-icon-sun {
  animation: spin-sun-slow 30s linear infinite;
}

@keyframes spin-sun-slow {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* Pengaturan Wilayah di Modal */
.region-settings-box {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 12px 14px;
  margin-top: 6px;
}

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

.region-card-subtitle {
  font-size: 11px;
  color: var(--text-dim);
  display: block;
}

.btn-detect-gps {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.35);
  border-radius: 6px;
  color: #38bdf8;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.btn-detect-gps:hover {
  background: rgba(56, 189, 248, 0.25);
  color: #fff;
  border-color: #38bdf8;
}

.region-inputs-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 10px;
}

.region-input-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  display: block;
  margin-bottom: 4px;
}

.region-field {
  padding: 8px 10px;
  font-size: 12px;
}

.coords-display-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 11px;
}

.coords-tag {
  color: var(--text-dim);
  margin-right: 5px;
}

.coords-text {
  color: #38bdf8;
  font-family: monospace;
  font-size: 11px;
}

.btn-lookup-coords {
  background: none;
  border: none;
  color: #94a3b8;
  font-size: 11px;
  cursor: pointer;
  padding: 3px 8px;
  border-radius: 4px;
  transition: all 0.2s;
}

.btn-lookup-coords:hover {
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.1);
}

/* Map Picker Modal & Controls */
.map-search-toolbar {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 10px;
}

.map-search-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(56, 189, 248, 0.3);
  border-radius: var(--radius-md);
  padding: 0 12px;
  transition: all 0.2s ease;
}

.map-search-input-wrapper:focus-within {
  border-color: #38bdf8;
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.25);
}

.map-search-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(56, 189, 248, 0.2);
  border-top-color: #38bdf8;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  flex-shrink: 0;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Autocomplete Suggestions Dropdown ala Google Maps */
.map-search-suggestions {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: #0f172a;
  border: 1px solid rgba(56, 189, 248, 0.4);
  border-radius: 8px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.7);
  z-index: 10000;
  max-height: 220px;
  overflow-y: auto;
}

.map-suggestion-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  cursor: pointer;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  transition: background 0.15s ease;
}

.map-suggestion-item:last-child {
  border-bottom: none;
}

.map-suggestion-item:hover,
.map-suggestion-item.active {
  background: rgba(56, 189, 248, 0.14);
}

.map-suggestion-icon {
  color: #38bdf8;
  margin-top: 2px;
  flex-shrink: 0;
}

.map-suggestion-content {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

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

.map-suggestion-subtitle {
  font-size: 11px;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.map-suggestion-empty {
  padding: 12px;
  text-align: center;
  font-size: 11.5px;
  color: var(--text-dim);
}

.map-search-input {
  width: 100%;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-main);
  font-size: 12px;
  padding: 8px 0;
}

.btn-map-search {
  padding: 8px 14px;
  background: var(--primary);
  color: #0f172a;
  font-weight: 600;
  font-size: 12px;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.btn-map-search:hover {
  background: var(--primary-hover);
}

.btn-open-gmaps {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 8px 12px;
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.35);
  border-radius: var(--radius-md);
  color: #38bdf8;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.btn-open-gmaps:hover {
  background: rgba(56, 189, 248, 0.25);
  color: #fff;
}

.map-picker-view {
  width: 100%;
  height: 290px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  overflow: hidden;
  position: relative;
  background: #0f172a;
}

/* Leaflet dark custom styles */
.leaflet-container {
  font-family: var(--font-sans) !important;
}

.map-detected-panel {
  margin-top: 10px;
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 10px 12px;
}

.map-detected-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  padding-bottom: 6px;
}

.map-detected-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
}

.map-detected-coords {
  font-family: monospace;
  font-size: 11px;
  color: #38bdf8;
}

.map-detected-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px 12px;
}

.map-detected-item {
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-size: 11px;
}

.detected-lbl {
  color: var(--text-dim);
  font-size: 10.5px;
  min-width: 80px;
}

.detected-val {
  color: var(--text-main);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pulse-ring {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 0 rgba(16, 185, 129, 0.4);
  animation: pulse-ring-anim 1.5s infinite;
}

@keyframes pulse-ring-anim {
  0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
  100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.weather-temp {
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.5px;
}

.madrasah-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 600;
  color: #34d399;
}

/* Cloud Sync Badge */
.cloud-sync-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: rgba(15, 23, 42, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--duration-fast);
  user-select: none;
}

.cloud-sync-badge.connected {
  background: rgba(16, 185, 129, 0.12);
  border-color: rgba(16, 185, 129, 0.35);
  color: #34d399;
}

.cloud-sync-badge.connecting {
  background: rgba(245, 158, 11, 0.12);
  border-color: rgba(245, 158, 11, 0.35);
  color: #fbbf24;
}

.cloud-sync-badge.status-error {
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.35);
  color: #f87171;
}

.cloud-sync-badge:hover {
  background: rgba(56, 189, 248, 0.15);
  border-color: rgba(56, 189, 248, 0.4);
  color: #ffffff;
  transform: translateY(-1px);
}

.cloud-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
  transition: all var(--duration-fast);
}

.cloud-dot.status-connected {
  background: #10b981;
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.7);
}

.cloud-dot.status-connecting {
  background: #f59e0b;
  box-shadow: 0 0 8px rgba(245, 158, 11, 0.7);
  animation: pulse-dot 1.2s infinite ease-in-out;
}

.cloud-dot.status-offline {
  background: #94a3b8;
}

.cloud-dot.status-error {
  background: #ef4444;
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.7);
}

@keyframes pulse-dot {
  0% { transform: scale(0.9); opacity: 0.6; }
  50% { transform: scale(1.2); opacity: 1; }
  100% { transform: scale(0.9); opacity: 0.6; }
}

/* Desktop Shortcuts (Grid on Left) */
.desktop-shortcuts-grid {
  position: absolute;
  top: 96px;
  left: 36px;
  display: flex;
  flex-direction: column;
  flex-wrap: wrap;
  gap: 20px;
  max-height: calc(100vh - 200px);
  z-index: var(--z-desktop-icons);
}

.desktop-shortcut {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 82px;
  padding: 8px 6px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--duration-fast);
}

.desktop-shortcut:hover {
  background: rgba(255, 255, 255, 0.12);
  transform: translateY(-2px);
}

.desktop-shortcut:active {
  transform: scale(0.96);
}

.shortcut-icon-wrapper {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.35);
  overflow: hidden;
  transition: transform var(--duration-fast);
}

.desktop-shortcut:hover .shortcut-icon-wrapper {
  transform: scale(1.05);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.45);
}

.shortcut-icon-wrapper img, 
.shortcut-icon-wrapper svg {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.shortcut-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-main);
  text-align: center;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
  word-break: break-word;
  max-width: 80px;
  line-height: 1.2;
}

/* Desktop Shortcut: Add New App Card */
.desktop-shortcut-add {
  opacity: 0.9;
  border: none;
  background: transparent;
}

.desktop-shortcut-add:hover {
  opacity: 1;
  background: rgba(255, 255, 255, 0.06);
}

.shortcut-add-icon {
  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);
}

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

.desktop-shortcut-add .shortcut-label {
  color: #7dd3fc;
  font-weight: 600;
}

.desktop-shortcut-add:hover .shortcut-label {
  color: #ffffff;
  text-shadow: 0 0 8px rgba(56, 189, 248, 0.6);
}

