/**
 * Consolidated Geo Restrict Frontend Styles
 * Combines all frontend CSS from WooCommerce Geo Restrict plugin
 *
 * @package WooCommerce_Geo_Restrict
 * @since 1.0.0
 */

/* ==========================================================================
   COUNTRY SELECTOR
   ========================================================================== */

.wc-geo-restrict-country-selector {
    margin: 10px 0;
    padding: 10px;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 4px;
}

.wc-geo-restrict-country-selector label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
}

.wc-geo-restrict-country-selector select {
    width: 100%;
    max-width: 300px;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: white;
    font-size: 14px;
}

.wc-geo-restrict-country-selector select:focus {
    outline: none;
    border-color: #007cba;
    box-shadow: 0 0 0 2px rgba(0, 124, 186, 0.2);
}

.wc-geo-restrict-notice {
    margin: 20px 0;
    padding: 15px;
    background: var(--wp--preset--color--accent-4);
    border: 1px solid var(--wp--custom--color--input-border);
    border-radius: 12px;
}

.wc-geo-restrict-notice p {
    margin: 0;
    line-height: 1.35;
}

/* Loading state for price updates */
.price.loading {
    opacity: 0.6;
    position: relative;
}

.price.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 16px;
    height: 16px;
    margin: -8px 0 0 -8px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #007cba;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* WooCommerce integration */
.woocommerce div.product .wc-geo-restrict-country-selector {
    margin: 1em 0;
}

/* Price update animations */
.woocommerce-Price-amount,
.woocommerce-price-amount {
    transition: all 0.3s ease;
}

.price.updating {
    opacity: 0.7;
    transform: scale(0.98);
}

.woocommerce-Price-currencySymbol,
.woocommerce-price-currencySymbol {
    transition: all 0.2s ease;
}

.woocommerce-variation-price .woocommerce-Price-amount,
.cart-total .woocommerce-Price-amount,
.order-total .woocommerce-Price-amount {
    transition: all 0.3s ease;
}

/* ==========================================================================
   COUNTRY SWITCHER
   ========================================================================== */

.wc-geo-country-switcher {
    position: relative;
    display: inline-block;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

.wc-geo-switcher-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 0.75rem;
    cursor: pointer;
    font-size: 14px;
    color: #333;
    transition: all 0.2s ease;
	
}

.wc-geo-switcher-toggle:hover {
    border-color: #999;
    background: #f9f9f9;
}

.wc-geo-switcher-toggle[aria-expanded="true"] {
    border-color: #333;
}

.wc-geo-flag {
    display: inline-block;
    width: 1.333em;
    height: 1em;
    line-height: 1;
    vertical-align: middle;
}

.wc-geo-country-name {
    font-weight: 500;
    white-space: nowrap;
}

.wc-geo-arrow {
    transition: transform 0.2s ease;
    opacity: 0.6;
}

.wc-geo-switcher-toggle[aria-expanded="true"] .wc-geo-arrow {
    transform: rotate(180deg);
}

/* Dropdown */
.wc-geo-switcher-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    min-width: 280px;
    max-width: 320px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    z-index: 9999;
    overflow: hidden;
}

/* Search */
.wc-geo-search-wrapper {
    padding: 12px;
    border-bottom: 1px solid #eee;
}

.wc-geo-search {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s ease;
}

.wc-geo-search:focus {
    border-color: #333;
}

/* Country List */
.wc-geo-country-list {
    list-style: none;
    margin: 0;
    padding: 8px;
    max-height: 300px;
    overflow-y: auto;
    overflow-x: hidden;
}

.wc-geo-country-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    cursor: pointer;
    border-radius: 6px;
    transition: background 0.15s ease;
}

.wc-geo-country-item:hover {
    background: #f5f5f5;
}

.wc-geo-country-item.current {
    background: #f0f0f0;
    font-weight: 500;
}

.wc-geo-country-item.hidden {
    display: none;
}

.wc-geo-country-item .wc-geo-country-name {
    flex: 1;
    font-size: 14px;
}

.wc-geo-check {
    color: #4caf50;
    flex-shrink: 0;
}

/* Screen reader only */
.screen-reader-text {
    position: absolute;
    left: -10000px;
    top: auto;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

/* Scrollbar styling */
.wc-geo-country-list::-webkit-scrollbar {
    width: 6px;
}

.wc-geo-country-list::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.wc-geo-country-list::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

.wc-geo-country-list::-webkit-scrollbar-thumb:hover {
    background: #999;
}

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

/* ==========================================================================
   LOADING SPINNER OVERLAY
   ========================================================================== */

.wc-geo-loading-spinner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.wc-geo-loading-spinner.show {
    opacity: 1;
    visibility: visible;
}

.wc-geo-loading-spinner::after {
    content: '';
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: wc-geo-spin 0.8s linear infinite;
}

@keyframes wc-geo-spin {
    to { transform: rotate(360deg); }
}

@media (max-width: 768px) {

	.wc-geo-switcher-toggle {
		height: 44px;
	}
    .wc-geo-restrict-country-selector select {
        max-width: 100%;
    }

    .wc-geo-switcher-dropdown {
        position: absolute;
        top: 45px;
        bottom: auto;
        left: auto;
        right: auto;
        min-width: 100%;
        max-width: 100%;
        border-radius: 16px 16px 0 0;

    }

    .wc-geo-country-list {
        max-height: calc(80vh - 60px);
    }

    .wc-geo-country-name {
        font-size: 13px;
    }
}
