/**
 * WCodeon Royalty - Frontend Styles
 * 
 * @package WCodeonRoyalty
 * @version 1.0.0
 */

/* ==========================================================================
   Base Styles
   ========================================================================== */

.wcodeonroyalty-loyalty-rewards,
.wcodeonroyalty-referral-program,
.wcodeonroyalty-gift-selector,
.wcodeonroyalty-user-points,
.wcodeonroyalty-referral-code,
.wcodeonroyalty-gift-list,
.wcodeonroyalty-points-history,
.wcodeonroyalty-referral-stats,
.wcodeonroyalty-loyalty-dashboard {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    line-height: 1.6;
    color: #333;
}

/* ==========================================================================
   Gift Selector Styles
   ========================================================================== */

.wcodeonroyalty-gift-selector {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 24px;
    margin: 20px 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.gift-selector-header {
    text-align: center;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid #e0e0e0;
}

.gift-selector-header h3 {
    margin: 0 0 8px 0;
    font-size: 24px;
    font-weight: 600;
    color: #000;
}

.gift-selector-subtitle {
    margin: 0;
    color: #666;
    font-size: 16px;
}

.gift-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.gift-option {
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px;
    transition: all 0.3s ease;
    cursor: pointer;
    background: #fff;
}

.gift-option:hover {
    border-color: #0073aa;
    box-shadow: 0 4px 8px rgba(0,115,170,0.1);
}

.gift-option.selected {
    border-color: #0073aa;
    background: #f8f9fa;
}

.gift-option-content {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.gift-image {
    text-align: center;
    margin-bottom: 16px;
}

.gift-product-image {
    max-width: 120px;
    height: auto;
    border-radius: 4px;
}

.gift-placeholder-image {
    width: 120px;
    height: 120px;
    background: #f0f0f0;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
}

.gift-placeholder-image .dashicons {
    font-size: 48px;
    color: #999;
}

.gift-details {
    flex: 1;
    margin-bottom: 16px;
}

.gift-name {
    margin: 0 0 8px 0;
    font-size: 18px;
    font-weight: 600;
    color: #000;
}

.gift-description {
    margin: 0 0 12px 0;
    color: #666;
    font-size: 14px;
    line-height: 1.5;
}

.gift-meta {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.gift-value,
.gift-tier {
    font-size: 14px;
    color: #666;
}

.gift-value {
    font-weight: 600;
    color: #0073aa;
}

.gift-actions {
    text-align: center;
}

.gift-select-btn,
.gift-remove-btn {
    background: #0073aa;
    color: #fff;
    border: none;
    padding: 12px 24px;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s ease;
    min-width: 120px;
}

.gift-select-btn:hover {
    background: #005a87;
}

.gift-remove-btn {
    background: #dc3232;
}

.gift-remove-btn:hover {
    background: #b32d2e;
}

.gift-selected-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #00a32a;
    color: #fff;
    padding: 8px 16px;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
}

.gift-selected-badge .dashicons {
    font-size: 16px;
}

.gift-selected-notice {
    background: #e7f3ff;
    border: 1px solid #0073aa;
    border-radius: 4px;
    padding: 16px;
    margin-bottom: 20px;
}

.notice-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.notice-content .dashicons {
    color: #0073aa;
    font-size: 20px;
}

.notice-content p {
    margin: 0;
    color: #0073aa;
    font-weight: 500;
}

.gift-selector-footer {
    text-align: center;
    padding-top: 16px;
    border-top: 1px solid #e0e0e0;
}

.gift-terms {
    margin: 0;
    font-size: 12px;
    color: #999;
    font-style: italic;
}

/* ==========================================================================
   Points Display Styles
   ========================================================================== */

.wcodeonroyalty-user-points {
    display: inline-block;
}

.points-detailed {
    text-align: center;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
}

.points-detailed h4 {
    margin: 0 0 12px 0;
    font-size: 16px;
    color: #666;
}

.points-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.points-number {
    font-size: 32px;
    font-weight: 700;
    color: #0073aa;
}

.points-text {
    font-size: 14px;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.points-label {
    font-weight: 600;
    color: #333;
}

.points-value {
    font-weight: 700;
    color: #0073aa;
}

/* ==========================================================================
   Referral Code Styles
   ========================================================================== */

.wcodeonroyalty-referral-code {
    margin: 20px 0;
}

.referral-code-container {
    display: flex;
    gap: 8px;
    align-items: center;
}

.referral-code-input {
    flex: 1;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-family: monospace;
    font-size: 14px;
    background: #f8f9fa;
}

.copy-referral-btn {
    background: #0073aa;
    color: #fff;
    border: none;
    padding: 12px 16px;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.3s ease;
}

.copy-referral-btn:hover {
    background: #005a87;
}

/* ==========================================================================
   Gift List Styles
   ========================================================================== */

.wcodeonroyalty-gift-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin: 20px 0;
}

.gift-item {
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px;
    background: #fff;
    transition: all 0.3s ease;
}

.gift-item:hover {
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.gift-item.unavailable {
    opacity: 0.6;
    background: #f8f9fa;
}

.gift-content {
    text-align: center;
}

.gift-title {
    margin: 0 0 8px 0;
    font-size: 18px;
    font-weight: 600;
    color: #000;
}

.gift-description {
    margin: 0 0 12px 0;
    color: #666;
    font-size: 14px;
}

.gift-points {
    margin-bottom: 16px;
}

.points-required {
    background: #0073aa;
    color: #fff;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.redeem-gift-btn {
    background: #00a32a;
    color: #fff;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.3s ease;
    width: 100%;
}

.redeem-gift-btn:hover {
    background: #008a20;
}

.redeem-gift-btn.disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* ==========================================================================
   Points History Styles
   ========================================================================== */

.wcodeonroyalty-points-history {
    margin: 20px 0;
}

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

.points-history-table th,
.points-history-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid #e0e0e0;
}

.points-history-table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #333;
}

.points-positive {
    color: #00a32a;
    font-weight: 600;
}

.points-negative {
    color: #dc3232;
    font-weight: 600;
}

/* ==========================================================================
   Referral Stats Styles
   ========================================================================== */

.wcodeonroyalty-referral-stats {
    margin: 20px 0;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin: 20px 0;
}

.stat-item {
    text-align: center;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
}

.stat-number {
    display: block;
    font-size: 28px;
    font-weight: 700;
    color: #0073aa;
    margin-bottom: 8px;
}

.stat-label {
    font-size: 14px;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stats-list {
    list-style: none;
    padding: 0;
    margin: 20px 0;
}

.stats-list li {
    padding: 8px 0;
    border-bottom: 1px solid #e0e0e0;
}

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

/* ==========================================================================
   Loyalty Dashboard Styles
   ========================================================================== */

.wcodeonroyalty-loyalty-dashboard {
    margin: 20px 0;
}

.dashboard-section {
    margin-bottom: 40px;
    padding: 24px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.dashboard-section h3 {
    margin: 0 0 20px 0;
    font-size: 20px;
    font-weight: 600;
    color: #000;
    padding-bottom: 12px;
    border-bottom: 2px solid #0073aa;
}

/* ==========================================================================
   Cart & Checkout Styles
   ========================================================================== */

.wcodeonroyalty-cart-points-info,
.wcodeonroyalty-checkout-points-info {
    background: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 16px;
    margin: 20px 0;
}

.wcodeonroyalty-checkout-points-info h3 {
    margin: 0 0 12px 0;
    font-size: 18px;
    color: #0073aa;
}

.wcodeonroyalty-cart-points-info p,
.wcodeonroyalty-checkout-points-info p {
    margin: 8px 0;
    font-size: 14px;
}

/* ==========================================================================
   Gift Badge Styles
   ========================================================================== */

.wcodeonroyalty-gift-item {
    color: #00a32a;
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.wcodeonroyalty-gift-badge {
    color: #00a32a;
    font-weight: 600;
    font-size: 12px;
    margin-left: 8px;
}

/* ==========================================================================
   Responsive Design
   ========================================================================== */

@media (max-width: 768px) {
    .gift-options {
        grid-template-columns: 1fr;
    }
    
    .gift-option-content {
        text-align: center;
    }
    
    .referral-code-container {
        flex-direction: column;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .points-history-table {
        font-size: 14px;
    }
    
    .points-history-table th,
    .points-history-table td {
        padding: 8px 12px;
    }
}

@media (max-width: 480px) {
    .wcodeonroyalty-gift-selector {
        padding: 16px;
        margin: 16px 0;
    }
    
    .gift-selector-header h3 {
        font-size: 20px;
    }
    
    .gift-option {
        padding: 16px;
    }
    
    .dashboard-section {
        padding: 16px;
    }
}

/* ==========================================================================
   Loading States
   ========================================================================== */

.wcodeonroyalty-loading {
    opacity: 0.6;
    pointer-events: none;
}

.wcodeonroyalty-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #0073aa;
    border-top: 2px solid transparent;
    border-radius: 50%;
    animation: wcodeonroyalty-spin 1s linear infinite;
}

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

/* ==========================================================================
   Hide WooCommerce Navigation for Loyalty Pages
   ========================================================================== */

/* Hide the left navigation menu for My Account pages */
.woocommerce-account .woocommerce-MyAccount-navigation {
    display: none !important;
}

/* Make content full width */
.woocommerce-account .woocommerce-MyAccount-content {
    width: 100% !important;
    float: none !important;
    margin: 0 !important;
}

/* Full width layout for loyalty pages */
.wcodeonroyalty-fullwidth {
    width: 100vw !important;
    margin-left: calc(50% - 50vw) !important;
    margin-right: calc(50% - 50vw) !important;
    padding-left: 20px !important;
    padding-right: 20px !important;
    max-width: none !important;
}

/* Override any theme container constraints */
.woocommerce-account .wcodeonroyalty-fullwidth {
    position: relative;
    left: 50%;
    right: 50%;
    margin-left: -50vw !important;
    margin-right: -50vw !important;
    width: 100vw !important;
    max-width: 100vw !important;
}

/* Ensure content areas are full width */
.woocommerce .col2-set .col-1,
.woocommerce .col2-set .col-2 {
    display: none !important;
}

.woocommerce-account .woocommerce-MyAccount-content .wcodeonroyalty-loyalty-rewards,
.woocommerce-account .woocommerce-MyAccount-content .wcodeonroyalty-referral-program {
    margin: 0 !important;
    padding: 20px !important;
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    .wcodeonroyalty-fullwidth {
        margin-left: -20px !important;
        margin-right: -20px !important;
        width: calc(100% + 40px) !important;
        left: auto !important;
        right: auto !important;
    }
}

/* ==========================================================================
   Utility Classes
   ========================================================================== */

.wcodeonroyalty-text-center {
    text-align: center;
}

.wcodeonroyalty-text-left {
    text-align: left;
}

.wcodeonroyalty-text-right {
    text-align: right;
}

.wcodeonroyalty-mb-0 { margin-bottom: 0; }
.wcodeonroyalty-mb-1 { margin-bottom: 8px; }
.wcodeonroyalty-mb-2 { margin-bottom: 16px; }
.wcodeonroyalty-mb-3 { margin-bottom: 24px; }

.wcodeonroyalty-mt-0 { margin-top: 0; }
.wcodeonroyalty-mt-1 { margin-top: 8px; }
.wcodeonroyalty-mt-2 { margin-top: 16px; }
.wcodeonroyalty-mt-3 { margin-top: 24px; }
