/**
 * Estilos CSS para ProteinFood Points System
 * Frontend Styles
 */

/* === VARIABLES CSS === */
:root {
    --pf-primary: #667eea;
    --pf-secondary: #764ba2;
    --pf-success: #4caf50;
    --pf-warning: #ff9800;
    --pf-danger: #f44336;
    --pf-light: #f8f9fa;
    --pf-dark: #343a40;
    --pf-border: #dee2e6;
    --pf-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --pf-shadow-lg: 0 10px 25px rgba(102, 126, 234, 0.3);
    --pf-radius: 8px;
    --pf-radius-lg: 15px;
}

/* === COMPONENTES GENERALES === */
.pf-points-widget,
.pf-points-card {
    background: linear-gradient(135deg, var(--pf-primary) 0%, var(--pf-secondary) 100%);
    color: white;
    padding: 1.5rem;
    border-radius: var(--pf-radius-lg);
    box-shadow: var(--pf-shadow-lg);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.pf-points-balance {
    font-weight: bold;
    color: var(--pf-primary);
    font-size: 1.1em;
}

/* === HEADER WIDGET === */
.pf-points-header-widget {
    position: fixed;
    top: 20px;
    right: 20px;
    background: linear-gradient(135deg, var(--pf-primary) 0%, var(--pf-secondary) 100%);
    color: white;
    padding: 0.8rem 1.2rem;
    border-radius: 25px;
    font-size: 0.9rem;
    font-weight: bold;
    z-index: 9999;
    box-shadow: var(--pf-shadow-lg);
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
}

.pf-points-header-widget:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.5);
    color: white;
    text-decoration: none;
}

.pf-points-header-widget .points-icon {
    margin-right: 0.5rem;
}

/* === DASHBOARD DE CUENTA === */
.pf-points-dashboard {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.pf-points-balance-card {
    background: linear-gradient(135deg, var(--pf-primary) 0%, var(--pf-secondary) 100%);
    color: white;
    padding: 2rem;
    border-radius: var(--pf-radius-lg);
    margin-bottom: 2rem;
    box-shadow: var(--pf-shadow-lg);
}

.pf-points-balance-card h2 {
    margin: 0 0 1rem 0;
    font-size: 1.5rem;
    color: white;
}

.current-balance {
    text-align: center;
    margin: 1.5rem 0;
}

.balance-number {
    display: block;
    font-size: 3.5rem;
    font-weight: bold;
    line-height: 1;
}

.balance-label {
    font-size: 1rem;
    opacity: 0.9;
}

.balance-value {
    text-align: center;
    font-size: 1.2rem;
    margin-bottom: 2rem;
}

/* === OPCIONES DE CANJE === */
.redemption-options h3 {
    margin: 2rem 0 1rem 0;
    font-size: 1.3rem;
    color: white;
}

.redemption-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.redemption-card {
    background: rgba(255, 255, 255, 0.1);
    padding: 1.5rem;
    border-radius: var(--pf-radius);
    text-align: center;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: all 0.3s ease;
}

.redemption-card:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
}

.redemption-card.unavailable {
    opacity: 0.6;
}

.redemption-points {
    font-size: 1.2rem;
    font-weight: bold;
    margin-bottom: 0.5rem;
}

.redemption-value {
    font-size: 2rem;
    font-weight: bold;
    color: #ffeb3b;
    margin-bottom: 0.5rem;
}

.redemption-desc {
    font-size: 0.9rem;
    margin-bottom: 1rem;
    opacity: 0.9;
}

/* === BOTONES === */
.pf-redeem-btn,
.pf-points-btn {
    background: var(--pf-success);
    color: white;
    border: none;
    padding: 0.8rem 1.5rem;
    border-radius: 25px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.pf-redeem-btn:hover,
.pf-points-btn:hover {
    background: #45a049;
    transform: translateY(-2px);
    color: white;
    text-decoration: none;
}

.pf-redeem-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.points-needed {
    color: #ffcdd2;
    font-size: 0.9rem;
}

/* === PRÓXIMA META === */
.next-goal {
    background: rgba(255, 255, 255, 0.1);
    padding: 1.5rem;
    border-radius: var(--pf-radius);
    margin-top: 2rem;
}

.next-goal h4 {
    color: white;
    margin: 0 0 1rem 0;
}

.progress-bar {
    background: rgba(255, 255, 255, 0.3);
    height: 8px;
    border-radius: 4px;
    overflow: hidden;
    margin-top: 1rem;
}

.progress-fill {
    background: var(--pf-success);
    height: 100%;
    transition: width 0.3s ease;
}

/* === ESTADÍSTICAS === */
.pf-points-stats {
    background: white;
    padding: 2rem;
    border-radius: var(--pf-radius);
    margin-bottom: 2rem;
    box-shadow: var(--pf-shadow);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 2rem;
    text-align: center;
}

.stat-item {
    padding: 1rem;
}

.stat-number {
    font-size: 2.5rem;
    font-weight: bold;
    color: var(--pf-primary);
    display: block;
}

.stat-label {
    color: #666;
    font-size: 0.9rem;
    margin-top: 0.5rem;
}

/* === CUPONES === */
.pf-points-coupons {
    background: white;
    padding: 2rem;
    border-radius: var(--pf-radius);
    margin-bottom: 2rem;
    box-shadow: var(--pf-shadow);
}

.pf-points-coupons h3 {
    color: var(--pf-dark);
    margin: 0 0 1.5rem 0;
}

.coupons-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1rem;
}

.coupon-card {
    border: 2px dashed var(--pf-border);
    padding: 1.5rem;
    border-radius: var(--pf-radius);
    text-align: center;
    transition: all 0.3s ease;
}

.coupon-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--pf-shadow);
}

.coupon-card.generated {
    border-color: var(--pf-success);
    background: #f1f8e9;
}

.coupon-card.used {
    border-color: #999;
    background: #f5f5f5;
    opacity: 0.8;
}

.coupon-card.expired {
    border-color: var(--pf-danger);
    background: #ffebee;
    opacity: 0.8;
}

.coupon-code {
    font-family: 'Courier New', monospace;
    font-weight: bold;
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    padding: 0.5rem;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 4px;
    word-break: break-all;
}

.coupon-amount {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--pf-success);
    margin-bottom: 0.5rem;
}

.coupon-status {
    font-size: 0.9rem;
    margin: 0.5rem 0;
    font-weight: bold;
}

.coupon-expiry {
    font-size: 0.8rem;
    color: #666;
}

/* === HISTORIAL === */
.pf-points-history {
    background: white;
    padding: 2rem;
    border-radius: var(--pf-radius);
    margin-bottom: 2rem;
    box-shadow: var(--pf-shadow);
}

.pf-points-history h3 {
    color: var(--pf-dark);
    margin: 0 0 1.5rem 0;
}

.transactions-list {
    max-height: 400px;
    overflow-y: auto;
}

.transaction-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid var(--pf-border);
    transition: background-color 0.2s ease;
}

.transaction-item:hover {
    background-color: var(--pf-light);
}

.transaction-date {
    font-size: 0.9rem;
    color: #666;
    min-width: 100px;
}

.transaction-description {
    flex-grow: 1;
    margin: 0 1rem;
}

.transaction-details {
    font-size: 0.8rem;
    color: #999;
    margin-top: 0.25rem;
}

.transaction-points {
    font-weight: bold;
    min-width: 80px;
    text-align: right;
}

.transaction-points.positive {
    color: var(--pf-success);
}

.transaction-points.negative {
    color: var(--pf-danger);
}

.no-transactions {
    text-align: center;
    color: #999;
    font-style: italic;
    padding: 2rem;
}

.view-all-transactions {
    text-align: center;
    margin-top: 1rem;
}

.pf-view-all-transactions {
    color: var(--pf-primary);
    text-decoration: none;
    font-weight: bold;
}

.pf-view-all-transactions:hover {
    text-decoration: underline;
}

/* === CHECKOUT WIDGET === */
.pf-points-checkout-widget {
    background: var(--pf-light);
    border: 2px dashed var(--pf-primary);
    padding: 1.5rem;
    border-radius: var(--pf-radius);
    margin-bottom: 2rem;
    text-align: center;
}

.pf-points-checkout-widget h3 {
    color: var(--pf-primary);
    margin: 0 0 1rem 0;
}

.points-redemption-list {
    text-align: left;
    margin: 1rem 0;
    padding-left: 2rem;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

.points-redemption-list li {
    margin: 0.5rem 0;
}

/* === THANK YOU MESSAGE === */
.pf-points-thank-you-message {
    background: linear-gradient(135deg, var(--pf-primary) 0%, var(--pf-secondary) 100%);
    color: white;
    padding: 2rem;
    border-radius: var(--pf-radius-lg);
    text-align: center;
    margin: 2rem 0;
}

.pf-points-thank-you-message h3 {
    color: white;
    margin: 0 0 1rem 0;
}

.points-earned {
    margin: 1rem 0;
}

.points-number {
    display: block;
    font-size: 3rem;
    font-weight: bold;
    line-height: 1;
}

.points-label {
    font-size: 1.1rem;
}

.bonus-message {
    background: rgba(255, 255, 255, 0.2);
    padding: 1rem;
    border-radius: var(--pf-radius);
    margin: 1rem 0;
}

/* === SHORTCODES === */
.pf-points-widget {
    max-width: 300px;
    margin: 1rem auto;
}

.widget-header h4 {
    margin: 0 0 0.5rem 0;
    color: white;
}

.widget-content p {
    margin: 0.5rem 0;
}

.view-points-btn {
    background: white;
    color: var(--pf-primary);
    padding: 0.8rem 1.5rem;
    border-radius: 25px;
    text-decoration: none;
    font-weight: bold;
    display: inline-block;
    margin-top: 1rem;
    transition: all 0.3s ease;
}

.view-points-btn:hover {
    background: #f0f0f0;
    transform: translateY(-2px);
    text-decoration: none;
    color: var(--pf-primary);
}

/* === RESPONSIVE DESIGN === */
@media (max-width: 768px) {
    .pf-points-header-widget {
        top: 10px;
        right: 10px;
        font-size: 0.8rem;
        padding: 0.6rem 1rem;
    }
    
    .redemption-grid {
        grid-template-columns: 1fr;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .coupons-grid {
        grid-template-columns: 1fr;
    }
    
    .transaction-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
        text-align: left;
    }
    
    .transaction-date,
    .transaction-points {
        min-width: auto;
    }
    
    .current-balance .balance-number {
        font-size: 2.5rem;
    }
    
    .pf-points-balance-card {
        padding: 1.5rem;
    }
    
    .points-earned .points-number {
        font-size: 2rem;
    }
}

@media (max-width: 480px) {
    .pf-points-stats,
    .pf-points-coupons,
    .pf-points-history,
    .pf-points-balance-card {
        margin-left: -1rem;
        margin-right: -1rem;
        border-radius: 0;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .redemption-card {
        padding: 1rem;
    }
    
    .redemption-value {
        font-size: 1.5rem;
    }
}

/* === LOADING STATES === */
.pf-loading {
    opacity: 0.6;
    pointer-events: none;
}

.pf-loading::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    border: 2px solid #ccc;
    border-top-color: var(--pf-primary);
    border-radius: 50%;
    animation: pf-spin 1s linear infinite;
    transform: translate(-50%, -50%);
}

@keyframes pf-spin {
    to {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

/* === ANIMATION UTILITIES === */
.pf-fade-in {
    animation: pf-fadeIn 0.3s ease-in;
}

@keyframes pf-fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.pf-scale-in {
    animation: pf-scaleIn 0.2s ease-out;
}

@keyframes pf-scaleIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* === ACCESSIBILITY === */
.pf-redeem-btn:focus,
.pf-points-btn:focus,
.view-points-btn:focus {
    outline: 2px solid var(--pf-warning);
    outline-offset: 2px;
}

.transaction-item:focus-within {
    background-color: var(--pf-light);
    outline: 1px solid var(--pf-primary);
}

/* === PRINT STYLES === */
@media print {
    .pf-points-header-widget {
        display: none;
    }
    
    .pf-points-dashboard {
        color: black !important;
    }
    
    .pf-points-balance-card,
    .pf-points-widget {
        background: white !important;
        color: black !important;
        border: 1px solid #ccc !important;
    }
}
