/**
 * WordPress Country Restriction Alert System Styles
 */

/* Alert Container */
#wcr-alert-container {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 999999;
    pointer-events: none;
}

/* Base Alert Styles */
.wcr-alert {
    position: relative;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    max-width: 600px;
    min-width: 300px;
    padding: 15px 40px 15px 15px;
    margin: 0 auto 10px;
    border-radius: 6px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: auto;
    backdrop-filter: blur(10px);
}

.wcr-alert.wcr-show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* Alert Types */
.wcr-alert.wcr-error {
    background: linear-gradient(135deg, #dc3232 0%, #b91c1c 100%);
    color: white;
    border-left: 4px solid #991b1b;
}

.wcr-alert.wcr-success {
    background: linear-gradient(135deg, #46b450 0%, #16a34a 100%);
    color: white;
    border-left: 4px solid #15803d;
}

.wcr-alert.wcr-warning {
    background: linear-gradient(135deg, #ffb900 0%, #f59e0b 100%);
    color: #1f2937;
    border-left: 4px solid #d97706;
}

.wcr-alert.wcr-info {
    background: linear-gradient(135deg, #00a0d2 0%, #0284c7 100%);
    color: white;
    border-left: 4px solid #0369a1;
}

/* Alert Content */
.wcr-alert-message {
    margin: 0;
    padding: 0;
    font-weight: 500;
    font-size: 14px;
}

.wcr-alert-country {
    margin: 6px 0 0 0;
    padding: 0;
    font-size: 12px;
    opacity: 0.9;
    font-weight: 400;
}

/* Dismiss Button */
.wcr-alert-dismiss {
    position: absolute;
    top: 8px;
    right: 12px;
    background: none;
    border: none;
    color: inherit;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    padding: 4px;
    width: 24px;
    height: 24px;
    line-height: 1;
    opacity: 0.8;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.wcr-alert-dismiss:hover {
    opacity: 1;
    background-color: rgba(255, 255, 255, 0.2);
}

.wcr-alert-dismiss:focus {
    outline: 2px solid rgba(255, 255, 255, 0.5);
    outline-offset: 2px;
}

/* Form Visual Feedback */
.wcr-form-restricted {
    opacity: 0.6;
    pointer-events: none;
    position: relative;
}

.wcr-form-restricted::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(220, 50, 50, 0.1);
    border: 2px solid #dc3232;
    border-radius: 4px;
    pointer-events: none;
    z-index: 1;
}

.wcr-form-checking {
    opacity: 0.8;
    position: relative;
}

.wcr-form-checking::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 160, 210, 0.05);
    border: 2px solid #00a0d2;
    border-radius: 4px;
    pointer-events: none;
    z-index: 1;
    animation: wcr-pulse 2s infinite;
}

.wcr-form-allowed {
    position: relative;
}

.wcr-form-allowed::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(70, 180, 80, 0.05);
    border: 2px solid #46b450;
    border-radius: 4px;
    pointer-events: none;
    z-index: 1;
    opacity: 0;
    animation: wcr-flash-success 0.5s ease-out;
}

/* Submit Button States */
.wcr-submit-disabled {
    opacity: 0.5 !important;
    cursor: not-allowed !important;
    pointer-events: none !important;
}

/* Animations */
@keyframes wcr-pulse {
    0%, 100% {
        opacity: 0.3;
    }
    50% {
        opacity: 0.1;
    }
}

@keyframes wcr-flash-success {
    0% {
        opacity: 0;
    }
    50% {
        opacity: 1;
    }
    100% {
        opacity: 0;
    }
}

@keyframes wcr-slide-in {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .wcr-alert {
        left: 10px;
        right: 10px;
        transform: none;
        max-width: none;
        min-width: auto;
        margin: 0 0 10px 0;
    }
    
    .wcr-alert.wcr-show {
        transform: none;
    }
    
    .wcr-alert-message {
        font-size: 13px;
        padding-right: 20px;
    }
    
    .wcr-alert-country {
        font-size: 11px;
    }
}

@media (max-width: 480px) {
    .wcr-alert {
        padding: 12px 35px 12px 12px;
        font-size: 13px;
    }
    
    .wcr-alert-dismiss {
        top: 6px;
        right: 8px;
        font-size: 16px;
        width: 20px;
        height: 20px;
    }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .wcr-alert {
        border-width: 2px;
        border-style: solid;
    }
    
    .wcr-alert.wcr-error {
        border-color: #ffffff;
        background: #dc3232;
    }
    
    .wcr-alert.wcr-success {
        border-color: #ffffff;
        background: #46b450;
    }
    
    .wcr-alert.wcr-warning {
        border-color: #000000;
        background: #ffb900;
    }
    
    .wcr-alert.wcr-info {
        border-color: #ffffff;
        background: #00a0d2;
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    .wcr-alert {
        transition: none;
    }
    
    .wcr-alert-dismiss {
        transition: none;
    }
    
    .wcr-form-checking::after {
        animation: none;
    }
    
    .wcr-form-allowed::after {
        animation: none;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .wcr-alert {
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    }
    
    .wcr-alert.wcr-warning {
        color: #1f2937;
    }
}

/* Focus Management */
.wcr-alert:focus-within {
    outline: 2px solid rgba(255, 255, 255, 0.5);
    outline-offset: 2px;
}

/* Loading State */
.wcr-checking-indicator {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: currentColor;
    animation: wcr-spin 1s linear infinite;
    margin-right: 8px;
    vertical-align: middle;
}

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

/* Accessibility Improvements */
.wcr-alert[role="alert"] {
    /* Announced by screen readers */
}

.wcr-alert-dismiss:focus {
    outline: 2px solid currentColor;
    outline-offset: 2px;
}

/* Print Styles */
@media print {
    .wcr-alert,
    #wcr-alert-container {
        display: none !important;
    }
}