/**
 * Country Selector with Geolocation - Styles
 */

/* ==========================================
   Country Selector Wrapper
   ========================================== */

.csg-country-selector-wrapper {
    padding: 20px;
    margin: 20px 0;
    background: #f9f9f9;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
}

.csg-label {
    display: block;
    margin-bottom: 12px;
    font-weight: 600;
    font-size: 16px;
    color: #333;
}

/* ==========================================
   Dropdown Style
   ========================================== */

.csg-dropdown-selector {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.csg-dropdown-selector .csg-label {
    margin-bottom: 0;
    margin-right: 10px;
}

.csg-select {
    flex: 1;
    min-width: 200px;
    padding: 10px 15px;
    font-size: 15px;
    border: 2px solid #ddd;
    border-radius: 5px;
    background-color: #fff;
    color: #333;
    cursor: pointer;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.csg-select:hover {
    border-color: #999;
}

.csg-select:focus {
    outline: none;
    border-color: #0073aa;
    box-shadow: 0 0 0 3px rgba(0, 115, 170, 0.1);
}

/* ==========================================
   Reset Button
   ========================================== */

.csg-reset-btn {
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 500;
    color: #666;
    background: #fff;
    border: 2px solid #ddd;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.csg-reset-btn:hover {
    color: #d63638;
    border-color: #d63638;
    background: #fff;
}

.csg-reset-btn:active {
    transform: scale(0.98);
}

/* ==========================================
   Flags Grid Style
   ========================================== */

.csg-flags-selector {
    text-align: center;
}

.csg-flags-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
    margin-top: 15px;
    margin-bottom: 15px;
}

.csg-flag-btn {
    padding: 12px 10px;
    background: #fff;
    border: 2px solid #ddd;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.csg-flag-btn:hover {
    border-color: #0073aa;
    background: #f0f8ff;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.csg-flag-btn.active {
    border-color: #0073aa;
    background: #0073aa;
    color: #fff;
    font-weight: 600;
}

.csg-flag-icon {
    display: inline-block;
    font-size: 24px;
    font-weight: bold;
    padding: 8px 12px;
    background: #f5f5f5;
    border-radius: 4px;
    min-width: 60px;
}

.csg-flag-btn.active .csg-flag-icon {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
}

.csg-flag-name {
    font-size: 13px;
    color: #555;
}

.csg-flag-btn.active .csg-flag-name {
    color: #fff;
}

/* ==========================================
   List Style
   ========================================== */

.csg-list-selector {
    max-width: 600px;
}

.csg-country-list {
    list-style: none;
    padding: 0;
    margin: 15px 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 10px;
}

.csg-country-list li {
    margin: 0;
}

.csg-list-btn {
    width: 100%;
    padding: 12px 16px;
    text-align: left;
    background: #fff;
    border: 2px solid #ddd;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    color: #333;
    transition: all 0.3s ease;
}

.csg-list-btn:hover {
    border-color: #0073aa;
    background: #f0f8ff;
    transform: translateX(3px);
}

.csg-list-btn.active {
    border-color: #0073aa;
    background: #0073aa;
    color: #fff;
    font-weight: 600;
}

/* ==========================================
   Current Country Display
   ========================================== */

.csg-current-country-display {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #ddd;
    text-align: center;
}

.csg-current-country-display small {
    color: #666;
    font-size: 13px;
}

.csg-current-country-display strong {
    color: #0073aa;
}

/* ==========================================
   Responsive Design
   ========================================== */

@media screen and (max-width: 768px) {
    .csg-dropdown-selector {
        flex-direction: column;
        align-items: stretch;
    }
    
    .csg-dropdown-selector .csg-label {
        margin-right: 0;
        margin-bottom: 8px;
    }
    
    .csg-select {
        width: 100%;
        min-width: 100%;
    }
    
    .csg-flags-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    }
    
    .csg-country-list {
        grid-template-columns: 1fr;
    }
}

@media screen and (max-width: 480px) {
    .csg-country-selector-wrapper {
        padding: 15px;
    }
    
    .csg-flags-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .csg-flag-icon {
        font-size: 18px;
        padding: 6px 10px;
        min-width: 50px;
    }
    
    .csg-flag-name {
        font-size: 12px;
    }
}

/* ==========================================
   Custom Body Classes Styles
   ========================================== */

/* Example: Hide/show content based on country */
body.country-us .show-for-us { display: block !important; }
body:not(.country-us) .show-for-us { display: none !important; }

body.country-gb .show-for-gb { display: block !important; }
body:not(.country-gb) .show-for-gb { display: none !important; }

body.country-ca .show-for-ca { display: block !important; }
body:not(.country-ca) .show-for-ca { display: none !important; }

/* Example: Different styles for manual vs auto-detected */
body.country-manual-selection .manual-only {
    display: block !important;
}

body.country-auto-detected .auto-only {
    display: block !important;
}

/* ==========================================
   Accessibility
   ========================================== */

.csg-select:focus,
.csg-flag-btn:focus,
.csg-list-btn:focus,
.csg-reset-btn:focus {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .csg-country-selector-wrapper {
        border: 2px solid #000;
    }
    
    .csg-select,
    .csg-flag-btn,
    .csg-list-btn,
    .csg-reset-btn {
        border-width: 2px;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .csg-select,
    .csg-flag-btn,
    .csg-list-btn,
    .csg-reset-btn {
        transition: none;
    }
}

/* ==========================================
   Dark Mode Support (Optional)
   ========================================== */

@media (prefers-color-scheme: dark) {
    .csg-country-selector-wrapper {
        background: #2c2c2c;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    }
    
    .csg-label {
        color: #e0e0e0;
    }
    
    .csg-select,
    .csg-flag-btn,
    .csg-list-btn,
    .csg-reset-btn {
        background: #1a1a1a;
        color: #e0e0e0;
        border-color: #444;
    }
    
    .csg-select:hover,
    .csg-flag-btn:hover,
    .csg-list-btn:hover {
        border-color: #4a9eff;
        background: #252525;
    }
    
    .csg-flag-icon {
        background: #333;
    }
    
    .csg-flag-btn.active,
    .csg-list-btn.active {
        background: #4a9eff;
        border-color: #4a9eff;
    }
    
    .csg-current-country-display {
        border-top-color: #444;
    }
    
    .csg-current-country-display small {
        color: #999;
    }
    
    .csg-current-country-display strong {
        color: #4a9eff;
    }
}

/* ==========================================
   Print Styles
   ========================================== */

@media print {
    .csg-country-selector-wrapper {
        display: none;
    }
}
