/**
 * Country Selector Styles
 *
 * Mega dropdown for country and language selection
 *
 * @package PlanDigitalNow
 * @since 2.0.0
 */

/* ==================== VARIABLES ==================== */
:root {
    --pdn-cs-primary: #0080FF;
    --pdn-cs-primary-dark: #005BBB;
    --pdn-cs-accent: #010C80;
    --pdn-cs-dark: #1a1a1a;
    --pdn-cs-gray: #525252;
    --pdn-cs-gray-light: #9ca3af;
    --pdn-cs-light-gray: #f8f9fa;
    --pdn-cs-border: #e0e0e0;
    --pdn-cs-white: #ffffff;
    --pdn-cs-radius: 8px;
    --pdn-cs-shadow: 0 20px 60px rgba(0,0,0,0.25), 0 0 0 1px rgba(0,0,0,0.05);
}

/* ==================== TRIGGER BUTTON ==================== */
.pdn-country-selector {
    position: relative;
}

.pdn-country-selector__trigger {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: rgba(255,255,255,0.1);
    border: 1px solid transparent;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #ffffff;
    font-family: inherit;
}

.pdn-country-selector__trigger:hover {
    background: rgba(255,255,255,0.2);
    border-color: rgba(255,255,255,0.3);
}

.pdn-country-selector__trigger.is-active {
    background: rgba(255,255,255,0.25);
    border-color: rgba(255,255,255,0.4);
}

.pdn-country-selector__globe {
    width: 18px;
    height: 18px;
    opacity: 0.9;
    flex-shrink: 0;
}

.pdn-country-selector__current {
    display: flex;
    flex-direction: column;
    gap: 1px;
    text-align: left;
}

.pdn-country-selector__country {
    font-size: 12px;
    font-weight: 600;
    line-height: 1.2;
}

.pdn-country-selector__language {
    font-size: 10px;
    opacity: 0.7;
    line-height: 1.2;
}

.pdn-country-selector__arrow {
    width: 12px;
    height: 12px;
    opacity: 0.7;
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

.pdn-country-selector__trigger.is-active .pdn-country-selector__arrow {
    transform: rotate(180deg);
}

/* ==================== MEGA DROPDOWN ==================== */
.pdn-country-dropdown {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: 720px;
    max-height: 520px;
    background: var(--pdn-cs-white);
    border-radius: 12px;
    box-shadow: var(--pdn-cs-shadow);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.25s ease;
    z-index: 9999;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    color: var(--pdn-cs-dark);
}

.pdn-country-dropdown.is-open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* ==================== DROPDOWN HEADER ==================== */
.pdn-country-dropdown__header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--pdn-cs-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--pdn-cs-light-gray);
    flex-shrink: 0;
}

.pdn-country-dropdown__title {
    font-size: 14px;
    font-weight: 600;
    color: var(--pdn-cs-dark);
}

.pdn-country-dropdown__search {
    position: relative;
    width: 220px;
}

.pdn-country-dropdown__search-icon {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 14px;
    height: 14px;
    color: var(--pdn-cs-gray-light);
    pointer-events: none;
}

.pdn-country-dropdown__search-input {
    width: 100%;
    padding: 8px 12px 8px 32px;
    border: 1px solid var(--pdn-cs-border);
    border-radius: 6px;
    font-size: 12px;
    font-family: inherit;
    background: var(--pdn-cs-white);
    color: var(--pdn-cs-dark);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.pdn-country-dropdown__search-input:focus {
    outline: none;
    border-color: var(--pdn-cs-primary);
    box-shadow: 0 0 0 3px rgba(0,128,255,0.1);
}

.pdn-country-dropdown__search-input::placeholder {
    color: var(--pdn-cs-gray-light);
}

/* ==================== REGION TABS ==================== */
.pdn-country-dropdown__tabs {
    display: flex;
    gap: 0;
    padding: 0 20px;
    border-bottom: 1px solid var(--pdn-cs-border);
    background: var(--pdn-cs-white);
    overflow-x: auto;
    flex-shrink: 0;
    -webkit-overflow-scrolling: touch;
}

.pdn-country-dropdown__tabs::-webkit-scrollbar {
    height: 0;
}

.pdn-country-dropdown__tab {
    padding: 12px 16px;
    font-size: 12px;
    font-weight: 500;
    color: var(--pdn-cs-gray);
    cursor: pointer;
    border: none;
    background: none;
    border-bottom: 2px solid transparent;
    white-space: nowrap;
    transition: all 0.2s;
    font-family: inherit;
    margin-bottom: -1px;
}

.pdn-country-dropdown__tab:hover {
    color: var(--pdn-cs-primary);
    background: rgba(0,128,255,0.03);
}

.pdn-country-dropdown__tab.is-active {
    color: var(--pdn-cs-primary);
    border-bottom-color: var(--pdn-cs-primary);
    font-weight: 600;
}

.pdn-country-dropdown__tab-count {
    display: inline-block;
    background: var(--pdn-cs-light-gray);
    color: var(--pdn-cs-gray);
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 10px;
    margin-left: 6px;
}

.pdn-country-dropdown__tab.is-active .pdn-country-dropdown__tab-count {
    background: rgba(0,128,255,0.1);
    color: var(--pdn-cs-primary);
}

/* ==================== COUNTRIES CONTENT ==================== */
.pdn-country-dropdown__content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    min-height: 200px;
}

.pdn-country-dropdown__panel {
    display: none;
}

.pdn-country-dropdown__panel.is-active {
    display: block;
}

.pdn-country-dropdown__grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

/* ==================== COUNTRY ITEM ==================== */
.pdn-country-dropdown__item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s;
    border: 1px solid transparent;
    position: relative;
}

.pdn-country-dropdown__item:hover {
    background: var(--pdn-cs-light-gray);
    border-color: var(--pdn-cs-border);
}

.pdn-country-dropdown__item.is-selected {
    background: rgba(0,128,255,0.08);
    border-color: var(--pdn-cs-primary);
}

.pdn-country-dropdown__item.is-hidden {
    display: none;
}

.pdn-country-dropdown__flag {
    width: 24px;
    height: 18px;
    border-radius: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
    line-height: 1;
}

.pdn-country-dropdown__info {
    flex: 1;
    min-width: 0;
}

.pdn-country-dropdown__name {
    font-size: 13px;
    font-weight: 500;
    color: var(--pdn-cs-dark);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
}

.pdn-country-dropdown__langs {
    font-size: 10px;
    color: var(--pdn-cs-gray-light);
    margin-top: 2px;
    display: block;
}

.pdn-country-dropdown__check {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--pdn-cs-primary);
    color: var(--pdn-cs-white);
    display: none;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.pdn-country-dropdown__check svg {
    width: 10px;
    height: 10px;
}

.pdn-country-dropdown__item.is-selected .pdn-country-dropdown__check {
    display: flex;
}

/* ==================== LANGUAGE SUBMENU ==================== */
.pdn-country-dropdown__submenu {
    position: absolute;
    left: 100%;
    top: 0;
    margin-left: 8px;
    background: var(--pdn-cs-white);
    border-radius: 8px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.15);
    padding: 8px 0;
    min-width: 160px;
    opacity: 0;
    visibility: hidden;
    transform: translateX(-10px);
    transition: all 0.2s;
    z-index: 10;
}

.pdn-country-dropdown__item.has-languages:hover .pdn-country-dropdown__submenu {
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
}

.pdn-country-dropdown__lang-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 16px;
    font-size: 12px;
    color: var(--pdn-cs-dark);
    cursor: pointer;
    transition: background 0.15s;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    font-family: inherit;
}

.pdn-country-dropdown__lang-option:hover {
    background: var(--pdn-cs-light-gray);
}

.pdn-country-dropdown__lang-option.is-selected {
    color: var(--pdn-cs-primary);
    font-weight: 600;
}

.pdn-country-dropdown__lang-check {
    width: 12px;
    height: 12px;
}

/* ==================== NO RESULTS ==================== */
.pdn-country-dropdown__no-results {
    text-align: center;
    padding: 40px 20px;
    color: var(--pdn-cs-gray);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.pdn-country-dropdown__no-results[hidden] {
    display: none;
}

.pdn-country-dropdown__no-results svg {
    width: 32px;
    height: 32px;
    opacity: 0.5;
}

.pdn-country-dropdown__no-results span {
    font-size: 13px;
}

/* ==================== DROPDOWN FOOTER ==================== */
.pdn-country-dropdown__footer {
    padding: 12px 20px;
    border-top: 1px solid var(--pdn-cs-border);
    background: var(--pdn-cs-light-gray);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.pdn-country-dropdown__hint {
    font-size: 11px;
    color: var(--pdn-cs-gray);
}

.pdn-country-dropdown__hint a {
    color: var(--pdn-cs-primary);
    text-decoration: none;
}

.pdn-country-dropdown__hint a:hover {
    text-decoration: underline;
}

.pdn-country-dropdown__apply {
    background: var(--pdn-cs-primary);
    color: var(--pdn-cs-white);
    border: none;
    padding: 8px 20px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    font-family: inherit;
}

.pdn-country-dropdown__apply:hover {
    background: var(--pdn-cs-primary-dark);
}

/* ==================== TOAST NOTIFICATION ==================== */
.pdn-country-toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--pdn-cs-dark);
    color: var(--pdn-cs-white);
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    box-shadow: 0 8px 24px rgba(0,0,0,0.2);
    z-index: 10000;
    opacity: 0;
    transition: all 0.3s ease;
    pointer-events: none;
}

.pdn-country-toast.is-visible {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 800px) {
    .pdn-country-dropdown {
        width: calc(100vw - 32px);
        right: -60px;
    }

    .pdn-country-dropdown__grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .pdn-country-dropdown__submenu {
        left: auto;
        right: 100%;
        margin-left: 0;
        margin-right: 8px;
    }
}

@media (max-width: 600px) {
    .pdn-country-selector__current {
        display: none;
    }

    .pdn-country-selector__trigger {
        padding: 8px;
    }

    .pdn-country-dropdown {
        position: fixed;
        top: 64px;
        right: 16px;
        left: 16px;
        width: auto;
        max-height: calc(100vh - 100px);
    }

    .pdn-country-dropdown__grid {
        grid-template-columns: 1fr;
    }

    .pdn-country-dropdown__tabs {
        padding: 0 12px;
    }

    .pdn-country-dropdown__tab {
        padding: 10px 12px;
        font-size: 11px;
    }

    .pdn-country-dropdown__header {
        flex-direction: column;
        gap: 12px;
        align-items: stretch;
    }

    .pdn-country-dropdown__search {
        width: 100%;
    }

    .pdn-country-dropdown__footer {
        flex-direction: column;
        gap: 12px;
        align-items: stretch;
        text-align: center;
    }

    .pdn-country-dropdown__apply {
        width: 100%;
    }

    /* Hide submenu on mobile - show inline instead */
    .pdn-country-dropdown__submenu {
        display: none;
    }

    .pdn-country-dropdown__item.has-languages::after {
        content: '';
        position: absolute;
        right: 12px;
        top: 50%;
        transform: translateY(-50%);
        width: 0;
        height: 0;
        border-left: 4px solid transparent;
        border-right: 4px solid transparent;
        border-top: 5px solid var(--pdn-cs-gray-light);
    }
}

