/**
 * AgenWebsite Multi-Currency Frontend Styles
 * @since 1.0.0
 * @version 1.1.0
 */

/* ============================================
   CSS Custom Properties (Z-Index Scale)
   ============================================ */
:root {
    --awmc-z-base: 0;
    --awmc-z-floating: 100;
    --awmc-z-dropdown: 200;
    --awmc-z-widget: 350;
    --awmc-z-sticky: 400;
    --awmc-z-tooltip: 500;
    --awmc-z-overlay: 600;
    --awmc-z-modal: 700;
    --awmc-z-notification: 800;
}

/* ============================================
   CSS Reset for Style Isolation
   ============================================ */
.awmc-currency-switcher-widget,
.awmc-currency-switcher,
.awmc-modal-overlay,
.awmc-checkout-notifications {
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    line-height: 1.5;
}

.awmc-currency-switcher-widget *,
.awmc-currency-switcher-widget *::before,
.awmc-currency-switcher-widget *::after,
.awmc-modal-overlay *,
.awmc-modal-overlay *::before,
.awmc-modal-overlay *::after,
.awmc-checkout-notifications *,
.awmc-checkout-notifications *::before,
.awmc-checkout-notifications *::after {
    box-sizing: inherit;
}

.awmc-currency-switcher-widget button,
.awmc-currency-switcher-widget select,
.awmc-modal-overlay button,
.awmc-modal-overlay select {
    font-family: inherit;
    font-size: inherit;
    line-height: inherit;
}

/* ============================================
   Currency Switcher Widget
   ============================================ */
.awmc-currency-switcher-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: var(--awmc-z-widget, 350);
    background: #fff;
    padding: 15px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border: 1px solid #e0e0e0;
}

.awmc-switcher-container {
    display: flex;
    align-items: center;
    gap: 10px;
}

.awmc-switcher-label {
    display: flex;
    align-items: center;
    gap: 5px;
    font-weight: 600;
    font-size: 13px;
    color: #333;
    margin: 0;
}

.awmc-switcher-label .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
}

.awmc-currency-select {
    padding: 6px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    background: #fff;
    cursor: pointer;
    min-width: 100px;
    transition: border-color 0.2s;
}

.awmc-currency-select:hover,
.awmc-currency-select:focus {
    border-color: #2271b1;
    outline: none;
}

/* Dropdown Layout */
.awmc-currency-switcher.awmc-layout-dropdown {
    display: inline-block;
}

.awmc-currency-switcher.awmc-layout-dropdown select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    background: #fff;
    cursor: pointer;
}

/* Buttons Layout */
.awmc-currency-switcher.awmc-layout-buttons {
    display: inline-block;
}

.awmc-currency-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.awmc-currency-button {
    padding: 8px 16px;
    border: 2px solid #ddd;
    border-radius: 4px;
    background: #fff;
    color: #333;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.awmc-currency-button:hover {
    border-color: #2271b1;
    color: #2271b1;
}

.awmc-currency-button.active {
    background: #2271b1;
    border-color: #2271b1;
    color: #fff;
}

/* List Layout */
.awmc-currency-switcher.awmc-layout-list {
    display: inline-block;
}

.awmc-currency-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.awmc-currency-list li {
    margin: 5px 0;
}

.awmc-currency-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    text-decoration: none;
    color: #333;
    font-size: 14px;
    transition: all 0.2s;
}

.awmc-currency-link:hover {
    border-color: #2271b1;
    color: #2271b1;
    background: #f0f7ff;
}

.awmc-currency-link.active {
    background: #2271b1;
    border-color: #2271b1;
    color: #fff;
    font-weight: 600;
}

.awmc-current-indicator {
    font-weight: bold;
    margin-left: 10px;
}

/* Loading State */
.awmc-loading {
    opacity: 0.6;
    pointer-events: none;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .awmc-currency-switcher-widget {
        bottom: 10px;
        right: 10px;
        padding: 10px 15px;
    }

    .awmc-switcher-label {
        font-size: 12px;
    }

    .awmc-currency-select {
        font-size: 13px;
        min-width: 80px;
    }

    .awmc-currency-button {
        padding: 6px 12px;
        font-size: 12px;
    }
}

/* Admin Product Fields */
.awmc-currency-price-group {
    background: #f9f9f9;
    padding: 10px;
    margin: 10px 0;
    border-radius: 4px;
}

.awmc-variation-prices {
    border-top: 1px solid #eee;
    padding-top: 10px;
    margin-top: 10px;
}

/* ============================================
   Modal Overlay Styles
   ============================================ */
.awmc-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: var(--awmc-z-modal, 700);
    display: none;
    animation: awmc-fadeIn 0.3s ease;
}

.awmc-modal-dialog {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}

.awmc-modal-content {
    background: #fff;
    border-radius: 12px;
    max-width: 600px;
    width: 100%;
    position: relative;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    animation: awmc-slideUp 0.3s ease;
}

.awmc-modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    font-size: 28px;
    line-height: 1;
    color: #666;
    cursor: pointer;
    padding: 5px;
    transition: color 0.2s;
}

.awmc-modal-close:hover {
    color: #000;
}

.awmc-modal-header {
    padding: 30px 30px 20px;
    text-align: center;
}

.awmc-modal-title {
    margin: 0 0 10px;
    font-size: 28px;
    font-weight: 600;
    color: #333;
}

.awmc-modal-description {
    margin: 0;
    font-size: 16px;
    color: #666;
}

.awmc-modal-body {
    padding: 20px 30px 30px;
}

.awmc-currency-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 12px;
}

.awmc-currency-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 15px 10px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    background: #fff;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.awmc-currency-option:hover:not(.active):not(:disabled) {
    border-color: #2271b1;
    background: #f0f7ff;
    transform: translateY(-2px);
}

.awmc-currency-option.active {
    border-color: #2271b1;
    background: #2271b1;
    color: #fff;
    cursor: default;
}

.awmc-currency-option:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.awmc-currency-code {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 4px;
}

.awmc-currency-symbol {
    font-size: 14px;
    opacity: 0.8;
}

.awmc-currency-current {
    position: absolute;
    top: 5px;
    right: 5px;
    font-size: 10px;
    text-transform: uppercase;
    background: rgba(255, 255, 255, 0.3);
    padding: 2px 6px;
    border-radius: 3px;
}

.awmc-modal-footer {
    padding: 20px 30px 30px;
    text-align: center;
}

.awmc-modal-dismiss {
    padding: 12px 30px;
    background: #f0f0f0;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 500;
    color: #333;
    cursor: pointer;
    transition: background 0.2s;
}

.awmc-modal-dismiss:hover {
    background: #e0e0e0;
}

/* Body state when modal is open */
body.awmc-modal-open {
    overflow: hidden;
}

/* Widget Position Variants */
.awmc-currency-switcher-widget.position-top-left {
    top: 20px;
    left: 20px;
    bottom: auto;
    right: auto;
}

.awmc-currency-switcher-widget.position-top-right {
    top: 20px;
    right: 20px;
    bottom: auto;
    left: auto;
}

.awmc-currency-switcher-widget.position-bottom-left {
    bottom: 20px;
    left: 20px;
    top: auto;
    right: auto;
}

.awmc-currency-switcher-widget.position-bottom-right {
    bottom: 20px;
    right: 20px;
    top: auto;
    left: auto;
}

/* Icon-only Widget Mode */
.awmc-widget-icon {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: #2271b1;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(34, 113, 177, 0.3);
    transition: all 0.3s;
    border: none;
    font-size: 20px;
}

.awmc-widget-icon:hover {
    background: #135e96;
    transform: scale(1.1);
}

/* Style Variants */
.awmc-currency-button.style-flat {
    border: none;
    background: #f0f0f0;
}

.awmc-currency-button.style-flat:hover {
    background: #e0e0e0;
}

.awmc-currency-button.style-flat.active {
    background: #2271b1;
    color: #fff;
}

.awmc-currency-button.style-outlined {
    border: 2px solid #ddd;
    background: transparent;
}

.awmc-currency-button.style-outlined:hover {
    border-color: #2271b1;
    color: #2271b1;
}

.awmc-currency-button.style-outlined.active {
    border-color: #2271b1;
    background: #2271b1;
    color: #fff;
}

.awmc-currency-button.style-filled {
    border: none;
    background: #2271b1;
    color: #fff;
}

.awmc-currency-button.style-filled:hover {
    background: #135e96;
}

.awmc-currency-button.style-filled.active {
    background: #0a4b78;
}

/* Font Size Variants */
.awmc-currency-switcher.size-small {
    font-size: 12px;
}

.awmc-currency-switcher.size-small .awmc-currency-select,
.awmc-currency-switcher.size-small .awmc-currency-button {
    font-size: 12px;
    padding: 6px 12px;
}

.awmc-currency-switcher.size-normal {
    font-size: 14px;
}

.awmc-currency-switcher.size-large {
    font-size: 16px;
}

.awmc-currency-switcher.size-large .awmc-currency-select,
.awmc-currency-switcher.size-large .awmc-currency-button {
    font-size: 16px;
    padding: 10px 20px;
}

/* ============================================
   Animations
   ============================================ */
@keyframes awmc-fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes awmc-slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes awmc-spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes awmc-slideInRight {
    from {
        transform: translateX(120%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes awmc-slideOutRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(120%);
        opacity: 0;
    }
}

/* Mobile Modal Adjustments */
@media (max-width: 600px) {
    .awmc-modal-dialog {
        padding: 0;
        align-items: flex-end;
    }

    .awmc-modal-content {
        border-radius: 12px 12px 0 0;
        max-width: 100%;
        animation: awmc-slideUpMobile 0.3s ease;
    }

    .awmc-modal-header {
        padding: 20px 20px 15px;
    }

    .awmc-modal-title {
        font-size: 24px;
    }

    .awmc-modal-body {
        padding: 15px 20px 20px;
    }

    .awmc-currency-grid {
        grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
        gap: 10px;
    }

    .awmc-currency-option {
        padding: 12px 8px;
    }

    .awmc-currency-code {
        font-size: 16px;
    }
}

@keyframes awmc-slideUpMobile {
    from {
        transform: translateY(100%);
    }
    to {
        transform: translateY(0);
    }
}

/* ============================================
   Modal Loading States
   ============================================ */
.awmc-currency-option.awmc-loading {
    position: relative;
    opacity: 0.8;
    pointer-events: none;
}

.awmc-currency-option.awmc-disabled {
    opacity: 0.5;
    pointer-events: none;
    cursor: not-allowed;
}

/* Spinner for loading state */
.awmc-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(0, 0, 0, 0.1);
    border-left-color: #2271b1;
    border-radius: 50%;
    animation: awmc-spin 0.8s linear infinite;
    vertical-align: middle;
}

.awmc-currency-option.active .awmc-spinner {
    border-color: rgba(255, 255, 255, 0.3);
    border-left-color: #fff;
}

/* ============================================
   Checkout Currency Notification Styles
   ============================================ */
.awmc-checkout-notifications {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: var(--awmc-z-notification, 800);
    pointer-events: none;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 400px;
}

.awmc-checkout-notification {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    pointer-events: auto;
    transform: translateX(120%);
    opacity: 0;
    transition: transform 0.3s ease-out, opacity 0.3s ease-out;
}

.awmc-checkout-notification.awmc-notification-visible {
    transform: translateX(0);
    opacity: 1;
}

.awmc-notification-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.awmc-notification-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.awmc-notification-message {
    font-size: 14px;
    font-weight: 500;
    line-height: 1.4;
    color: #333;
}

/* Notification Types */
.awmc-notification-info {
    border-left: 4px solid #2271b1;
}

.awmc-notification-info .awmc-notification-icon {
    color: #2271b1;
}

.awmc-notification-success {
    border-left: 4px solid #00a32a;
}

.awmc-notification-success .awmc-notification-icon {
    color: #00a32a;
}

.awmc-notification-error {
    border-left: 4px solid #d63638;
}

.awmc-notification-error .awmc-notification-icon {
    color: #d63638;
}

.awmc-notification-warning {
    border-left: 4px solid #dba617;
}

.awmc-notification-warning .awmc-notification-icon {
    color: #dba617;
}

/* Notification Loading Spinner */
.awmc-notification-spinner {
    width: 18px;
    height: 18px;
    border: 2px solid #e0e0e0;
    border-top-color: #2271b1;
    border-radius: 50%;
    animation: awmc-spin 0.8s linear infinite;
    flex-shrink: 0;
    margin-left: 12px;
}

/* Mobile Responsiveness for Notifications */
@media (max-width: 480px) {
    .awmc-checkout-notifications {
        top: auto;
        bottom: 20px;
        right: 10px;
        left: 10px;
        max-width: none;
    }

    .awmc-checkout-notification {
        transform: translateY(120%);
    }

    .awmc-checkout-notification.awmc-notification-visible {
        transform: translateY(0);
    }

    .awmc-notification-message {
        font-size: 13px;
    }
}

/* RTL Support */
[dir="rtl"] .awmc-checkout-notifications {
    right: auto;
    left: 20px;
}

[dir="rtl"] .awmc-checkout-notification {
    transform: translateX(-120%);
    border-left: none;
    border-right: 4px solid #2271b1;
}

[dir="rtl"] .awmc-checkout-notification.awmc-notification-visible {
    transform: translateX(0);
}

[dir="rtl"] .awmc-notification-info {
    border-right-color: #2271b1;
}

[dir="rtl"] .awmc-notification-success {
    border-right-color: #00a32a;
}

[dir="rtl"] .awmc-notification-error {
    border-right-color: #d63638;
}

[dir="rtl"] .awmc-notification-warning {
    border-right-color: #dba617;
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    .awmc-checkout-notification {
        transition: opacity 0.2s ease-out;
        transform: none;
    }

    .awmc-checkout-notification.awmc-notification-visible {
        transform: none;
    }

    .awmc-notification-spinner,
    .awmc-spinner {
        animation: none;
        border-color: #2271b1;
    }
}
