/* WooCommerce Referral Wallet - Frontend Styles */

/* Wallet page styles with accessibility focus */
.wc-referral-wallet {
    width: 100%;
    font-family: inherit;
}

/* Guest Modal Styles */
.referral-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.referral-modal.active {
    display: flex !important;
    opacity: 1;
    visibility: visible;
}

.referral-modal-content {
    background: white;
    border-radius: 8px;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.referral-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #eee;
}

.referral-modal-title {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: #333;
}

.referral-modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #999;
    transition: color 0.2s;
}

.referral-modal-close:hover {
    color: #333;
}

.referral-modal-body {
    padding: 20px;
}

.referral-actions {
    margin-top: 20px;
    text-align: center;
}

.referral-actions .button {
    display: inline-block;
    margin: 0 10px;
    padding: 12px 24px;
    text-decoration: none;
    border-radius: 4px;
    font-weight: bold;
    transition: all 0.3s ease;
}

.referral-actions .button.primary {
    background-color: #007cba;
    color: white;
}

.referral-actions .button.secondary {
    background-color: #f0f0f0;
    color: #333;
    border: 1px solid #ddd;
}

.referral-actions .button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

/* Shortcode styles */
.wc-referral-shortcode {
    display: flex;
    gap: 10px;
    margin: 15px 0;
    align-items: center;
}

.wc-referral-shortcode .referral-link-input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.wc-referral-link-btn {
    background: #2271b1;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.3s;
}

.wc-referral-link-btn:hover {
    background: #1e5a8a;
}

.wc-wallet-balance {
    display: inline-block;
    background: #f8f9fa;
    padding: 8px 12px;
    border-radius: 4px;
    font-weight: bold;
    color: #2271b1;
    border: 1px solid #e9ecef;
}

/* Wallet Credits Checkout Section */
.wallet-credits-checkout {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    padding: 20px;
    margin: 20px 0;
    transition: all 0.3s ease;
}

.wallet-credits-checkout.updating {
    opacity: 0.7;
    pointer-events: none;
}

.wallet-credits-checkout h4 {
    margin: 0 0 15px 0;
    color: #495057;
    font-size: 18px;
    font-weight: 600;
}

.wallet-balance-info {
    margin-bottom: 15px;
}

.wallet-balance-info p {
    margin: 8px 0;
    font-size: 14px;
    color: #6c757d;
    line-height: 1.4;
}

.wallet-checkbox-label {
    display: flex;
    align-items: center;
    font-weight: 500;
    cursor: pointer;
    font-size: 16px;
    color: #495057;
    transition: color 0.2s ease;
}

.wallet-checkbox-label:hover {
    color: #007cba;
}

.wallet-checkbox-label input[type="checkbox"] {
    margin-right: 10px;
    transform: scale(1.2);
    cursor: pointer;
}

.wallet-checkbox-label .updating-text {
    margin-left: 10px;
    font-size: 14px;
    color: #6c757d;
    font-style: italic;
}

.wc-referral-stats {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.wc-referral-stats .stat {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    padding: 5px 0;
    border-bottom: 1px solid #e9ecef;
}

.wc-referral-stats .stat:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.wc-referral-stats .label {
    font-weight: 600;
    color: #333;
}

.wc-referral-stats .value {
    font-weight: bold;
    color: #2271b1;
}

/* Wallet header */
.wallet-header {
    margin-bottom: 30px;
}

.wallet-header h2 {
    color: #333;
    font-size: 28px;
    margin-bottom: 20px;
    border-bottom: 2px solid #2271b1;
    padding-bottom: 10px;
}

/* Balance display */
.wallet-balance {
    background: linear-gradient(135deg, #2271b1 0%, #1e5a8a 100%);
    color: white;
    padding: 25px;
    border-radius: 10px;
    text-align: center;
    margin-bottom: 25px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.balance-heading {
    margin: 0 0 15px 0;
    font-size: 16px;
    opacity: 0.9;
    font-weight: normal;
}

.balance-amount {
    font-size: 36px;
    font-weight: bold;
    letter-spacing: 1px;
}

.currency {
    opacity: 0.8;
    margin-right: 5px;
}

/* Referral link section */
.referral-link-section {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 30px;
    border-left: 4px solid #2271b1;
}

.referral-link-section h3 {
    margin-top: 0;
    color: #333;
    font-size: 18px;
}

.referral-link-container {
    display: flex;
    gap: 10px;
    margin: 15px 0;
    flex-wrap: wrap;
}

.referral-link-input {
    flex: 1;
    min-width: 300px;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
    background: #fff;
    font-family: monospace;
}

.referral-link-input:focus {
    outline: none;
    border-color: #2271b1;
    box-shadow: 0 0 0 2px rgba(34, 113, 177, 0.2);
}

.copy-link-btn {
    background: #2271b1;
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-weight: 600;
    transition: background-color 0.2s ease;
    min-width: 100px;
}

.copy-link-btn:hover {
    background: #1e5a8a;
}

.copy-link-btn:focus {
    outline: 2px solid #2271b1;
    outline-offset: 2px;
}

.referral-description {
    color: #666;
    font-style: italic;
    margin: 10px 0 0 0;
}

/* Transactions section */
.wallet-transactions {
    margin-top: 30px;
}

.wallet-transactions h3 {
    color: #333;
    font-size: 22px;
    margin-bottom: 20px;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
}

/* Table styles with accessibility */
.table-responsive {
    overflow-x: auto;
    margin-bottom: 20px;
}

.wallet-transactions-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.wallet-transactions-table th {
    background: #f8f9fa;
    color: #333;
    font-weight: 600;
    padding: 15px 12px;
    text-align: left;
    border-bottom: 2px solid #dee2e6;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.wallet-transactions-table td {
    padding: 15px 12px;
    border-bottom: 1px solid #eee;
    vertical-align: middle;
}

.wallet-transactions-table tr:hover {
    background: #f8f9fa;
}

.wallet-transactions-table tr:last-child td {
    border-bottom: none;
}

/* Transaction type styling */
.transaction-type {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.type-credit {
    background: #d4edda;
    color: #155724;
}

.type-debit {
    background: #f8d7da;
    color: #721c24;
}

/* Amount styling */
.amount-cell .amount {
    font-weight: 600;
    font-family: monospace;
}

.amount.positive {
    color: #28a745;
}

.amount.negative {
    color: #dc3545;
}

.balance-cell {
    font-weight: 600;
    font-family: monospace;
    color: #2271b1;
}

/* Empty state */
.wallet-empty {
    text-align: center;
    padding: 40px 20px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 2px dashed #dee2e6;
}

.wallet-empty h3 {
    color: #666;
    margin-bottom: 10px;
}

.wallet-empty p {
    color: #888;
    font-style: italic;
}

/* Responsive design */
@media (max-width: 768px) {
    .wallet-header h2 {
        font-size: 24px;
    }
    
    .balance-amount {
        font-size: 28px;
    }
    
    .referral-link-container {
        flex-direction: column;
    }
    
    .referral-link-input {
        min-width: auto;
    }
    
    .copy-link-btn {
        width: 100%;
    }
    
    /* Mobile table view */
    .wallet-transactions-table,
    .wallet-transactions-table thead,
    .wallet-transactions-table tbody,
    .wallet-transactions-table th,
    .wallet-transactions-table td,
    .wallet-transactions-table tr {
        display: block;
    }
    
    .wallet-transactions-table thead tr {
        position: absolute;
        top: -9999px;
        left: -9999px;
    }
    
    .wallet-transactions-table tr {
        border: 1px solid #ccc;
        margin-bottom: 10px;
        border-radius: 8px;
        padding: 15px;
        background: #fff;
    }
    
    .wallet-transactions-table td {
        border: none;
        position: relative;
        padding: 8px 0;
    }
    
    .wallet-transactions-table td:before {
        content: attr(data-label) ": ";
        font-weight: 600;
        color: #333;
        text-transform: uppercase;
        font-size: 12px;
        letter-spacing: 0.5px;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .wallet-balance {
        background: #000;
        color: #fff;
        border: 2px solid #fff;
    }
    
    .copy-link-btn {
        background: #000;
        border: 2px solid #fff;
    }
    
    .transaction-type {
        border: 1px solid currentColor;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .copy-link-btn {
        transition: none;
    }
    
    .wallet-transactions-table tr {
        transition: none;
    }
}

/* Focus management for better accessibility */
.wallet-transactions-table:focus-within {
    outline: 2px solid #2271b1;
    outline-offset: 2px;
}

/* Social Sharing Buttons */
.social-sharing-buttons {
    margin-top: 20px;
    padding: 20px;
    background: #f9f9f9;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
}

.social-sharing-buttons h4 {
    margin: 0 0 15px 0;
    font-size: 14px;
    font-weight: 600;
    color: #333;
}

.share-buttons-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.share-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 15px;
    background: #fff;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    text-decoration: none;
    color: #333;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.3s ease;
    min-width: 100px;
    justify-content: center;
}

.share-btn:hover {
    text-decoration: none;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.share-btn:focus {
    outline: 2px solid #2c5aa0;
    outline-offset: 2px;
}

.share-btn .share-icon {
    font-size: 16px;
}

/* Individual button colors */
.email-share:hover {
    background: #ff6b35;
    color: white;
    border-color: #ff6b35;
}

.twitter-share:hover {
    background: #1da1f2;
    color: white;
    border-color: #1da1f2;
}

.facebook-share:hover {
    background: #4267b2;
    color: white;
    border-color: #4267b2;
}

.whatsapp-share:hover {
    background: #25d366;
    color: white;
    border-color: #25d366;
}

.linkedin-share:hover {
    background: #0077b5;
    color: white;
    border-color: #0077b5;
}

/* Responsive design for mobile */
@media (max-width: 768px) {
    .share-buttons-row {
        flex-direction: column;
    }
    
    .share-btn {
        width: 100%;
        min-width: auto;
    }
}

/* Referral Information Sections */
.referral-info-section {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 20px;
    margin: 20px 0;
}

.referral-info-section h3 {
    color: #2271b1;
    margin-bottom: 15px;
    font-size: 18px;
    font-weight: 600;
}

.referred-by-info {
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 15px;
}

.referred-by-info p {
    margin: 0 0 10px 0;
}

.referred-by-info .referrer-name {
    color: #2271b1;
    font-weight: 600;
}

.referred-by-info .referrer-email {
    color: #666;
    font-style: italic;
}

.referred-by-info .referral-date {
    color: #888;
    font-size: 13px;
    margin-bottom: 0;
}

/* Referred Users Table */
.referred-users-list {
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    overflow: hidden;
}

.wc-referral-table {
    width: 100%;
    border-collapse: collapse;
    margin: 0;
}

.wc-referral-table th,
.wc-referral-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.wc-referral-table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #2271b1;
    border-bottom: 2px solid #e9ecef;
}

.wc-referral-table tbody tr:hover {
    background: #f8f9fa;
}

.wc-referral-table .user-info strong {
    color: #2271b1;
}

.wc-referral-table .user-info small {
    color: #666;
    font-size: 12px;
}

/* Status and Stage Badges */
.status-badge, .stage-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-badge.status-completed {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.status-badge.status-pending {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

.status-badge.status-flagged {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.stage-badge.stage-user-registration {
    background: #e2e3e5;
    color: #41464b;
    border: 1px solid #d6d8db;
}

.stage-badge.stage-first-order {
    background: #cce5ff;
    color: #004085;
    border: 1px solid #b8daff;
}

.stage-badge.stage-bonus-awarded {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.bonus-earned.positive {
    color: #28a745;
    font-weight: 600;
}

.bonus-pending {
    color: #6c757d;
    font-style: italic;
}

/* Responsive design for referral info */
@media (max-width: 768px) {
    .referral-info-section {
        padding: 15px;
        margin: 15px 0;
    }
    
    .wc-referral-table {
        font-size: 14px;
    }
    
    .wc-referral-table th,
    .wc-referral-table td {
        padding: 8px;
    }
    
    .wc-referral-table .user-info {
        min-width: 120px;
    }
}

@media (max-width: 480px) {
    .wc-referral-table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }
    
    .status-badge, .stage-badge {
        font-size: 10px;
        padding: 2px 6px;
    }
}

/* Referral Details Link Styling */
.referral-details-link {
    color: #007cba;
    text-decoration: none;
    cursor: pointer;
    font-weight: 500;
    transition: color 0.2s ease;
}

.referral-details-link:hover {
    color: #005177;
    text-decoration: underline;
}

.referral-details-link:focus {
    outline: 2px solid #007cba;
    outline-offset: 2px;
    border-radius: 2px;
}

/* Referral info sections */
.referral-info-section .referral-details-link {
    color: #007cba;
    font-weight: 600;
}

.wc-referral-table .referral-details-link {
    color: #007cba;
    font-weight: 500;
}

/* Accessibility improvements for sharing buttons */
@media (prefers-reduced-motion: reduce) {
    .share-btn {
        transition: none;
    }
    
    .share-btn:hover {
        transform: none;
    }
    
    .referral-details-link {
        transition: none;
    }
}

/* Dual Bonus System Styles */
.dual-bonus-info-section {
    margin: 2rem 0;
    background: #f8f9fa;
    border-radius: 8px;
    padding: 1.5rem;
    border-left: 4px solid #007cba;
}

.dual-bonus-info-section h3 {
    margin-top: 0;
    color: #007cba;
    font-size: 1.25rem;
}

.bonus-program-info {
    margin-top: 1rem;
}

.bonus-info-card {
    background: white;
    border-radius: 6px;
    padding: 1.5rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.bonus-info-card h4 {
    margin-top: 0;
    margin-bottom: 0.75rem;
    color: #333;
    font-size: 1.1rem;
}

.bonus-info-card p {
    margin-bottom: 1rem;
    color: #666;
    line-height: 1.5;
}

.bonus-details {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.bonus-detail {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid #eee;
}

.bonus-detail:last-child {
    border-bottom: none;
}

.bonus-detail strong {
    color: #333;
    flex: 1;
}

.bonus-amount {
    color: #007cba;
    font-weight: 600;
    font-size: 1.1rem;
}

.max-reached {
    color: #d63384;
    font-style: italic;
    margin-left: 0.5rem;
}

/* Responsive bonus details */
@media (max-width: 600px) {
    .bonus-detail {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.25rem;
    }
    
    .dual-bonus-info-section {
        padding: 1rem;
    }
    
    .bonus-info-card {
        padding: 1rem;
    }
}
