/* ============================================
   WEATHER SECTION
   ============================================ */

#section-weather {
  padding: 2rem 0 3rem;
}

.weather-container {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 1.5rem;
  align-items: start;
  margin-top: 1.5rem;
}

/* Main Santiago Card */
.weather-main {
  background: linear-gradient(145deg, #1a0a00 0%, #2d1200 40%, #1a0800 100%);
  border: 1px solid rgba(255, 140, 0, 0.2);
  border-radius: 20px;
  padding: 2rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  position: relative;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 140, 0, 0.1);
  min-height: 260px;
}

.weather-main::before {
  content: '';
  position: absolute;
  top: -60px;
  right: -60px;
  width: 200px;
  height: 200px;
  background: radial-gradient(circle, rgba(255, 120, 0, 0.15) 0%, transparent 70%);
  pointer-events: none;
}

.weather-main-icon {
  font-size: 4rem;
  line-height: 1;
  filter: drop-shadow(0 0 20px rgba(255, 160, 0, 0.5));
  animation: weatherPulse 3s ease-in-out infinite;
  text-align: center;
}

@keyframes weatherPulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.08); opacity: 0.9; }
}

.weather-main-info {
  flex: 1;
}

.weather-location {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: rgba(255, 160, 50, 0.8);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 0.5rem;
}

.weather-location .icon {
  width: 14px;
  height: 14px;
}

.weather-temp {
  font-size: 4rem;
  font-weight: 800;
  color: #fff;
  line-height: 1;
  margin: 0.3rem 0;
  font-family: 'Bebas Neue', sans-serif;
  letter-spacing: 2px;
}

.weather-desc {
  font-size: 1rem;
  color: rgba(255, 255, 255, 0.7);
  margin-bottom: 1.2rem;
  text-transform: capitalize;
}

.weather-details {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
}

.weather-detail {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 10px;
  padding: 0.5rem 0.75rem;
  border: 1px solid rgba(255, 140, 0, 0.1);
}

.weather-detail strong {
  font-size: 0.6rem;
  letter-spacing: 1px;
  color: rgba(255, 140, 0, 0.7);
  font-weight: 700;
}

.weather-detail span {
  font-size: 0.95rem;
  font-weight: 700;
  color: #fff;
}

/* Cities Grid */
.weather-cities {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

.weather-city-card {
  background: linear-gradient(135deg, rgba(30, 10, 0, 0.9) 0%, rgba(20, 5, 0, 0.95) 100%);
  border: 1px solid rgba(255, 120, 0, 0.12);
  border-radius: 14px;
  padding: 1.1rem 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  cursor: default;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
  position: relative;
  overflow: hidden;
}

.weather-city-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,120,0,0.04) 0%, transparent 60%);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.weather-city-card:hover {
  transform: translateY(-3px);
  border-color: rgba(255, 120, 0, 0.3);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.weather-city-card:hover::before {
  opacity: 1;
}

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

.weather-city-name {
  font-size: 0.85rem;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.9);
}

.weather-city-icon {
  font-size: 1.5rem;
  filter: drop-shadow(0 0 6px rgba(255, 160, 0, 0.4));
}

.weather-city-temp {
  font-size: 1.9rem;
  font-weight: 800;
  color: #fff;
  font-family: 'Bebas Neue', sans-serif;
  letter-spacing: 1px;
  line-height: 1;
}

.weather-city-desc {
  font-size: 0.72rem;
  color: rgba(255, 255, 255, 0.5);
  text-transform: capitalize;
}

/* Weather loading shimmer */
.weather-shimmer {
  background: linear-gradient(90deg,
    rgba(255,255,255,0.05) 0%,
    rgba(255,255,255,0.1) 50%,
    rgba(255,255,255,0.05) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 6px;
  height: 1em;
  display: inline-block;
}

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

/* ============================================
   CHAT FLOAT BUTTON
   ============================================ */

.chat-float-btn {
  position: fixed;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 46px;
  height: 56px;
  border-radius: 0 12px 12px 0;
  background: linear-gradient(160deg, #ff6b00 0%, #ff9500 100%);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 9000;
  box-shadow: 3px 0 20px rgba(255, 107, 0, 0.45);
  transition: width 0.25s ease, box-shadow 0.25s ease, transform 0.25s ease;
  animation: chatBtnEntrance 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) 1s both;
}

/* Tooltip label next to button */
.chat-float-btn::after {
  content: 'Chat en vivo';
  position: absolute;
  left: calc(100% + 8px);
  top: 50%;
  transform: translateY(-50%) translateX(-4px);
  background: rgba(20, 10, 0, 0.92);
  border: 1px solid rgba(255, 120, 0, 0.3);
  color: rgba(255,255,255,0.9);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  padding: 0.35rem 0.7rem;
  border-radius: 8px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.chat-float-btn:hover {
  width: 52px;
  box-shadow: 4px 0 28px rgba(255, 107, 0, 0.65);
}

.chat-float-btn:hover::after {
  opacity: 1;
  transform: translateY(-50%) translateX(0);
}

.chat-float-btn:active {
  transform: translateY(-50%) scale(0.95);
}

@keyframes chatBtnEntrance {
  from { transform: translateY(-50%) translateX(-120%); opacity: 0; }
  to   { transform: translateY(-50%) translateX(0);     opacity: 1; }
}

.chat-float-btn svg {
  width: 26px;
  height: 26px;
}

.chat-float-btn:hover {
  transform: scale(1.12);
  box-shadow: 0 6px 28px rgba(255, 107, 0, 0.7);
}

.chat-float-btn:active {
  transform: scale(0.95);
}

.chat-float-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 20px;
  height: 20px;
  border-radius: 10px;
  background: #e63946;
  color: #fff;
  font-size: 0.65rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  border: 2px solid var(--body-bg, #0e0e0e);
  transition: transform 0.2s ease;
}

.chat-float-badge.bump {
  animation: badgeBump 0.3s ease;
}

@keyframes badgeBump {
  0% { transform: scale(1); }
  50% { transform: scale(1.4); }
  100% { transform: scale(1); }
}

/* Pulse ring when there are messages */
.chat-float-btn.has-messages::after {
  content: '';
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 2px solid rgba(255, 107, 0, 0.5);
  animation: chatRing 2s ease-out infinite;
}

@keyframes chatRing {
  0% { transform: scale(1); opacity: 1; }
  100% { transform: scale(1.5); opacity: 0; }
}

/* ============================================
   CHAT PANEL
   ============================================ */

.chat-panel {
  position: fixed;
  left: 0;
  top: 80px;
  height: calc(100vh - 80px);
  width: 440px;
  max-width: 100vw;
  background: linear-gradient(180deg, #0f0f0f 0%, #131313 100%);
  border-right: 1px solid rgba(255, 120, 0, 0.18);
  border-top: 1px solid rgba(255, 120, 0, 0.12);
  box-shadow: 4px 0 40px rgba(0, 0, 0, 0.65);
  border-radius: 0 0 16px 0;
  z-index: 9100;
  display: flex;
  flex-direction: column;
  transform: translateX(-110%);
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: transform;
}

.chat-panel.is-open {
  transform: translateX(0);
}

.chat-overlay {
  position: fixed;
  inset: 80px 0 0 0;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(2px);
  z-index: 9050;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.chat-overlay.is-visible {
  opacity: 1;
  pointer-events: all;
}

/* CHAT HEADER */
.chat-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  background: linear-gradient(90deg, rgba(255,107,0,0.12) 0%, transparent 100%);
  border-bottom: 1px solid rgba(255, 120, 0, 0.15);
  flex-shrink: 0;
}

.chat-panel-title {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.5px;
}

.chat-panel-title svg {
  width: 20px;
  height: 20px;
  color: #ff8800;
}

.chat-panel-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.chat-change-name-btn,
.chat-panel-close {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  color: rgba(255,255,255,0.7);
  cursor: pointer;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, color 0.2s;
}

.chat-change-name-btn svg,
.chat-panel-close svg {
  width: 16px;
  height: 16px;
}

.chat-change-name-btn:hover {
  background: rgba(255,150,0,0.2);
  color: #ff9500;
  border-color: rgba(255,120,0,0.3);
}

.chat-panel-close:hover {
  background: rgba(255,60,60,0.2);
  color: #ff6b6b;
}

/* ---- AVATAR ---- */
.chat-avatar {
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  color: #fff;
  flex-shrink: 0;
  letter-spacing: 0;
  text-transform: uppercase;
  box-shadow: 0 2px 6px rgba(0,0,0,0.35);
}

/* ---- MESSAGE ROW (avatar + bubble side by side) ---- */
.chat-msg-row {
  display: flex;
  align-items: flex-end;
  gap: 0.5rem;
}

.chat-msg-col {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.chat-msg.is-me .chat-msg-row {
  flex-direction: row-reverse;
}


/* CHAT LOGIN */
.chat-login {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.5rem;
  text-align: center;
  gap: 0.8rem;
}

.chat-login-icon {
  font-size: 3.5rem;
  animation: floatIcon 3s ease-in-out infinite;
}

@keyframes floatIcon {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

.chat-login h3 {
  font-size: 1.3rem;
  font-weight: 800;
  color: #fff;
  margin: 0;
}

.chat-login p {
  font-size: 0.82rem;
  color: rgba(255,255,255,0.5);
  line-height: 1.6;
  max-width: 260px;
  margin: 0;
}

.chat-login-form {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

.chat-login-form input {
  width: 100%;
  padding: 0.8rem 1rem;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,120,0,0.2);
  border-radius: 12px;
  color: #fff;
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s, background 0.2s;
  box-sizing: border-box;
}

.chat-login-form input:focus {
  border-color: rgba(255,120,0,0.6);
  background: rgba(255,255,255,0.09);
}

.chat-login-form input::placeholder {
  color: rgba(255,255,255,0.3);
}

.chat-login-btn {
  width: 100%;
  padding: 0.8rem 1rem;
  background: linear-gradient(135deg, #ff6b00, #ff9500);
  color: #fff;
  border: none;
  border-radius: 12px;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: opacity 0.2s, transform 0.2s;
  letter-spacing: 0.5px;
}

.chat-login-btn svg {
  width: 18px;
  height: 18px;
}

.chat-login-btn:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

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

/* CHAT MAIN */
.chat-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
}

/* Users Bar */
.chat-users-bar {
  padding: 0.6rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
  flex-wrap: wrap;
  background: rgba(255,120,0,0.04);
}

.chat-users-label {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.72rem;
  font-weight: 700;
  color: rgba(255,140,0,0.8);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

.chat-users-label svg {
  width: 13px;
  height: 13px;
}

.chat-users-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.chat-user-pill {
  background: rgba(255,120,0,0.12);
  border: 1px solid rgba(255,120,0,0.2);
  border-radius: 999px;
  padding: 0.2rem 0.55rem;
  font-size: 0.68rem;
  font-weight: 600;
  color: rgba(255,255,255,0.85);
  display: flex;
  align-items: center;
  gap: 0.3rem;
  animation: pillIn 0.3s ease;
}

@keyframes pillIn {
  from { transform: scale(0.7); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.chat-user-pill::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #4caf50;
  flex-shrink: 0;
  box-shadow: 0 0 6px rgba(76,175,80,0.6);
  animation: onlinePulse 2s ease-in-out infinite;
}

@keyframes onlinePulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.chat-user-pill.is-me {
  background: rgba(255,107,0,0.2);
  border-color: rgba(255,107,0,0.4);
  color: #ff9500;
}

/* Messages */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  min-height: 0;
}

.chat-msg {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  max-width: 85%;
  animation: msgIn 0.25s ease;
}

@keyframes msgIn {
  from { transform: translateY(10px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.chat-msg.is-me {
  align-self: flex-end;
  align-items: flex-end;
}

.chat-msg.is-system {
  align-self: center;
  align-items: center;
  max-width: 100%;
}

.chat-msg-author {
  font-size: 0.68rem;
  font-weight: 700;
  color: #ff8800;
  padding: 0 0.3rem;
}

.chat-msg.is-me .chat-msg-author {
  color: rgba(255,255,255,0.5);
}

.chat-msg-bubble {
  padding: 0.55rem 0.9rem;
  border-radius: 16px;
  font-size: 0.85rem;
  line-height: 1.5;
  word-break: break-word;
  background: rgba(255,255,255,0.07);
  color: rgba(255,255,255,0.9);
  border: 1px solid rgba(255,255,255,0.06);
  border-bottom-left-radius: 4px;
}

.chat-msg.is-me .chat-msg-bubble {
  background: linear-gradient(135deg, rgba(255,107,0,0.25), rgba(255,149,0,0.2));
  border-color: rgba(255,120,0,0.25);
  border-bottom-right-radius: 4px;
  border-bottom-left-radius: 16px;
}

.chat-msg.is-system .chat-msg-bubble {
  background: rgba(255,255,255,0.04);
  border-radius: 999px;
  font-size: 0.72rem;
  color: rgba(255,255,255,0.4);
  border: none;
  padding: 0.3rem 0.8rem;
}

.chat-msg-time {
  font-size: 0.62rem;
  color: rgba(255,255,255,0.25);
  padding: 0 0.3rem;
}

/* Chat Input */
.chat-input-bar {
  display: flex;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  border-top: 1px solid rgba(255,255,255,0.06);
  background: rgba(0,0,0,0.3);
  flex-shrink: 0;
}

.chat-input-bar input {
  flex: 1;
  padding: 0.7rem 1rem;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,120,0,0.15);
  border-radius: 12px;
  color: #fff;
  font-size: 0.85rem;
  outline: none;
  transition: border-color 0.2s;
}

.chat-input-bar input:focus {
  border-color: rgba(255,120,0,0.5);
}

.chat-input-bar input::placeholder {
  color: rgba(255,255,255,0.25);
}

.chat-send-btn {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: linear-gradient(135deg, #ff6b00, #ff9500);
  border: none;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform 0.2s, opacity 0.2s;
}

.chat-send-btn svg {
  width: 18px;
  height: 18px;
}

.chat-send-btn:hover {
  transform: scale(1.08);
}

.chat-send-btn:active {
  transform: scale(0.95);
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 900px) {
  .weather-container {
    grid-template-columns: 1fr;
  }

  .weather-main {
    flex-direction: row;
    align-items: center;
    min-height: auto;
    padding: 1.5rem;
    gap: 1.5rem;
  }

  .weather-main-icon {
    font-size: 3rem;
  }

  .weather-temp {
    font-size: 3rem;
  }

  .weather-cities {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 640px) {
  .weather-cities {
    grid-template-columns: repeat(2, 1fr);
  }

  .weather-main {
    flex-direction: column;
    text-align: center;
  }

  .weather-details {
    grid-template-columns: repeat(2, 1fr);
  }

  .chat-panel {
    width: 100vw;
  }
}

@media (max-width: 400px) {
  .weather-cities {
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
  }
}
