/**
 * Crypto Payments for WooCommerce - Checkout Styles
 */

/* ── Network selector ──────────────────────────────────────────────── */
#cpw-network-selector {
    margin-bottom: 16px;
}

/* ── Custom dropdown ───────────────────────────────────────────────── */
.cpw-dropdown {
    position: relative;
    width: 100%;
}

.cpw-dropdown-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 15px;
    background: #fff;
    cursor: pointer;
    transition: border-color 0.2s;
    text-align: left;
    line-height: 1.4;
    gap: 8px;
}

.cpw-dropdown-trigger:focus {
    border-color: #7c3aed;
    outline: none;
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.1);
}

.cpw-dropdown-trigger:hover {
    border-color: #9ca3af;
}

.cpw-dropdown-trigger-text {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
}

.cpw-dropdown-arrow {
    flex-shrink: 0;
    transition: transform 0.2s;
}

.cpw-dropdown[aria-expanded="true"] .cpw-dropdown-arrow {
    transform: rotate(180deg);
}

.cpw-dropdown-menu {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    max-height: 280px;
    overflow-y: auto;
    background: #fff;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    z-index: 1000;
    padding: 0 0 4px;
}

.cpw-dropdown-menu--open {
    display: block;
}

/* ── Dropdown search ──────────────────────────────────────────────── */
.cpw-dropdown-search-wrap {
    position: sticky;
    top: 0;
    background: #fff;
    padding: 8px;
    z-index: 1;
}

.cpw-dropdown-search {
    width: 100%;
    padding: 7px 10px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 13px;
    background: #f9fafb;
    box-sizing: border-box;
    outline: none;
    transition: border-color 0.2s;
}

.cpw-dropdown-search:focus {
    border-color: #7c3aed;
    box-shadow: 0 0 0 2px rgba(124, 58, 237, 0.08);
    background: #fff;
}

.cpw-dropdown-no-results {
    padding: 12px;
    text-align: center;
    color: #9ca3af;
    font-size: 13px;
}

.cpw-dropdown-group-label {
    padding: 8px 12px 4px;
    font-size: 11px;
    font-weight: 600;
    color: #9ca3af;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.cpw-dropdown-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    cursor: pointer;
    transition: background-color 0.1s;
    font-size: 14px;
    color: #1f2937;
}

.cpw-dropdown-option:hover,
.cpw-dropdown-option:focus {
    background: #f3f4f6;
    outline: none;
}

.cpw-dropdown-option[aria-selected="true"],
.cpw-dropdown-option--selected {
    background: #ede9fe;
    color: #5b21b6;
}

.cpw-dropdown-option[aria-selected="true"]:hover,
.cpw-dropdown-option[aria-selected="true"]:focus {
    background: #ddd6fe;
}

.cpw-dropdown-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    flex-shrink: 0;
}

.cpw-dropdown-icon svg {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: block;
}

.cpw-dropdown-name {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── Payment details container ─────────────────────────────────────── */
#cpw-payment-details {
    background: #fafafa;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 20px;
}

/* ── Step headers ───────────────────────────────────────────────── */
.cpw-step-header {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 8px;
    margin-top: 16px;
}

.cpw-step-header:first-child {
    margin-top: 0;
}

.cpw-step-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    background: #7c3aed;
    color: #fff;
    border-radius: 50%;
    font-size: 13px;
    font-weight: 700;
    flex-shrink: 0;
}

/* ── Amount box ────────────────────────────────────────────────────── */
.cpw-amount-box {
    text-align: center;
    margin-bottom: 20px;
    padding: 16px;
    background: #fff;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
}

.cpw-amount-label {
    font-size: 13px;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
    font-weight: 600;
}

.cpw-amount-value {
    font-size: 28px;
    font-weight: 700;
    color: #111;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
}

.cpw-fiat-equiv {
    font-size: 14px;
    color: #6b7280;
    margin-top: 4px;
}

/* ── Address box ───────────────────────────────────────────────────── */
.cpw-address-box {
    text-align: center;
    margin-bottom: 20px;
    padding: 16px;
    background: #fff;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
}

.cpw-qr {
    display: flex;
    justify-content: center;
    margin: 12px 0;
}

.cpw-qr canvas,
.cpw-qr img {
    border-radius: 8px;
    border: 4px solid #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.cpw-address-value {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 8px;
    flex-wrap: wrap;
}

.cpw-address-value code {
    font-size: 12px;
    word-break: break-all;
    background: #f3f4f6;
    padding: 6px 10px;
    border-radius: 6px;
    color: #374151;
    max-width: 320px;
    display: inline-block;
}

/* ── Copy button ───────────────────────────────────────────────────── */
.cpw-copy-btn {
    background: none;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    padding: 4px 8px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
    flex-shrink: 0;
}

.cpw-copy-btn:hover {
    background: #f3f4f6;
    border-color: #9ca3af;
}

.cpw-copy-btn.copied {
    background: #dcfce7;
    border-color: #86efac;
}

/* ── Timer ─────────────────────────────────────────────────────────── */
.cpw-timer-box {
    text-align: center;
    font-size: 14px;
    color: #6b7280;
    margin-bottom: 16px;
    padding: 10px;
    background: #fffbeb;
    border-radius: 8px;
    border: 1px solid #fde68a;
}

.cpw-timer-box strong {
    color: #92400e;
    font-variant-numeric: tabular-nums;
}

.cpw-timer-box.expired {
    background: #fef2f2;
    border-color: #fecaca;
    color: #991b1b;
}

.cpw-timer-box.expired strong {
    color: #991b1b;
}

/* ── TX hash input ─────────────────────────────────────────────────── */
.cpw-tx-hash-box {
    margin-top: 0;
}

.cpw-tx-hash-box input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 14px;
    font-family: monospace;
    margin-bottom: 4px;
}

.cpw-tx-hash-box input:focus {
    border-color: #7c3aed;
    outline: none;
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.1);
}

/* ── Loading spinner ───────────────────────────────────────────────── */
.cpw-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #e5e7eb;
    border-top: 3px solid #7c3aed;
    border-radius: 50%;
    animation: cpw-spin 0.8s linear infinite;
    vertical-align: middle;
    margin-right: 8px;
}

@keyframes cpw-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ── Responsive ────────────────────────────────────────────────────── */
@media (max-width: 480px) {
    .cpw-amount-value {
        font-size: 22px;
    }

    .cpw-address-value code {
        font-size: 11px;
        max-width: 240px;
    }

    #cpw-payment-details {
        padding: 14px;
    }

    .cpw-dropdown-menu {
        max-height: 220px;
    }
}
