/* 1. Global Keyframes (Εκτός @media ώστε να είναι έγκυρο παντού) */
@keyframes mw-mobile-avatar-pulse-red {
  0%, 100% { 
    border-color: #333333; 
    box-shadow: 0 0 0 rgba(239, 68, 68, 0); 
  }
  50% { 
    border-color: #ef4444; 
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.9); 
  }
}

/* 2. Απόλυτο κλείδωμα σε desktop */
.custom-mobile-bar, 
.mobile-profile-sheet, 
.mw-logout-overlay { 
  display: none !important; 
}

/* 3. Κινητά & Tablet (Έως 1024px) */
@media screen and (max-width: 1024px) {
  body { 
    padding-bottom: calc(64px + env(safe-area-inset-bottom, 0px)) !important; 
  }

  .custom-mobile-bar {
    display: flex !important; 
    justify-content: space-around !important; 
    align-items: center !important; 
    position: fixed !important; 
    bottom: 0 !important; 
    left: 0 !important; 
    right: 0 !important; 
    width: 100% !important; 
    min-width: 100vw !important; 
    height: calc(64px + env(safe-area-inset-bottom, 0px)) !important; 
    background: #000000 !important; 
    border-top: 1.5px solid #1f1f1f !important; 
    z-index: 99998 !important; 
    padding-bottom: env(safe-area-inset-bottom, 0px) !important; 
    box-sizing: border-box !important; 
  }

  .custom-mobile-bar .bar-item {
    flex: 1; 
    display: flex; 
    flex-direction: column; 
    align-items: center; 
    justify-content: center; 
    text-decoration: none; 
    color: #cccccc; 
    background: transparent !important; 
    border: none; 
    cursor: pointer; 
    padding: 4px 2px; 
    gap: 4px; 
    font-size: 11.5px; 
    font-weight: 700; 
    line-height: 1; 
    font-family: inherit; 
    transition: color 0.15s ease, transform 0.12s ease; 
    -webkit-tap-highlight-color: transparent; 
    position: relative; 
    outline: none !important; 
    z-index: 2;
  }

  /* SVG Icons: 24px */
  .custom-mobile-bar .bar-item svg { 
    width: 24px !important; 
    height: 24px !important; 
    stroke: currentColor; 
    fill: none; 
    stroke-width: 2.1; 
    stroke-linecap: round; 
    stroke-linejoin: round; 
    transition: transform 0.12s ease; 
  }

  .custom-mobile-bar .bar-item:active, 
  .custom-mobile-bar .bar-item:hover { 
    color: #ffffff; 
  }

  .custom-mobile-bar .bar-item:active { 
    transform: scale(1.1); 
  }

  /* Μικρότερο εικονίδιο & κείμενο αναζήτησης */
  button#bar-finder-trigger.bar-item svg {
    width: 17px !important;
    height: 17px !important;
    min-width: 17px !important;
    min-height: 17px !important;
  }

  button#bar-finder-trigger.bar-item span {
    font-size: 10px !important;
    line-height: 1 !important;
  }
    
  /* Σημαίες & Ενδείξεις Γλώσσας */
  .bar-item.bar-lang-item {
    padding: 2px 4px !important; 
    justify-content: center; 
    gap: 2px !important;
  }
  .bar-item.bar-lang-item .flag-emoji {
    font-size: 16px !important; 
    line-height: 1; 
    display: block; 
    opacity: 0.65; 
    filter: grayscale(35%); 
    transition: transform 0.2s ease, opacity 0.2s ease, filter 0.2s ease; 
  }
  .bar-item.bar-lang-item .lang-code {
    font-size: 8.5px !important;
    line-height: 1 !important;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: #888888;
    transition: color 0.2s ease, opacity 0.2s ease;
  }

  /* Ενεργή Γλώσσα */
  .bar-item.bar-lang-item.is-active-lang {
    pointer-events: none !important; /* Απενεργοποιεί πλήρως τα clicks και touches */
    cursor: default !important;
  }
  .bar-item.bar-lang-item.is-active-lang .flag-emoji {
    opacity: 1 !important; 
    filter: grayscale(0%) !important; 
    transform: scale(1.1); 
  }
  .bar-item.bar-lang-item.is-active-lang .lang-code {
    color: #ffffff !important;
  }

  /* Κόκκινη γραμμή σύνδεσης */
  .bar-center-bridge-line {
    position: absolute !important;
    bottom: 4px !important;
    left: 31% !important;
    right: 31% !important;
    height: 2px !important;
    border-radius: 999px !important;
    pointer-events: none !important;
    z-index: 5 !important;
    display: block !important;
    transform: translateZ(0) !important;
    -webkit-transform: translateZ(0) !important;
    transition: background 0.3s ease, box-shadow 0.3s ease !important;
  }

  /* Ελληνικά -> Αριστερό φως */
  .custom-mobile-bar.lang-is-el .bar-center-bridge-line {
    background: linear-gradient(90deg, 
      rgba(225, 29, 72, 0.65) 0%, 
      rgba(225, 29, 72, 0.4) 45%, 
      rgba(225, 29, 72, 0.15) 100%
    ) !important;
    box-shadow: -3px 0 6px rgba(225, 29, 72, 0.4) !important;
  }

  /* Αγγλικά -> Δεξί φως */
  .custom-mobile-bar.lang-is-en .bar-center-bridge-line {
    background: linear-gradient(90deg, 
      rgba(225, 29, 72, 0.15) 0%, 
      rgba(225, 29, 72, 0.4) 55%, 
      rgba(225, 29, 72, 0.65) 100%
    ) !important;
    box-shadow: 3px 0 6px rgba(225, 29, 72, 0.4) !important;
  }

  /* Avatar Προφίλ */
  .bar-avatar-wrap { 
    position: relative; 
    display: inline-flex; 
    align-items: center; 
    justify-content: center; 
    width: 30px !important; 
    height: 30px !important; 
  }
  .bar-avatar-img { 
    width: 30px !important; 
    height: 30px !important; 
    border-radius: 50%; 
    object-fit: cover; 
    border: 2px solid #333333; 
    display: block; 
    transition: border-color 0.25s, box-shadow 0.25s; 
  }
  .bar-avatar-placeholder { 
    font-size: 22px !important; 
    line-height: 1; 
  }
  .bar-status-dot { 
    position: absolute; 
    bottom: 0px; 
    right: 0px; 
    width: 8px; 
    height: 8px; 
    background-color: #22c55e; 
    border-radius: 50%; 
    border: 1.5px solid #000000; 
    box-shadow: 0 0 5px rgba(34, 197, 94, 0.9); 
  }
  
  .bar-avatar-img.has-unread-pulse { 
    animation: mw-mobile-avatar-pulse-red 1.2s ease-in-out infinite !important; 
    border-color: #ef4444 !important; 
  }
  
  .bar-unread-badge { 
    display: none; 
    position: absolute !important; 
    top: -5px !important; 
    right: -7px !important; 
    background: #dc2626 !important; 
    color: #ffffff !important; 
    font-size: 10px !important; 
    font-weight: 900 !important; 
    border-radius: 50% !important; 
    width: 17px !important; 
    height: 17px !important; 
    align-items: center !important; 
    justify-content: center !important; 
    border: 1.5px solid #000000 !important; 
    line-height: 1 !important; 
    z-index: 99 !important; 
  }
  .bar-unread-badge.is-visible { display: flex !important; }
  
  .mobile-profile-sheet { 
    display: none; 
    position: fixed; 
    bottom: calc(66px + env(safe-area-inset-bottom, 0px)); 
    right: 8px; 
    width: calc(100% - 16px); 
    max-width: 330px; 
    background: #0a0a0a !important; 
    border: 1px solid #1f1f1f !important; 
    border-radius: 14px; 
    box-shadow: 0 -10px 35px rgba(0, 0, 0, 0.95); 
    z-index: 99997; 
    overflow: hidden; 
    box-sizing: border-box; 
  }
  .mobile-profile-sheet.is-open { display: block !important; }
  .mobile-profile-sheet-header { padding: 14px 16px; background: #000000 !important; border-bottom: 1px solid #1f1f1f !important; }
  .mobile-profile-sheet-list { list-style: none !important; margin: 0 !important; padding: 6px 0 !important; }
  .mobile-profile-sheet-list a { display: flex; align-items: center; justify-content: space-between; padding: 11px 16px; color: #cccccc !important; font-size: 13.5px; font-weight: 600; text-decoration: none !important; }
  .mobile-profile-sheet-list a:hover { background: #171717 !important; color: #ffffff !important; }
  .mobile-profile-sheet-list .profile-logout-item a { color: #ef4444 !important; border-top: 1px solid #1f1f1f !important; margin-top: 4px; }
  
  .mw-logout-overlay { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; background: rgba(0, 0, 0, 0.85); backdrop-filter: blur(6px); align-items: center; justify-content: center; z-index: 9999999; padding: 16px; box-sizing: border-box; }
  .mw-logout-overlay.is-active { display: flex !important; }
  .mw-logout-box { background: #0d0d0d; border: 1px solid #222222; border-radius: 14px; padding: 26px 24px; width: 100%; max-width: 360px; text-align: center; color: #ffffff; }
  .mw-logout-icon-wrap { width: 52px; height: 52px; border-radius: 50%; background: rgba(220, 38, 38, 0.12); border: 1px solid rgba(220, 38, 38, 0.3); display: inline-flex; align-items: center; justify-content: center; font-size: 24px; margin-bottom: 14px; }
  .mw-logout-title { margin: 0 0 8px 0; font-size: 17px; font-weight: 800; }
  .mw-logout-desc { margin: 0 0 22px 0; font-size: 13px; color: #94a3b8; }
  .mw-logout-actions { display: flex; gap: 10px; }
  .mw-logout-btn-confirm { flex: 1; padding: 11px; background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%); color: #ffffff !important; border: none; border-radius: 8px; font-size: 13.5px; font-weight: 800; cursor: pointer; text-decoration: none !important; display: inline-flex; align-items: center; justify-content: center; }
  .mw-logout-btn-cancel { flex: 1; padding: 11px; background: #171717; border: 1px solid #2e2e2e; color: #cbd5e1; border-radius: 8px; font-size: 13.5px; font-weight: 700; cursor: pointer; }

  .elementor-popup-modal { 
    top: 0 !important; 
    bottom: calc(64px + env(safe-area-inset-bottom, 0px)) !important; 
    padding: 0 !important; 
  }
}