/**
 * VIVAIA POS V-Points - My Account Styles
 * Styling for membership information card on My Account dashboard
 * Brand Color: #804C1A (Brown)
 */

/* Main Membership Card */
.vivaia-membership-card {
    background: #ffffff;
    border-radius: 12px;
    padding: 0;
    margin: 50px 0 30px 0;
    box-shadow: 0 4px 20px rgba(128, 76, 26, 0.15);
    position: relative;
}

/* Header */
.vivaia-membership-header {
    padding: 20px 25px;
    background: #804C1A;
    border-bottom: none;
}

.vivaia-membership-header h3 {
    margin: 0;
    color: #ffffff !important;
    font-size: 18px;
    font-weight: 600;
    letter-spacing: 0.5px;
}

/* Body */
.vivaia-membership-body {
    padding: 0;
    background: #ffffff;
    position: relative;
}

/* Card Layout - Two Columns */
.vivaia-membership-layout {
    display: grid;
    grid-template-columns: 400px 1fr;
    gap: 0;
    min-height: 280px;
}

/* Card Image Column */
.vivaia-card-image-wrapper {
    background: #F5F3F0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.vivaia-card-image {
    width: 100%;
    max-width: 360px;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Content Column */
.vivaia-card-content {
    padding: 25px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

/* Member Profile Section */
.vivaia-membership-profile {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid #E0D7CE;
}

.vivaia-profile-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.vivaia-profile-label {
    color: #000000;
    font-size: 14px;
    font-weight: 500;
}

.vivaia-profile-value {
    color: #1e293b;
    font-size: 14px;
    font-weight: 600;
}

/* Barcode Section */
.vivaia-barcode-section {
    margin: 20px 0;
    padding: 20px;
    background: #ffffff;
    border: 2px dashed #E0D7CE;
    border-radius: 8px;
    text-align: center;
    transition: all 0.3s ease;
}

.vivaia-barcode-section:hover {
    border-color: #D4C4B0;
    box-shadow: 0 2px 8px rgba(128, 76, 26, 0.1);
}

.vivaia-barcode-label {
    font-size: 14px;
    font-weight: 600;
    color: #804C1A;
    margin-bottom: 15px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.vivaia-barcode-container {
    margin: 15px 0;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 80px;
    background: #ffffff;
}

.vivaia-barcode-image {
    max-width: 100%;
    height: auto;
    display: block;
}

.vivaia-barcode-id {
    font-size: 16px;
    font-weight: 700;
    color: #1e293b;
    letter-spacing: 2px;
    font-family: 'Courier New', Courier, monospace;
    margin-top: 10px;
}

/* Tier Badge (reuse from checkout) */
.vivaia-tier-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 13px;
    letter-spacing: 0.3px;
}

.vivaia-tier-vgreen {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.vivaia-tier-vsilver {
    background: #e5e7eb;
    color: #374151;
    border: 1px solid #d1d5db;
}

.vivaia-tier-vdiamond {
    background: #dbeafe;
    color: #1e40af;
    border: 1px solid #bfdbfe;
}

.vivaia-tier-無等級 {
    background: #f3f4f6;
    color: #6b7280;
    border: 1px solid #d1d5db;
}

/* Points Balance Section */
.vivaia-points-balance {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 30px;
    align-items: center;
    padding: 20px 25px;
    margin-bottom: 20px;
    background: #F5F3F0;
    border-radius: 8px;
    border: 1px solid #E0D7CE;
}

.vivaia-points-value {
    text-align: left;
}

.vivaia-points-number {
    font-size: 42px;
    font-weight: 700;
    color: #804C1A;
    line-height: 1;
    margin-bottom: 5px;
}

.vivaia-points-label {
    font-size: 14px;
    color: #5C3314;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.vivaia-points-conversion {
    text-align: right;
    padding-left: 30px;
    border-left: 2px solid #D4C4B0;
}

.vivaia-conversion-value {
    font-size: 24px;
    font-weight: 700;
    color: #A0623D;
    line-height: 1;
    margin-bottom: 5px;
}

.vivaia-conversion-note {
    font-size: 12px;
    color: #64748b;
}

/* Tier Benefits Section */
.vivaia-tier-benefits {
    margin-bottom: 20px;
}

.vivaia-benefits-title {
    margin: 0 0 15px 0;
    color: #1e293b;
    font-size: 16px;
    font-weight: 600;
}

.vivaia-benefits-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.vivaia-benefits-list li {
    padding: 10px 0 10px 30px;
    color: #334155;
    font-size: 14px;
    line-height: 1.6;
    position: relative;
    border-bottom: 1px solid #f1f5f9;
}

.vivaia-benefits-list li:last-child {
    border-bottom: none;
}

.vivaia-benefits-list li::before {
    content: '✓';
    position: absolute;
    left: 0;
    top: 10px;
    width: 20px;
    height: 20px;
    background: #10b981;
    color: #ffffff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
}

/* Call to Action Section */
.vivaia-membership-cta {
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
}

.vivaia-cta-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: #804C1A;
    color: #ffffff !important;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(128, 76, 26, 0.3);
}

.vivaia-cta-button:hover {
    background: #A0623D;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(128, 76, 26, 0.4);
    color: #ffffff !important;
}

.vivaia-cta-button svg {
    flex-shrink: 0;
}

.vivaia-cta-link {
    color: #804C1A;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s ease;
}

.vivaia-cta-link:hover {
    color: #A0623D;
    text-decoration: none;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .vivaia-membership-card {
        margin-top: 30px;
        margin-bottom: 30px;
        margin-left: 0;
        margin-right: 0;
        padding-left: 10px;
        padding-right: 10px;
        border-radius: 12px;
    }

    .vivaia-membership-header {
        padding: 15px 20px;
    }

    .vivaia-membership-header h3 {
        font-size: 16px;
    }

    /* Stack layout vertically */
    .vivaia-membership-layout {
        grid-template-columns: 1fr;
    }

    .vivaia-card-image-wrapper {
        padding: 20px;
        min-height: auto;
    }

    .vivaia-card-image {
        max-width: 100%;
    }

    .vivaia-card-content {
        padding: 20px;
    }

    .vivaia-membership-profile {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    /* Barcode Section - Mobile */
    .vivaia-barcode-section {
        margin: 15px 0;
        padding: 15px;
    }

    .vivaia-barcode-label {
        font-size: 13px;
    }

    .vivaia-barcode-container {
        min-height: 60px;
    }

    .vivaia-barcode-id {
        font-size: 14px;
        letter-spacing: 1px;
    }

    .vivaia-points-balance {
        grid-template-columns: 1fr;
        gap: 20px;
        padding: 20px;
        text-align: center;
    }

    .vivaia-points-value {
        text-align: center;
    }

    .vivaia-points-number {
        font-size: 36px;
    }

    .vivaia-points-conversion {
        text-align: center;
        padding-left: 0;
        padding-top: 20px;
        border-left: none;
        border-top: 2px solid #D4C4B0;
    }

    .vivaia-conversion-value {
        font-size: 20px;
    }

    .vivaia-membership-cta {
        flex-direction: column;
        gap: 12px;
    }

    .vivaia-cta-button {
        width: 100%;
        justify-content: center;
    }

    .vivaia-cta-link {
        width: 100%;
        text-align: center;
    }
}

/* Small Mobile */
@media (max-width: 480px) {
    .vivaia-points-number {
        font-size: 32px;
    }

    .vivaia-conversion-value {
        font-size: 18px;
    }

    .vivaia-benefits-list li {
        font-size: 13px;
        padding-left: 25px;
    }

    .vivaia-benefits-list li::before {
        width: 18px;
        height: 18px;
        font-size: 11px;
    }
}

/* Animation */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.vivaia-membership-card {
    animation: fadeInUp 0.5s ease-out;
}

/* Upgrade Benefits Tooltip */
.vivaia-upgrade-tooltip {
    position: relative;
    display: inline-block;
    margin-left: 6px;
    vertical-align: middle;
}

.vivaia-upgrade-tooltip-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    color: #804C1A;
    cursor: help;
    transition: color 0.2s ease;
}

.vivaia-upgrade-tooltip-icon:hover {
    color: #A0623D;
}

.vivaia-upgrade-tooltip-icon svg {
    width: 16px;
    height: 16px;
}

.vivaia-upgrade-tooltip-content {
    visibility: hidden;
    opacity: 0;
    position: absolute;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    background: #ffffff;
    border: 2px solid #804C1A;
    border-radius: 8px;
    padding: 16px;
    box-shadow: 0 8px 24px rgba(128, 76, 26, 0.25);
    z-index: 1000;
    width: 300px;
    max-width: 90vw;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    pointer-events: none;
}

/* Show tooltip on hover */
.vivaia-upgrade-tooltip:hover .vivaia-upgrade-tooltip-content,
.vivaia-upgrade-tooltip:focus-within .vivaia-upgrade-tooltip-content,
.vivaia-upgrade-tooltip.active .vivaia-upgrade-tooltip-content {
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
}

/* Tooltip arrow */
.vivaia-upgrade-tooltip-content::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -8px;
    border-width: 8px;
    border-style: solid;
    border-color: #804C1A transparent transparent transparent;
}

/* Inner arrow for white background */
.vivaia-upgrade-tooltip-content::before {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -6px;
    margin-top: -2px;
    border-width: 6px;
    border-style: solid;
    border-color: #ffffff transparent transparent transparent;
    z-index: 1;
}

/* Tier item styling */
.vivaia-tier-item {
    padding: 10px 0;
}

.vivaia-tier-item:not(:last-child) {
    border-bottom: 1px solid #F5F3F0;
}

.vivaia-tier-current {
    background: #F5F3F0;
    margin: 0 -8px;
    padding: 10px 8px;
    border-radius: 4px;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .vivaia-upgrade-tooltip-content {
        width: 280px;
        left: 50%;
        right: auto;
        transform: translateX(-50%);
        bottom: auto;
        top: 125%;
    }

    .vivaia-upgrade-tooltip-content::after {
        top: auto;
        bottom: 100%;
        left: 50%;
        right: auto;
        margin-left: -8px;
        border-color: transparent transparent #804C1A transparent;
    }

    .vivaia-upgrade-tooltip-content::before {
        top: auto;
        bottom: 100%;
        left: 50%;
        right: auto;
        margin-left: -6px;
        margin-top: 0;
        margin-bottom: -2px;
        border-color: transparent transparent #ffffff transparent;
    }

    /* Mobile: tap to toggle */
    .vivaia-upgrade-tooltip-icon {
        -webkit-tap-highlight-color: rgba(128, 76, 26, 0.2);
        padding: 4px;
    }
}

/* Small Mobile */
@media (max-width: 480px) {
    .vivaia-upgrade-tooltip-content {
        width: 260px;
        left: 50%;
        right: auto;
        transform: translateX(-50%);
    }
}

/* ===================================
   Cross-Site Order Source Badges
   =================================== */

/* Order source column */
.woocommerce-orders-table__cell-order-source {
    text-align: center;
    white-space: nowrap;
    padding: 12px 8px;
    vertical-align: middle;
}

/* Badge base styles */
.vivaia-order-badge {
    display: inline-block;
    padding: 5px 14px;
    border-radius: 16px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    line-height: 1.4;
    white-space: nowrap;
    transition: all 0.2s ease;
}

/* EC Order Badge (Blue) */
.vivaia-order-badge.ec-order {
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
    color: #1565c0;
    border: 1px solid #64b5f6;
    box-shadow: 0 1px 3px rgba(21, 101, 192, 0.1);
}

.vivaia-order-badge.ec-order:hover {
    box-shadow: 0 2px 6px rgba(21, 101, 192, 0.2);
}

/* POS Order Badge (Green) */
.vivaia-order-badge.pos-order {
    background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%);
    color: #2e7d32;
    border: 1px solid #66bb6a;
    box-shadow: 0 1px 3px rgba(46, 125, 50, 0.1);
}

.vivaia-order-badge.pos-order:hover {
    box-shadow: 0 2px 6px rgba(46, 125, 50, 0.2);
}

/* Local Fulfillment Badge (Black) - split child order, POS warehouse */
.vivaia-order-badge.local-fulfillment {
    background: #333333;
    color: #ffffff;
    border: 1px solid #333333;
}

/* International Fulfillment Badge (Black) - split child order, Brand warehouse */
.vivaia-order-badge.intl-fulfillment {
    background: #333333;
    color: #ffffff;
    border: 1px solid #333333;
}

/* POS linking notice */
.woocommerce-info.pos-linking-notice {
    background: #fff9e6;
    border-left: 4px solid #ffa000;
    margin-bottom: 20px;
    padding: 16px;
}

.woocommerce-info.pos-linking-notice p {
    margin: 0;
    color: #664d03;
    font-size: 14px;
    line-height: 1.6;
}

.woocommerce-info.pos-linking-notice strong {
    color: #804C1A;
}

/* Mobile responsive */
@media (max-width: 768px) {
    .woocommerce-orders-table__cell-order-source {
        padding: 8px 4px;
    }

    .vivaia-order-badge {
        font-size: 10px;
        padding: 4px 10px;
        letter-spacing: 0.3px;
    }

    .woocommerce-info.pos-linking-notice {
        padding: 12px;
    }

    .woocommerce-info.pos-linking-notice p {
        font-size: 13px;
    }
}

/* Extra small mobile */
@media (max-width: 480px) {
    .vivaia-order-badge {
        font-size: 9px;
        padding: 3px 8px;
    }
}
