/**
 * Frontend Styles
 */

/* Dashboard */
.wc-loyalty-dashboard {
    max-width: 1200px;
    margin: 0 auto;
}

.loyalty-card {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    transition: transform 0.2s, box-shadow 0.2s;
}

.loyalty-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.balance-card, .tier-card, .help-card {
    display: flex;
    align-items: flex-start;
    gap: 20px;
}

.tier-card {
    align-items: center;
}

.card-icon {
    font-size: 64px;
    line-height: 1;
}

.card-content h3 {
    margin: 0 0 10px;
    color: #333;
    font-size: 18px;
}

.balance-amount {
    font-size: 36px;
    font-weight: bold;
    color: #2c3e50;
    margin: 10px 0;
}

.balance-info {
    color: #666;
    font-size: 14px;
    margin: 5px 0 0;
}

.tier-name {
    font-size: 16px;
    font-weight: bold;
    color: #2c3e50;
    margin: 5px 0;
}

.tier-rate {
    color: #27ae60;
    font-size: 16px;
    font-weight: 600;
}

/* Help Card */
.help-card {
    background: #f8f9fa;
    border-left: 4px solid #0073aa;
    margin-top: 40px;
}

.help-card .card-icon {
    font-size: 48px;
    flex-shrink: 0;
}

.help-content {
    flex: 1;
}

.help-content p {
    color: #555;
    line-height: 1.6;
    margin: 0 0 15px;
}

.help-steps {
    margin: 15px 0;
    padding-left: 20px;
    color: #555;
}

.help-steps li {
    margin: 10px 0;
    line-height: 1.6;
}

.help-note {
    background: #fff;
    border-left: 3px solid #0073aa;
    padding: 12px 15px;
    margin: 20px 0 15px;
    border-radius: 4px;
    font-size: 14px;
}

.help-note strong {
    color: #0073aa;
}

.help-button {
    margin-top: 15px;
    display: inline-block;
}

/* Progress */
.tier-progress {
    margin-top: 15px;
}

.progress-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    font-weight: 600;
}

.progress-header .current {
    color: #2c3e50;
}

.progress-header .next {
    color: #3498db;
}

.progress-bar {
    background: #e0e0e0;
    height: 24px;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 10px;
}

.progress-fill {
    background: linear-gradient(90deg, #3498db, #2ecc71);
    height: 100%;
    transition: width 0.5s ease;
    border-radius: 12px;
}

.progress-info {
    color: #666;
    font-size: 14px;
    margin: 5px 0;
}

.yearly-total {
    color: #999;
    font-size: 13px;
    margin: 5px 0 0;
}

.max-tier {
    text-align: center;
    font-size: 18px;
    color: #27ae60;
    margin: 20px 0;
}

/* Benefits */
.benefits-list {
    list-style: none;
    padding: 0;
    margin: 15px 0 0;
}

.benefits-list li {
    padding: 8px 0;
    padding-left: 0;
    color: #555;
    font-size: 15px;
    list-style: none;
}

/* Tiers Overview */
.tiers-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-top: 15px;
}

.tier-item {
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    padding: 15px;
    text-align: center;
    transition: all 0.3s;
}

.tier-item.current {
    border-color: #3498db;
    background: #f0f8ff;
}

.tier-item.locked {
    opacity: 0.6;
}

.tier-item .tier-icon {
    font-size: 48px;
    margin-bottom: 10px;
}

.tier-item h4 {
    margin: 10px 0 5px;
    color: #2c3e50;
}

.tier-item .tier-threshold,
.tier-item .tier-cashback {
    font-size: 13px;
    color: #666;
    margin: 3px 0;
}

/* Actions */
.loyalty-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 20px;
}

.loyalty-actions .button {
    flex: 1;
    min-width: 200px;
    text-align: center;
}

/* Missions */
.wc-loyalty-missions {
    max-width: 1200px;
    margin: 0 auto;
}

.missions-intro {
    font-size: 16px;
    color: #666;
    margin-bottom: 25px;
}

.missions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.mission-card {
    background: #fff;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    transition: all 0.3s;
}

.mission-card:hover {
    border-color: #3498db;
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.2);
}

.mission-card.completed {
    border-color: #27ae60;
    border-width: 3px;
    background: #f0fff4;
    box-shadow: 0 2px 8px rgba(39, 174, 96, 0.2);
}

.mission-card.completed:not(.claimed) {
    border-color: #27ae60;
    background: #e8f8f0;
    box-shadow: 0 4px 12px rgba(39, 174, 96, 0.3);
}

.mission-card.claimed {
    opacity: 0.85;
    border-color: #27ae60;
    background: #f0fff4;
}

.mission-icon {
    font-size: 48px;
    text-align: center;
    margin-bottom: 15px;
}

.mission-content h3 {
    margin: 0 0 10px;
    color: #2c3e50;
    font-size: 18px;
}

.mission-description {
    color: #666;
    font-size: 14px;
    margin-bottom: 15px;
    flex-grow: 1;
}

.mission-reward {
    background: #f8f9fa;
    padding: 10px;
    border-radius: 6px;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.reward-label {
    font-size: 13px;
    color: #666;
}

.reward-amount {
    font-size: 18px;
    font-weight: bold;
    color: #27ae60;
}

.mission-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    margin-top: 5px;
}

.mission-badge.repeatable {
    background: #e3f2fd;
    color: #1976d2;
}

.mission-expires {
    font-size: 12px;
    color: #999;
    margin-top: 5px;
}

.mission-action {
    margin-top: 15px;
}

.status-badge {
    display: inline-block;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
}

.status-badge.claimed {
    background: #d4edda;
    color: #155724;
}

.status-badge.completed {
    background: #cce5ff;
    color: #004085;
}

.status-badge.pending {
    background: #fff3cd;
    color: #856404;
}

.no-missions {
    text-align: center;
    padding: 40px;
    color: #999;
}

/* Transaction History */
.wc-loyalty-history {
    max-width: 1000px;
    margin: 0 auto;
}

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

.wc-loyalty-transactions-table thead {
    background: #f8f9fa;
}

.wc-loyalty-transactions-table th,
.wc-loyalty-transactions-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #e0e0e0;
}

.wc-loyalty-transactions-table th {
    font-weight: 600;
    color: #2c3e50;
}

.transaction-type {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
}

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

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

.type-adjusted {
    background: #fff3cd;
    color: #856404;
}

.amount-earned {
    color: #27ae60;
    font-weight: 600;
}

.amount-spent {
    color: #e74c3c;
    font-weight: 600;
}

.no-transactions {
    text-align: center;
    padding: 40px;
    background: #fff;
    border-radius: 8px;
    color: #999;
}

/* History Controls */
.wc-loyalty-history-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
}

.history-info {
    color: #666;
    font-size: 14px;
    font-weight: 500;
}

.per-page-selector {
    display: flex;
    align-items: center;
    gap: 10px;
}

.per-page-label {
    margin: 0;
    font-size: 14px;
    font-weight: 500;
    color: #333;
    white-space: nowrap;
}

.per-page-select {
    padding: 8px 12px;
    padding-right: 35px;
    font-size: 14px;
    line-height: 1.5;
    color: #333;
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23333' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 12px;
    min-width: 80px;
}

.per-page-select:hover {
    border-color: #0073aa;
    box-shadow: 0 0 0 1px #0073aa;
}

.per-page-select:focus {
    outline: none;
    border-color: #0073aa;
    box-shadow: 0 0 0 2px rgba(0, 115, 170, 0.2);
}

.per-page-select option {
    padding: 8px;
    background: #fff;
}

.wc-loyalty-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin-top: 20px;
}

.page-number {
    font-weight: 600;
    color: #666;
}

/* Responsive */
@media (max-width: 768px) {
    .balance-card, .tier-card, .help-card {
        flex-direction: column;
        text-align: center;
    }
    
    .help-card {
        text-align: left;
    }
    
    .help-button {
        width: 100%;
        text-align: center;
    }

    .tiers-grid {
        grid-template-columns: 1fr;
    }

    .missions-grid {
        grid-template-columns: 1fr;
    }

    .loyalty-actions {
        flex-direction: column;
    }

    .loyalty-actions .button {
        width: 100%;
    }

    .wc-loyalty-transactions-table {
        font-size: 14px;
    }

    .wc-loyalty-transactions-table th,
    .wc-loyalty-transactions-table td {
        padding: 8px 10px;
    }

    .wc-loyalty-history-controls {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .per-page-selector {
        width: 100%;
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .per-page-select {
        width: 100%;
        max-width: 200px;
    }
}

/* Cashback Toggle */
.wc-loyalty-cashback-toggle-row {
    border-top: 1px solid #e0e0e0;
}

.wc-loyalty-cashback-toggle-cell {
    padding: 20px 0 !important;
}

.wc-loyalty-cashback-toggle {
    background: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px;
    margin-top: 15px;
}

.cashback-toggle-header {
    margin-bottom: 20px;
}

.cashback-toggle-title {
    margin: 0 0 15px;
    font-size: 18px;
    font-weight: 600;
    color: #2c3e50;
}

.cashback-balance-info {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px;
    background: #fff;
    border-radius: 4px;
    border-left: 3px solid #0073aa;
}

.balance-label {
    font-weight: 500;
    color: #555;
}

.balance-amount {
    font-weight: 600;
    font-size: 16px;
    color: #27ae60;
}

.cashback-toggle-control {
    margin-bottom: 15px;
}

.cashback-toggle-switch {
    display: flex;
    align-items: center;
    gap: 15px;
    cursor: pointer;
    user-select: none;
}

.cashback-toggle-input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 28px;
    background-color: #ccc;
    border-radius: 28px;
    transition: background-color 0.3s;
    flex-shrink: 0;
}

.toggle-slider:before {
    content: "";
    position: absolute;
    height: 22px;
    width: 22px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    border-radius: 50%;
    transition: transform 0.3s;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.cashback-toggle-input:checked + .toggle-slider {
    background-color: #27ae60;
}

.cashback-toggle-input:checked + .toggle-slider:before {
    transform: translateX(22px);
}

.cashback-toggle-input:focus + .toggle-slider {
    box-shadow: 0 0 0 3px rgba(39, 174, 96, 0.2);
}

.toggle-label {
    font-weight: 500;
    color: #333;
    font-size: 16px;
    flex: 1;
}

.cashback-applied-info {
    margin-top: 15px;
    padding: 12px;
    background: #e8f5e9;
    border-radius: 4px;
    border-left: 3px solid #27ae60;
}

.applied-amount {
    margin: 0;
    font-weight: 600;
    color: #2e7d32;
    font-size: 15px;
}

.cashback-note {
    margin: 15px 0 0;
    font-size: 13px;
    color: #666;
    font-style: italic;
}

/* Responsive adjustments for toggle */
@media (max-width: 768px) {
    .wc-loyalty-cashback-toggle {
        padding: 15px;
    }
    
    .cashback-toggle-switch {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .toggle-slider {
        align-self: flex-start;
    }
}

