/*
 * Geo Region Switcher — Frontend Styles
 * =====================================================================
 * Design: clean, modern, minimal with subtle depth.
 * Uses CSS custom properties so themes can override colours easily.
 * =====================================================================
 */

/* -----------------------------------------------------------------------
   CSS Custom Properties
   --------------------------------------------------------------------- */
:root {
    --grs-accent:        #1a6cf5;
    --grs-accent-hover:  #1458cc;
    --grs-bg:            #ffffff;
    --grs-text:          #1a1a2e;
    --grs-subtext:       #555e73;
    --grs-border:        #dde1ea;
    --grs-shadow:        0 8px 40px rgba(0, 0, 0, .18);
    --grs-radius:        14px;
    --grs-overlay-bg:    rgba(10, 12, 30, .55);
    --grs-font:          -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --grs-transition:    220ms cubic-bezier(.4, 0, .2, 1);
    --grs-z:             99999;
}

/* -----------------------------------------------------------------------
   Overlay
   --------------------------------------------------------------------- */
.grs-popup-overlay {
    position:         fixed;
    inset:            0;
    background:       var(--grs-overlay-bg);
    z-index:          var(--grs-z);
    display:          flex;
    align-items:      center;
    justify-content:  center;
    padding:          16px;
    opacity:          0;
    animation:        grsOverlayIn var(--grs-transition) forwards;
    animation-delay:  .4s;
    backdrop-filter:  blur(3px);
    -webkit-backdrop-filter: blur(3px);
}

.grs-popup-overlay.grs-hidden {
    pointer-events: none;
    opacity:        0 !important;
    transition:     opacity var(--grs-transition);
}

/* -----------------------------------------------------------------------
   Popup card
   --------------------------------------------------------------------- */
.grs-popup {
    background:    var(--grs-bg);
    border-radius: var(--grs-radius);
    box-shadow:    var(--grs-shadow);
    padding:       36px 32px 30px;
    max-width:     420px;
    width:         100%;
    position:      relative;
    font-family:   var(--grs-font);
    text-align:    center;
    transform:     translateY(24px) scale(.96);
    opacity:       0;
    animation:     grsPopupIn 350ms cubic-bezier(.34, 1.56, .64, 1) forwards;
    animation-delay: .45s;
}

/* -----------------------------------------------------------------------
   Close button
   --------------------------------------------------------------------- */
.grs-popup__close {
    position:   absolute;
    top:        14px;
    right:      16px;
    background: transparent;
    border:     none;
    cursor:     pointer;
    font-size:  18px;
    color:      var(--grs-subtext);
    line-height: 1;
    padding:    4px 6px;
    border-radius: 6px;
    transition: color var(--grs-transition), background var(--grs-transition);
}
.grs-popup__close:hover,
.grs-popup__close:focus-visible {
    color:       var(--grs-text);
    background:  var(--grs-border);
    outline:     none;
}

/* -----------------------------------------------------------------------
   Flag
   --------------------------------------------------------------------- */
.grs-popup__flag {
    font-size:     52px;
    line-height:   1;
    margin-bottom: 12px;
}

/* -----------------------------------------------------------------------
   Typography
   --------------------------------------------------------------------- */
.grs-popup__title {
    font-size:     1.25rem;
    font-weight:   700;
    color:         var(--grs-text);
    margin:        0 0 10px;
    line-height:   1.3;
}
.grs-popup__message {
    font-size:     .938rem;
    color:         var(--grs-subtext);
    margin:        0 0 24px;
    line-height:   1.55;
}

/* -----------------------------------------------------------------------
   Action buttons
   --------------------------------------------------------------------- */
.grs-popup__actions {
    display:        flex;
    flex-direction: column;
    gap:            10px;
}

.grs-btn {
    display:         inline-flex;
    align-items:     center;
    justify-content: center;
    border-radius:   9px;
    font-size:       .938rem;
    font-weight:     600;
    padding:         11px 20px;
    cursor:          pointer;
    text-decoration: none;
    transition:      background var(--grs-transition), color var(--grs-transition),
                     transform var(--grs-transition), box-shadow var(--grs-transition);
    border:          2px solid transparent;
}
.grs-btn:active { transform: scale(.97); }

.grs-btn--primary {
    background:  var(--grs-accent);
    color:       #fff;
    box-shadow:  0 2px 12px rgba(26, 108, 245, .35);
}
.grs-btn--primary:hover,
.grs-btn--primary:focus-visible {
    background:  var(--grs-accent-hover);
    box-shadow:  0 4px 18px rgba(26, 108, 245, .45);
    outline:     none;
    color:       #fff;
}

.grs-btn--secondary {
    background:  transparent;
    color:       var(--grs-subtext);
    border-color: var(--grs-border);
}
.grs-btn--secondary:hover,
.grs-btn--secondary:focus-visible {
    background:  var(--grs-border);
    color:       var(--grs-text);
    outline:     none;
}

/* -----------------------------------------------------------------------
   Region Switcher — Dropdown
   --------------------------------------------------------------------- */
.grs-switcher {
    display:    inline-block;
    font-family: var(--grs-font);
    font-size:  .875rem;
    position:   relative;
}

.grs-dropdown {
    position: relative;
    display:  inline-block;
}

.grs-dropdown__trigger {
    display:         inline-flex;
    align-items:     center;
    gap:             6px;
    background:      var(--grs-bg);
    border:          1.5px solid var(--grs-border);
    border-radius:   8px;
    padding:         7px 12px;
    cursor:          pointer;
    font-size:       .875rem;
    font-weight:     500;
    color:           var(--grs-text);
    transition:      border-color var(--grs-transition), box-shadow var(--grs-transition);
    white-space:     nowrap;
}
.grs-dropdown__trigger:hover,
.grs-dropdown__trigger:focus-visible {
    border-color: var(--grs-accent);
    box-shadow:   0 0 0 3px rgba(26,108,245,.15);
    outline:      none;
}

.grs-dropdown__arrow {
    font-size:  10px;
    transition: transform var(--grs-transition);
    color:      var(--grs-subtext);
}
.grs-dropdown--open .grs-dropdown__arrow {
    transform: rotate(180deg);
}

.grs-dropdown__menu {
    position:     absolute;
    top:          calc(100% + 6px);
    left:         0;
    z-index:      var(--grs-z);
    background:   var(--grs-bg);
    border:       1.5px solid var(--grs-border);
    border-radius: 10px;
    box-shadow:   0 6px 24px rgba(0,0,0,.12);
    list-style:   none;
    margin:       0;
    padding:      6px;
    min-width:    180px;
    display:      none;
    animation:    grsDropdownIn 160ms ease;
}
.grs-dropdown--open .grs-dropdown__menu {
    display: block;
}

.grs-dropdown__item {
    display:        flex;
    align-items:    center;
    gap:            8px;
    padding:        8px 10px;
    border-radius:  7px;
    color:          var(--grs-text);
    text-decoration: none;
    transition:     background var(--grs-transition);
    white-space:    nowrap;
    cursor:         pointer;
}
.grs-dropdown__item:hover {
    background: #f0f4ff;
    color:      var(--grs-accent);
}
.grs-dropdown__item--active {
    font-weight: 600;
    color:       var(--grs-accent);
}

/* -----------------------------------------------------------------------
   Region Switcher — List style
   --------------------------------------------------------------------- */
.grs-list {
    list-style:  none;
    margin:      0;
    padding:     0;
    display:     flex;
    flex-wrap:   wrap;
    gap:         6px;
}
.grs-list__item a {
    display:        flex;
    align-items:    center;
    gap:            6px;
    color:          var(--grs-text);
    text-decoration: none;
    font-size:      .875rem;
    padding:        4px 0;
    transition:     color var(--grs-transition);
}
.grs-list__item a:hover { color: var(--grs-accent); }
.grs-list__item--active a {
    font-weight: 600;
    color:       var(--grs-accent);
}

/* -----------------------------------------------------------------------
   Region Switcher — Pills style
   --------------------------------------------------------------------- */
.grs-pills {
    display:   flex;
    flex-wrap: wrap;
    gap:       6px;
}
.grs-pill {
    display:        inline-flex;
    align-items:    center;
    gap:            5px;
    padding:        5px 12px;
    border-radius:  20px;
    border:         1.5px solid var(--grs-border);
    color:          var(--grs-text);
    text-decoration: none;
    font-size:      .8125rem;
    font-weight:    500;
    transition:     all var(--grs-transition);
}
.grs-pill:hover {
    border-color: var(--grs-accent);
    color:        var(--grs-accent);
    background:   #f0f4ff;
}
.grs-pill--active {
    background:   var(--grs-accent);
    border-color: var(--grs-accent);
    color:        #fff;
}

/* -----------------------------------------------------------------------
   Shared
   --------------------------------------------------------------------- */
.grs-flag {
    font-size:   1.1em;
    line-height: 1;
    flex-shrink: 0;
}

/* -----------------------------------------------------------------------
   Keyframes
   --------------------------------------------------------------------- */
@keyframes grsOverlayIn {
    to { opacity: 1; }
}
@keyframes grsPopupIn {
    to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes grsDropdownIn {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* -----------------------------------------------------------------------
   Geo message — fixed top / bottom bar
   --------------------------------------------------------------------- */
.grs-banner {
    position:   fixed;
    left:       0;
    right:      0;
    z-index:    99990;
    font-family: var(--grs-font);
    font-size:   0.9375rem;
    line-height: 1.45;
    box-shadow:  0 2px 12px rgba(0, 0, 0, .12);
    transition:  opacity 0.25s ease, transform 0.25s ease;
}

.grs-banner--top {
    top: 0;
}

.grs-banner--bottom {
    bottom: 0;
    box-shadow: 0 -2px 12px rgba(0, 0, 0, .1);
}

body.admin-bar .grs-banner--top {
    top: 32px;
}

@media screen and (max-width: 782px) {
    body.admin-bar .grs-banner--top {
        top: 46px;
    }
}

.grs-banner.grs-hidden {
    opacity:        0;
    pointer-events: none;
}

.grs-banner--top.grs-hidden {
    transform: translateY(-100%);
}

.grs-banner--bottom.grs-hidden {
    transform: translateY(100%);
}

/* Light bar (default) */
.grs-banner--light {
    --grs-banner-surface: #f5f5f7;
    --grs-banner-text:    var(--grs-text);
    --grs-banner-muted:   var(--grs-subtext);
    --grs-banner-edge:    #d2d4da;
    background:           var(--grs-banner-surface);
    color:                  var(--grs-banner-text);
    border-bottom:          1px solid var(--grs-banner-edge);
}

.grs-banner--bottom.grs-banner--light {
    border-bottom: none;
    border-top:    1px solid var(--grs-banner-edge);
}

/* Dark bar */
.grs-banner--dark {
    --grs-banner-surface: #2c2c2e;
    --grs-banner-text:   #ffffff;
    --grs-banner-muted:   #e8e8ed;
    --grs-banner-edge:   rgba(255, 255, 255, 0.12);
    background:          var(--grs-banner-surface);
    color:               var(--grs-banner-text);
    border-bottom:       1px solid var(--grs-banner-edge);
}

.grs-banner--bottom.grs-banner--dark {
    border-bottom: none;
    border-top:    1px solid var(--grs-banner-edge);
}

.grs-banner__inner {
    max-width:     1200px;
    margin:        0 auto;
    padding:       12px 20px;
    display:       flex;
    flex-wrap:     wrap;
    align-items:   center;
    gap:           12px 20px;
    justify-content: space-between;
}

.grs-banner__text {
    flex:         1 1 220px;
    display:      flex;
    flex-wrap:    wrap;
    align-items:  center;
    gap:          8px 12px;
    min-width:    0;
}

.grs-banner__flag {
    font-size:   1.25rem;
    line-height: 1;
    flex-shrink: 0;
}

.grs-banner__title {
    font-weight:   600;
    color:         inherit;
}

.grs-banner__message {
    color:         var(--grs-banner-muted, var(--grs-subtext));
    font-weight:   400;
    font-size:     0.9em;
}

.grs-banner--dark .grs-banner__message {
    color: var(--grs-banner-muted);
}

.grs-banner__actions {
    display:     flex;
    flex-wrap:   wrap;
    align-items: center;
    gap:         10px;
    flex-shrink: 0;
}

.grs-banner .grs-btn {
    white-space: nowrap;
}

.grs-banner--dark .grs-btn--secondary {
    color:        #fff;
    border-color: rgba(255, 255, 255, 0.55);
    background:   transparent;
}

.grs-banner--dark .grs-btn--secondary:hover,
.grs-banner--dark .grs-btn--secondary:focus-visible {
    background: rgba(255, 255, 255, 0.12);
    color:      #fff;
}

.grs-banner__close {
    flex-shrink:   0;
    background:    transparent;
    border:        none;
    cursor:        pointer;
    font-size:     18px;
    line-height:   1;
    padding:       6px 8px;
    border-radius: 6px;
    color:         inherit;
    opacity:       0.75;
    transition:    opacity var(--grs-transition), background var(--grs-transition);
}

.grs-banner__close:hover,
.grs-banner__close:focus-visible {
    opacity:    1;
    outline:    none;
    background: rgba(0, 0, 0, 0.06);
}

.grs-banner--dark .grs-banner__close:hover,
.grs-banner--dark .grs-banner__close:focus-visible {
    background: rgba(255, 255, 255, 0.1);
}

/* Reserve space so page content is not hidden under fixed bars */
body.grs-has-banner-top {
    padding-top: var(--grs-banner-body-offset, 72px);
}

body.grs-has-banner-bottom {
    padding-bottom: var(--grs-banner-body-offset, 80px);
}

@media (max-width: 600px) {
    .grs-banner__inner {
        padding: 10px 14px;
    }

    .grs-banner__actions {
        width:           100%;
        justify-content: flex-start;
    }
}

/* -----------------------------------------------------------------------
   Responsive
   --------------------------------------------------------------------- */
@media (max-width: 480px) {
    .grs-popup {
        padding: 28px 20px 22px;
    }
    .grs-popup__actions {
        flex-direction: column;
    }
}
