/**
 * Country Selector CSS
 * Styles for the geo-targeting country selector frontend
 * 
 * Plugin Name: Geo-Target Content Restrictor
 * Author: Rokan Chowdhury Onick
 * Website: https://rokanchowdhuryonick.com
 */

/* ===============================================
   DROPDOWN STYLE (Modern, Header-friendly)
   =============================================== */

.geo-country-dropdown {
    position: relative;
    display: inline-block;
}

.geo-dropdown-button {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background: #ffffff;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    font-family: inherit;
    color: #333;
    cursor: pointer;
    transition: all 0.2s ease;
    width: auto;
}

.geo-dropdown-button:hover {
    border-color: #999;
    background: #f9f9f9;
}

.geo-dropdown-button:focus {
    outline: 2px solid #0073aa;
    outline-offset: 1px;
}

.geo-dropdown-button .dropdown-arrow {
    margin-left: 10px;
    font-size: 10px;
    transition: transform 0.2s ease;
}

.geo-dropdown-button[aria-expanded="true"] .dropdown-arrow {
    transform: rotate(180deg);
}

.geo-dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 4px;
    background: #ffffff;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    max-height: 300px;
    overflow-y: auto;
    z-index: 9999;
    display: none;
    min-width: 180px;
    width: max-content;
}

.geo-dropdown-button[aria-expanded="true"] + .geo-dropdown-menu {
    display: block;
}

.geo-dropdown-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    color: #333;
    text-decoration: none;
    transition: background 0.15s ease;
    font-size: 14px;
}

.geo-dropdown-item:hover {
    background: #f5f5f5;
    color: #333;
}

.geo-dropdown-item.active {
    background: #f0f7ff;
    color: #0073aa;
    font-weight: 500;
}

.geo-dropdown-item.active:hover {
    background: #e6f3ff;
    color: #0073aa;
}

.geo-dropdown-item .check-mark {
    margin-left: auto;
    color: #0073aa;
    font-weight: bold;
}

/* ===============================================
   BUTTON STYLE (Original horizontal layout)
   =============================================== */

.geo-country-switcher {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 15px 0;
    padding: 15px;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    align-items: center;
}

.geo-country-item {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    background: #ffffff;
    border: 1px solid #ced4da;
    border-radius: 6px;
    text-decoration: none;
    color: #495057;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
    cursor: pointer;
}

.geo-country-item:hover {
    background: #e9ecef;
    border-color: #adb5bd;
    color: #212529;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.geo-country-item.active {
    background: #0073aa;
    border-color: #005a87;
    color: #ffffff;
    box-shadow: 0 2px 4px rgba(0, 115, 170, 0.3);
}

.geo-country-item:focus {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

.country-flag {
    font-size: 18px;
    margin-right: 6px;
    line-height: 1;
}

.country-name {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

/* Compact style */
.geo-country-switcher.compact {
    gap: 5px;
    padding: 10px;
}

.geo-country-switcher.compact .geo-country-item {
    padding: 6px 10px;
    font-size: 13px;
}

.geo-country-switcher.compact .country-flag {
    font-size: 16px;
    margin-right: 4px;
}

/* Vertical layout */
.geo-country-switcher.vertical {
    flex-direction: column;
    align-items: stretch;
}

.geo-country-switcher.vertical .geo-country-item {
    justify-content: center;
}

/* Minimal style */
.geo-country-switcher.minimal {
    background: transparent;
    border: none;
    padding: 0;
    gap: 15px;
}

.geo-country-switcher.minimal .geo-country-item {
    background: transparent;
    border: none;
    padding: 0;
    color: #6c757d;
    font-weight: 400;
}

.geo-country-switcher.minimal .geo-country-item:hover {
    background: transparent;
    color: #0073aa;
    transform: none;
    box-shadow: none;
}

.geo-country-switcher.minimal .geo-country-item.active {
    background: transparent;
    border: none;
    color: #0073aa;
    box-shadow: none;
}

/* Dropdown style */
.geo-country-switcher.dropdown {
    position: relative;
    display: inline-block;
    background: transparent;
    border: none;
    padding: 0;
}

.geo-country-switcher.dropdown .geo-country-item {
    background: #ffffff;
    border: 1px solid #ced4da;
    border-radius: 6px;
    padding: 10px 15px;
    margin: 0;
    min-width: 150px;
    justify-content: space-between;
}

.geo-country-switcher.dropdown .geo-country-item::after {
    content: '▼';
    font-size: 10px;
    margin-left: 8px;
}

.geo-country-switcher.dropdown .geo-country-list {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #ffffff;
    border: 1px solid #ced4da;
    border-radius: 6px;
    margin-top: 5px;
    max-height: 300px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.geo-country-switcher.dropdown .geo-country-list.show {
    display: block;
}

.geo-country-switcher.dropdown .geo-country-list .geo-country-item {
    border-radius: 0;
    border-left: none;
    border-right: none;
    margin: 0;
}

.geo-country-switcher.dropdown .geo-country-list .geo-country-item:first-child {
    border-top: none;
    border-radius: 6px 6px 0 0;
}

.geo-country-switcher.dropdown .geo-country-list .geo-country-item:last-child {
    border-bottom: none;
    border-radius: 0 0 6px 6px;
}

/* Loading state */
.geo-country-switcher.loading {
    opacity: 0.6;
    pointer-events: none;
}

.geo-country-switcher.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #0073aa;
    border-radius: 50%;
    border-top-color: transparent;
    animation: geo-spin 1s linear infinite;
}

@keyframes geo-spin {
    to {
        transform: rotate(360deg);
    }
}

/* Responsive design */
@media (max-width: 768px) {
    .geo-country-switcher {
        justify-content: center;
        gap: 8px;
        padding: 12px;
    }
    
    .geo-country-item {
        padding: 6px 10px;
        font-size: 13px;
    }
    
    .country-flag {
        font-size: 16px;
        margin-right: 4px;
    }
}

@media (max-width: 480px) {
    .geo-country-switcher {
        flex-direction: column;
        align-items: stretch;
        gap: 6px;
        padding: 10px;
    }
    
    .geo-country-item {
        justify-content: center;
        padding: 8px 12px;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .geo-country-switcher {
        background: #2d3748;
        border-color: #4a5568;
    }
    
    .geo-country-item {
        background: #4a5568;
        border-color: #718096;
        color: #e2e8f0;
    }
    
    .geo-country-item:hover {
        background: #718096;
        border-color: #a0aec0;
        color: #ffffff;
    }
    
    .geo-country-item.active {
        background: #3182ce;
        border-color: #2c5aa0;
        color: #ffffff;
    }
    
    .geo-country-switcher.dropdown .geo-country-list {
        background: #4a5568;
        border-color: #718096;
    }
}

/* High contrast mode */
@media (prefers-contrast: high) {
    .geo-country-switcher {
        border-width: 2px;
    }
    
    .geo-country-item {
        border-width: 2px;
        font-weight: 600;
    }
    
    .geo-country-item:focus {
        outline-width: 3px;
    }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .geo-country-item {
        transition: none;
    }
    
    .geo-country-item:hover {
        transform: none;
    }
    
    .geo-country-switcher.loading::after {
        animation: none;
    }
}

/* Print styles */
@media print {
    .geo-country-switcher {
        display: none;
    }
}
