/* =========================================
   TOPBAR.CSS - FINAL, COMPLETE & SAFE
   (All Missing Components Restored)
========================================= */

/* --- 1. BODY OFFSET --- */
body {
  padding-top: 84px;
}

/* --- 2. TOP BAR CONTAINER --- */
.top-bar {
  position: fixed;
  top: 14px;
  left: 14px;
  right: 14px;

  height: 56px;
  padding: 0 12px;

  display: flex;
  align-items: center;
  justify-content: space-between;

  border-radius: var(--card-radius);
  border: 1px solid var(--border);

  background: var(--card);
  backdrop-filter: blur(var(--card-blur));
  -webkit-backdrop-filter: blur(var(--card-blur));
  box-shadow: var(--card-shadow);

  z-index: 1001; /* Fixed Z-Index */
  
  transition:
    height var(--motion-base),
    padding var(--motion-base),
    opacity var(--motion-fast),
    border-radius var(--motion-base);
  transform: translateZ(0); 
}

/* --- 3. SHRINK MODE --- */
.top-bar.shrink {
  height: 38px;
  border-radius: 14px;
  padding: 0 10px;
  opacity: 0.95;
}

.top-bar.shrink .icon-btn,
.top-bar.shrink .setting-btn,
.top-bar.shrink .theme-btn {
  opacity: 0;
  pointer-events: none;
  transform: scale(0.8);
}

.top-bar.shrink .live-time {
  font-size: 13px;
  opacity: 0.9;
}

/* --- 4. CENTER TIME TYPOGRAPHY --- */
.top-center {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  left: 50%;
  transform: translateX(-50%);
  font-weight: 600;
}

.live-time {
  font-size: 15px;
  letter-spacing: 0.3px;
  color: var(--text);
  transition: font-size var(--motion-base), opacity var(--motion-fast);
}

/* --- 5. TOP BAR BUTTONS --- */
.icon-btn,
.setting-btn,
.theme-btn {
  width: 40px;
  height: 40px;

  display: flex;
  align-items: center;
  justify-content: center;

  border-radius: 12px;
  border: 1px solid var(--border);

  background: var(--card);
  backdrop-filter: blur(var(--card-blur));
  -webkit-backdrop-filter: blur(var(--card-blur));
  box-shadow: var(--shadow-sm);

  color: var(--text);
  cursor: pointer;

  transition:
    transform var(--motion-fast),
    background var(--motion-base),
    border-color var(--motion-base);
}

.icon-btn:active,
.setting-btn:active,
.theme-btn:active {
  transform: var(--action-active);
}

.top-actions {
  top: 14px;
  right: 14px;
  display: flex;
  align-items: center;
  gap: 5px;
}

/* --- 6. SVG ICONS & THEME TOGGLE --- */
.icon {
  position: absolute;
  width: 20px;
  height: 20px;
  stroke: var(--text);
  fill: none;
  pointer-events: none;

  transition:
    transform var(--motion-slow) cubic-bezier(.22,1,.36,1),
    opacity var(--motion-base);
}

.sun { opacity: 1; transform: rotate(0deg) scale(1); }
.moon { opacity: 0; transform: rotate(120deg) scale(0.6); }

body.light .sun { opacity: 0; transform: rotate(-120deg) scale(0.6); }
body.light .moon { opacity: 1; transform: rotate(0deg) scale(1); }

/* --- 7. TOP PANEL --- */
.top-panel {
  position: fixed;
  top: 80px;
  left: 14px;
  right: 14px;
  z-index: 999;

  opacity: 0;
  transform: translateY(-12px) scale(0.98);
  pointer-events: none;

  transition: 
    opacity var(--motion-fast),
    transform var(--motion-slow) cubic-bezier(.22,1,.36,1);
}

.top-panel.show {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

/* --- 8. PANEL INNER CARD --- */
.panel-card {
  border-radius: var(--card-radius);
  border: 1px solid var(--border);

  background: var(--card);
  backdrop-filter: blur(var(--card-blur));
  -webkit-backdrop-filter: blur(var(--card-blur));
  box-shadow: var(--card-shadow);

  padding: 14px 16px;

  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* --- 9. PANEL ROWS --- */
.panel-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
}

.panel-row:not(:last-child) {
  border-bottom: 1px dashed var(--border);
  padding-bottom: 6px;
}

.label {
  color: var(--text-soft);
  font-size: 13px;
}

#panelTime {
  font-weight: 600;
  font-size: 15px;
  color: var(--text);
}

/* RESTORED: Location & Weather Rows */
.location-row {
  margin-top: -4px;
}

#locationName {
  font-size: 12px;
  color: var(--text-soft);
  opacity: 0.8;
}

.weather-row {
  justify-content: center;
  text-align: center;
}

#cloudStatus {
  color: var(--accent);
  font-size: 13px;
  animation: pulse-weather 2.5s ease-in-out infinite;
}

@keyframes pulse-weather {
  0%, 100% { opacity: 0.7; }
  50% { opacity: 1; }
}

/* RESTORED: Theme Indicator */
.theme-indicator {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translate(-50%, -10px);

  background: var(--surface);
  color: var(--text);

  border: 1px solid var(--border);
  border-radius: 20px;

  padding: 6px 14px;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;

  opacity: 0;
  pointer-events: none;

  backdrop-filter: blur(var(--card-blur));
  -webkit-backdrop-filter: blur(var(--card-blur));
  box-shadow: var(--shadow-sm);

  transition:
  opacity var(--motion-base),
  transform var(--motion-base);
  z-index: 100;
}

.theme-indicator.show { opacity: 1; transform: translate(-50%, 6px); }
.theme-indicator.hide { opacity: 0; transform: translate(-50%, -6px); }

/* ===== CLOUD COMPONENT (Restored details) ===== */
.cloud-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
}

.cloud-icon {
  width: 16px;
  height: 16px;
  fill: currentColor;
  transition: all 0.25s ease;
}

/* STATES WITH DROP-SHADOW RESTORED */
.cloud-icon.online {
  color: #22c55e;
  filter: drop-shadow(0 0 6px rgba(34,197,94,0.6));
  animation: cloudPulse 1.6s infinite;
}

.cloud-icon.offline {
  color: #ef4444;
  filter: drop-shadow(0 0 6px rgba(239,68,68,0.6));
  animation: cloudBlink 1s infinite;
}

.cloud-icon.loading {
  color: #f59e0b;
  animation: cloudSpin 1s linear infinite;
}

/* ANIMATIONS */
@keyframes cloudPulse {
  0%, 100% { transform: scale(1); opacity: 0.7; }
  50% { transform: scale(1.25); opacity: 1; }
}

@keyframes cloudBlink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.2; }
}

@keyframes cloudSpin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* RESTORED: Cloud Text */
.cloud-text {
  white-space: nowrap;
}

/* --- NEW ACTION BUTTONS STYLE --- */
.btn-action {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 14px;
    border-radius: 12px;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--motion-fast);
    border: 1px solid transparent;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* मुख्य बटन: जैसे 'Start Next Day' */
.btn-primary {
    background: var(--btn-p-bg);
    color: var(--btn-p-text);
    box-shadow: var(--btn-p-shadow);
}

.btn-primary:active {
    transform: scale(0.96);
    box-shadow: none;
}

/* हल्का बटन: जैसे 'Close' या 'Cancel' */
.btn-ghost {
    background: var(--surface-2);
    border-color: var(--border);
    color: var(--text-soft);
    margin-top: 10px;
}

.btn-ghost:hover {
    background: var(--surface);
    color: var(--text);
    border-color: var(--text-soft);
}

.btn-ghost:active {
    transform: scale(0.96);
}

/* --- BACK / CLOSE ICON SWITCH --- */
.icon-btn {
  position: relative;
  z-index: 5;
  position: relative;
  overflow: hidden;
}
#backBtn .icon {
  position: absolute;
  width: 20px;
  height: 20px;
}
/* dono icons same jagah par */
#backBtn .icon {
  position: absolute;
  transition: 
    opacity var(--motion-base),
    transform var(--motion-slow) cubic-bezier(.22,1,.36,1);
}

/* default state (back visible) */
#icon-back {
  opacity: 1;
  transform: rotate(0deg) scale(1);
}

#icon-close {
  opacity: 0;
  transform: rotate(90deg) scale(0.6);
}

/* when active (close mode) */
#backBtn.close-mode #icon-back {
  opacity: 0;
  transform: rotate(-90deg) scale(0.6);
}

#backBtn.close-mode #icon-close {
  opacity: 1;
  transform: rotate(0deg) scale(1);
}