/**
 * Currency Converter Widget - Frontend Styles
 * Version: 3.0.0
 */

/* Widget Container */
.cwc-widget-container {
    display: flex;
    justify-content: center;
    margin: 1em 0;
}

.cwc-widget-container.alignleft {
    justify-content: flex-start;
}

.cwc-widget-container.alignright {
    justify-content: flex-end;
}

.cwc-widget-container.aligncenter {
    justify-content: center;
}

.cwc-widget-container.alignwide,
.cwc-widget-container.alignfull {
    width: 100%;
}

/* Widget iframe */
.cwc-widget-container iframe {
    border: none;
    border-radius: 8px;
    max-width: 100%;
}

/* Responsive adjustments */
@media (max-width: 480px) {
    .cwc-widget-container iframe {
        width: 100% !important;
        max-width: 100%;
    }
}

/* WordPress widget area support */
.widget .cwc-widget-container {
    justify-content: center;
}

.widget .cwc-widget-container iframe {
    max-width: 100%;
}

/* Gutenberg block alignment support */
.wp-block-currency-wiki-converter {
    display: flex;
    justify-content: center;
}

.wp-block-currency-wiki-converter.alignleft {
    justify-content: flex-start;
}

.wp-block-currency-wiki-converter.alignright {
    justify-content: flex-end;
}

.wp-block-currency-wiki-converter.aligncenter {
    justify-content: center;
}

.wp-block-currency-wiki-converter.alignwide,
.wp-block-currency-wiki-converter.alignfull {
    width: 100%;
}

/* Below-post placement */
.cwc-after-content {
    margin: 2em 0 1em;
}

/* Floating button */
.cwc-float {
    --cwc-float-accent: #2563eb;
    position: fixed;
    bottom: calc(var(--cwc-float-y, 20px) + env(safe-area-inset-bottom, 0px));
    z-index: 99990;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.cwc-float--right {
    right: calc(var(--cwc-float-x, 20px) + env(safe-area-inset-right, 0px));
    align-items: flex-end;
}

.cwc-float--left {
    left: calc(var(--cwc-float-x, 20px) + env(safe-area-inset-left, 0px));
    align-items: flex-start;
}

.cwc-float .cwc-float-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: var(--cwc-float-accent);
    color: var(--cwc-float-icon, #fff);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.22);
    cursor: pointer;
    transition: transform 0.15s ease;
}

.cwc-float .cwc-float-btn:hover {
    transform: scale(1.05);
}

.cwc-float .cwc-float-btn:focus-visible,
.cwc-float .cwc-float-close:focus-visible {
    outline: 3px solid var(--cwc-float-accent);
    outline-offset: 3px;
}

.cwc-float .cwc-float-btn svg {
    width: 26px;
    height: 26px;
}

.cwc-float .cwc-float-panel {
    position: relative;
    max-width: calc(100vw - 20px - var(--cwc-float-x, 20px));
    max-height: calc(100vh - 100px - var(--cwc-float-y, 20px));
    overflow: auto;
    padding: 34px 10px 10px;
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
}

.cwc-float .cwc-float-panel[hidden] {
    display: none;
}

.cwc-float .cwc-float-close {
    position: absolute;
    top: 6px;
    right: 8px;
    width: 28px;
    height: 28px;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: #475569;
    font-size: 22px;
    line-height: 28px;
    cursor: pointer;
}

.cwc-float .cwc-float-close:hover {
    background: rgba(0, 0, 0, 0.06);
}

.cwc-float.cwc-float--theme-dark .cwc-float-panel {
    background: #111827;
}

.cwc-float.cwc-float--theme-dark .cwc-float-close {
    color: #cbd5e1;
}

@media (prefers-color-scheme: dark) {
    .cwc-float.cwc-float--theme-auto .cwc-float-panel {
        background: #111827;
    }
    .cwc-float.cwc-float--theme-auto .cwc-float-close {
        color: #cbd5e1;
    }
}

.cwc-float .cwc-float-btn .cwc-float-icon-close,
.cwc-float.is-open .cwc-float-btn .cwc-float-icon-open {
    display: none;
}

.cwc-float.is-open .cwc-float-btn .cwc-float-icon-close {
    display: block;
}

.cwc-float.cwc-float--custom .cwc-float-panel {
    padding: 0;
    background: var(--cwc-float-panel-bg);
    border-radius: var(--cwc-float-radius, 12px);
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.28);
}

.cwc-float.cwc-float--custom .cwc-float-close {
    display: none;
}

@media (prefers-reduced-motion: reduce) {
    .cwc-float .cwc-float-btn {
        transition: none;
    }
}

@media print {
    .cwc-float {
        display: none;
    }
}
