/**
 * Frontend CSS for Damos Currency Exchange
 */

:root {
    --damos-primary: #16A085;
    --damos-secondary: #FF7B00;
    --damos-primary-hover: #138d75;
    --damos-secondary-hover: #e66a00;
}

/* Currency Modal */
.damos-currency-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.damos-currency-modal.active {
    opacity: 1;
    visibility: visible;
}

.damos-currency-modal-content {
    background: #fff;
    border-radius: 12px;
    padding: 30px;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    transform: scale(0.9);
    transition: transform 0.3s ease;
    
    /* Always show scrollbar with better visibility */
    scrollbar-width: thin;
    scrollbar-color: var(--damos-primary) #f0f0f0;
}

/* Webkit scrollbar styling (Chrome, Safari, Edge) */
.damos-currency-modal-content::-webkit-scrollbar {
    width: 8px;
}

.damos-currency-modal-content::-webkit-scrollbar-track {
    background: #f0f0f0;
    border-radius: 10px;
}

.damos-currency-modal-content::-webkit-scrollbar-thumb {
    background: var(--damos-primary);
    border-radius: 10px;
}

.damos-currency-modal-content::-webkit-scrollbar-thumb:hover {
    background: var(--damos-primary-hover);
}

.damos-currency-modal.active .damos-currency-modal-content {
    transform: scale(1);
}

.damos-currency-modal-header {
    text-align: center;
    margin-bottom: 25px;
}

.damos-currency-modal-title {
    font-size: 24px;
    font-weight: 600;
    color: #333;
    margin-bottom: 10px;
}

.damos-currency-modal-subtitle {
    font-size: 14px;
    color: #666;
    line-height: 1.5;
}

.damos-currency-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 15px;
    margin-bottom: 25px;
}

.damos-currency-option {
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    padding: 15px 10px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    background: #fff;
}

.damos-currency-option:hover {
    border-color: var(--damos-primary);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(22, 160, 133, 0.1);
}

.damos-currency-option.selected {
    border-color: var(--damos-primary);
    background-color: rgba(22, 160, 133, 0.05);
}

.damos-currency-option-flag {
    width: 32px;
    height: 24px;
    margin: 0 auto 8px;
    border-radius: 2px;
    object-fit: cover;
}

.damos-currency-option-code {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    display: block;
    margin-bottom: 4px;
}

.damos-currency-option-name {
    font-size: 12px;
    color: #666;
    display: block;
}

.damos-currency-modal-footer {
    text-align: center;
    position: sticky;
    bottom: 0;
    background: #fff;
    padding-top: 20px;
    margin-top: 20px;
    border-top: 1px solid #f0f0f0;
}

.damos-currency-continue-btn {
    background: var(--damos-primary);
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 12px 30px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.damos-currency-continue-btn:hover {
    background: var(--damos-primary-hover);
}

.damos-currency-continue-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* Bricks Builder Specific Styling */
#brxe-rvjzcr .damos-currency-switcher-options {
    position: relative;
}

/* Currency Switcher */
.damos-currency-switcher {
    position: relative;
    display: inline-block;
}

.damos-currency-switcher-trigger {
    position: relative;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 8px 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 200px;
    transition: border-color 0.2s ease;
}

.damos-currency-switcher-trigger:hover {
    border-color: var(--damos-primary);
}

/* Currency Switcher Modal */
.damos-currency-switcher-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 9998;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.damos-currency-switcher-modal.active {
    opacity: 1;
    visibility: visible;
}

.damos-currency-switcher-modal-content {
    background: #fff;
    border-radius: 12px;
    padding: 30px;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    transform: scale(0.9);
    transition: transform 0.3s ease;
    position: relative;
}

.damos-currency-switcher-modal.active .damos-currency-switcher-modal-content {
    transform: scale(1);
}

.damos-currency-switcher-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 1px solid #eee;
}

.damos-currency-switcher-modal-title {
    font-size: 24px;
    font-weight: 600;
    color: #333;
    margin: 0;
}

.damos-currency-switcher-modal-close {
    background: none;
    border: none;
    font-size: 28px;
    color: #999;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s ease;
}

.damos-currency-switcher-modal-close:hover {
    color: #333;
}

.damos-currency-switcher-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 15px;
}

.damos-currency-switcher-option {
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    padding: 15px 10px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    background: #fff;
}

.damos-currency-switcher-option:hover {
    border-color: var(--damos-primary);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(22, 160, 133, 0.1);
}

.damos-currency-switcher-option.selected {
    border-color: var(--damos-primary);
    background-color: rgba(22, 160, 133, 0.05);
}

.damos-currency-switcher-flag {
    width: 20px;
    height: 15px;
    border-radius: 2px;
    object-fit: cover;
}

.damos-currency-switcher-name {
    font-weight: 500;
    color: #333;
    flex: 1;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.damos-currency-switcher-code {
    font-weight: 600;
    color: #333;
    background: #f5f5f5;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 12px;
}

.damos-currency-switcher-symbol {
    font-weight: 600;
    color: var(--damos-primary);
}

.damos-currency-switcher-arrow {
    margin-left: auto;
    border-style: solid;
    border-width: 4px 4px 0 4px;
    border-color: #666 transparent transparent transparent;
    transition: transform 0.2s ease;
}

/*
open > .damos-currency-switcher-options,
damos-currency-switcher.open .damos-currency-switcher-options {
    display: block;
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}
*/

.damos-currency-switcher-option {
    padding: 10px 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.damos-currency-switcher-option:hover {
    background-color: #f5f5f5;
}

.damos-currency-switcher-option.selected {
    background-color: rgba(22, 160, 133, 0.05);
    font-weight: 500;
    color: var(--damos-primary);
}

/* Button Style Switcher */
.damos-currency-switcher-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.damos-currency-btn {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 8px 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
    font-size: 14px;
    min-width: 150px;
}

.damos-currency-btn:hover {
    border-color: var(--damos-primary);
    background-color: rgba(22, 160, 133, 0.05);
}

.damos-currency-btn.active {
    background: var(--damos-primary);
    border-color: var(--damos-primary);
    color: #fff;
}

.damos-currency-btn .damos-currency-flag {
    width: 16px;
    height: 12px;
    border-radius: 1px;
    object-fit: cover;
}

.damos-currency-btn .damos-currency-name {
    font-weight: 500;
    flex: 1;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.damos-currency-btn .damos-currency-code {
    font-weight: 600;
    background: rgba(0, 0, 0, 0.05);
    padding: 2px 4px;
    border-radius: 2px;
    font-size: 11px;
}

.damos-currency-btn .damos-currency-symbol {
    font-weight: 600;
    color: var(--damos-primary);
}

.damos-currency-btn.active .damos-currency-symbol {
    color: #fff;
}

.damos-currency-btn.active .damos-currency-code {
    background: rgba(255, 255, 255, 0.2);
}

/* Select Style Switcher */
.damos-currency-switcher-select select {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 14px;
    cursor: pointer;
    min-width: 150px;
}

.damos-currency-switcher-select select:focus {
    outline: none;
    border-color: var(--damos-primary);
}

/* Currency Converter */
.damos-currency-converter {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 20px;
    max-width: 400px;
}

.damos-converter-result {
    text-align: center;
    margin-bottom: 20px;
    font-size: 18px;
    font-weight: 500;
}

.damos-converter-calculator {
    border-top: 1px solid #eee;
    padding-top: 20px;
}

.damos-converter-row {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.damos-converter-row input,
.damos-converter-row select {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.damos-converter-row input:focus,
.damos-converter-row select:focus {
    outline: none;
    border-color: var(--damos-primary);
}

.damos-converter-convert-btn {
    width: 100%;
    background: var(--damos-primary);
    color: #fff;
    border: none;
    border-radius: 4px;
    padding: 10px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.damos-converter-convert-btn:hover {
    background: var(--damos-primary-hover);
}

/* WooCommerce Integration */
.damos-woocommerce-currency-switcher {
    margin-bottom: 20px;
    text-align: right;
}

.damos-cart-currency-switcher,
.damos-checkout-currency-switcher {
    background: rgba(22, 160, 133, 0.05);
    border: 1px solid rgba(22, 160, 133, 0.2);
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
}

.damos-cart-currency-switcher h3,
.damos-checkout-currency-switcher h3 {
    margin: 0 0 10px 0;
    font-size: 16px;
    color: #333;
}

/* Responsive Design */
@media (max-width: 768px) {
    .damos-currency-modal-content {
        padding: 20px;
        margin: 20px;
    }

    .damos-currency-options {
        grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
        gap: 10px;
    }

    .damos-currency-option {
        padding: 12px 8px;
    }

    .damos-currency-option-flag {
        width: 24px;
        height: 18px;
    }

    .damos-currency-option-code {
        font-size: 14px;
    }

    .damos-currency-option-name {
        font-size: 11px;
    }

    .damos-currency-switcher-modal-content {
        padding: 20px;
        margin: 20px;
    }

    .damos-currency-switcher-options {
        grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
        gap: 10px;
    }

    .damos-currency-switcher-option {
        padding: 12px 8px;
    }

    .damos-currency-switcher-flag {
        width: 24px;
        height: 18px;
    }

    .damos-currency-switcher-code {
        font-size: 14px;
    }

    .damos-currency-switcher-name {
        font-size: 11px;
    }

    .damos-currency-switcher-buttons {
        justify-content: center;
    }

    .damos-woocommerce-currency-switcher {
        text-align: center;
    }
}

@media (max-width: 480px) {
    .damos-currency-modal-content {
        margin: 10px;
        padding: 15px;
    }

    .damos-currency-modal-title {
        font-size: 20px;
    }

    .damos-currency-options {
        grid-template-columns: repeat(2, 1fr);
    }

    .damos-currency-switcher-modal-content {
        margin: 10px;
        padding: 15px;
    }

    .damos-currency-switcher-modal-title {
        font-size: 20px;
    }

    .damos-currency-switcher-options {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Loading State */
.damos-loading {
    position: relative;
    opacity: 0.6;
    pointer-events: none;
}

.damos-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid var(--damos-primary);
    border-radius: 50%;
    animation: damos-spin 1s linear infinite;
}

@keyframes damos-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Success Message */
.damos-success-message {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.damos-success-message.active {
    opacity: 1;
    visibility: visible;
}

.damos-success-message-content {
    background: #fff;
    border-radius: 12px;
    padding: 30px;
    max-width: 450px;
    width: 90%;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    transform: scale(0.9);
    transition: transform 0.3s ease;
    text-align: center;
}

.damos-success-message.active .damos-success-message-content {
    transform: scale(1);
}

.damos-success-message strong {
    color: var(--damos-primary);
    font-size: 22px;
    display: block;
    margin-bottom: 15px;
}

.damos-success-message-currency {
    font-size: 18px;
    margin: 15px 0;
    color: #333;
}

.damos-success-message-info {
    font-size: 14px;
    color: #666;
    margin: 15px 0;
    line-height: 1.5;
}

.damos-success-message-countdown {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

.damos-success-message-countdown-text {
    font-size: 14px;
    color: #666;
    margin-bottom: 8px;
}

.damos-success-message-countdown-timer {
    font-size: 32px;
    font-weight: 600;
    color: var(--damos-primary);
}

@keyframes damos-slide-down {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

/* Error Message */
.damos-error-message {
    background: rgba(255, 123, 0, 0.1);
    color: var(--damos-secondary);
    padding: 10px 15px;
    border-radius: 4px;
    margin-bottom: 15px;
    border: 1px solid rgba(255, 123, 0, 0.3);
    font-size: 14px;
}