/* Rewards Page Styles - MOAI Game */
:root {
    --primary-blue: #005580;
    --secondary-blue: #003366;
    --dark-blue: #002244;
    --accent-blue: #29ABE2;
    --light-blue: #1D8CB8;
    --card-bg: rgba(0, 40, 80, 0.9);
    --card-secondary: rgba(0, 51, 102, 0.6);
    --border-color: rgba(255, 255, 255, 0.1);
    --text-muted: rgba(255, 255, 255, 0.7);
    --success-color: #00ff88;
    --warning-color: #ffa500;
}

* {
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    margin: 0;
    padding: 0;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--primary-blue) 0%, var(--secondary-blue) 60%, var(--dark-blue) 100%);
    color: white;
    overflow-x: hidden;
}

.rewards-container {
    min-height: 100vh;
    position: relative;
}

/* Back Button */
.back-button-container {
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 1050;
}

.back-button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--card-bg);
    color: white;
    text-decoration: none;
    border: 1px solid var(--border-color);
    backdrop-filter: blur(10px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.back-button:hover {
    background: var(--accent-blue);
    transform: scale(1.1);
    color: white;
    box-shadow: 0 6px 25px rgba(41, 171, 226, 0.4);
}

.back-icon {
    font-size: 24px;
}

/* Main Container */
.container-moai {
    padding-top: 80px;
    max-width: 1200px;
}

/* Header */
.page-header {
    margin-bottom: 2rem;
}

.title-container {
    position: relative;
}

.page-title {
    font-size: 2.5rem;
    font-weight: 700;
    margin: 0;
    background: linear-gradient(135deg, #ffffff, var(--accent-blue));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    display: flex;
    align-items: center;
}

.title-underline {
    width: 80px;
    height: 3px;
    background: linear-gradient(90deg, var(--accent-blue), var(--light-blue));
    border-radius: 2px;
    margin-top: 0.5rem;
}

/* History Button */
.history-button {
    background: linear-gradient(135deg, #3498db, #2980b9);
    border: none;
    color: white;
    padding: 12px 20px;
    border-radius: 12px;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(52, 152, 219, 0.3);
    display: flex;
    align-items: center;
}

.history-button:hover {
    background: linear-gradient(135deg, #2980b9, #216a9a);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(52, 152, 219, 0.4);
    color: white;
}

/* Currency Section */
.currency-section {
    margin-bottom: 2rem;
}

.currency-card {
    background: var(--card-secondary);
    border-radius: 16px;
    border: 1px solid var(--border-color);
    padding: 1.5rem;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    height: 100%;
}

.currency-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--accent-blue), transparent);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.currency-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.3);
    border-color: rgba(41, 171, 226, 0.3);
}

.currency-card:hover::before {
    opacity: 1;
}

.currency-content {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.currency-icon-container {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    flex-shrink: 0;
}

.currency-icon {
    width: 40px;
    height: 40px;
    object-fit: contain;
}

.currency-info {
    flex: 1;
}

.currency-value {
    font-size: 2rem;
    font-weight: 700;
    color: white;
    line-height: 1.2;
    margin-bottom: 0.25rem;
}

.currency-label {
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.currency-trend {
    font-size: 1.5rem;
    color: var(--success-color);
}

/* Rewards Section */
.rewards-section {
    margin-bottom: 2rem;
}

.section-header {
    text-align: center;
    margin-bottom: 2rem;
}

.section-title {
    font-size: 1.8rem;
    font-weight: 600;
    color: var(--accent-blue);
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.section-subtitle {
    color: var(--text-muted);
    font-size: 1.1rem;
    margin: 0;
}

/* Reward Cards */
.rewards-grid {
    margin-bottom: 2rem;
}

.reward-card {
    background: var(--card-secondary);
    border-radius: 20px;
    border: 1px solid var(--border-color);
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    position: relative;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.reward-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--accent-blue), var(--light-blue));
    opacity: 0;
    transition: opacity 0.3s ease;
}

.reward-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.4);
    border-color: rgba(41, 171, 226, 0.3);
}

.reward-card:hover::before {
    opacity: 1;
}

.card-header {
    position: relative;
    padding: 1rem 1rem 0;
}

.item-badge {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: linear-gradient(135deg, #FFD700, #FFA500);
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    box-shadow: 0 2px 8px rgba(255, 215, 0, 0.3);
}

.item-image-container {
    position: relative;
    padding: 1rem;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 120px;
}

.item-image {
    width: 80px;
    height: 80px;
    object-fit: contain;
    border-radius: 12px;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.05);
    padding: 8px;
}

.image-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(41, 171, 226, 0.9);
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: all 0.3s ease;
    font-size: 18px;
}

.reward-card:hover .image-overlay {
    opacity: 1;
}

.reward-card:hover .item-image {
    transform: scale(1.1);
    filter: brightness(0.8);
}

.card-content {
    padding: 0 1rem 1rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.item-name {
    font-size: 1rem;
    font-weight: 600;
    color: white;
    text-align: center;
    margin-bottom: 1rem;
    line-height: 1.3;
    min-height: 2.6rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.price-container {
    display: flex;
    justify-content: center;
    margin-bottom: 1rem;
}

.price-badge {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 20px;
    padding: 8px 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    border: 1px solid var(--border-color);
}

.price-icon {
    width: 24px;
    height: 24px;
    object-fit: contain;
}

.price-value {
    font-size: 1.1rem;
    font-weight: 700;
    color: white;
}

.btn-buy {
    background: linear-gradient(135deg, var(--accent-blue), var(--light-blue));
    border: none;
    color: white;
    font-weight: 600;
    padding: 12px 16px;
    border-radius: 12px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(41, 171, 226, 0.3);
    margin-top: auto;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 0.9rem;
}

.btn-buy:hover:not(:disabled) {
    background: linear-gradient(135deg, var(--light-blue), #156a8a);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(41, 171, 226, 0.4);
    color: white;
}

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

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(4px);
    z-index: 1050;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow-y: auto;
    padding: 20px 10px 90px; /* Added padding at the bottom to prevent navbar overlap */
}

.item-modal,
.history-modal {
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
    border-radius: 16px;
    width: 90%;
    max-width: 500px;
    position: relative;
    margin: auto;
    color: white;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    max-height: calc(100vh - 100px);
    display: flex;
    flex-direction: column;
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: white;
    margin: 0;
    display: flex;
    align-items: center;
}

.btn-close {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 16px;
}

.btn-close:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

.modal-body {
    overflow-y: auto;
    flex: 1;
    padding: 15px;
}

/* Item Showcase */
.item-showcase {
    text-align: center;
    margin-bottom: 2rem;
}

.item-image-large {
    width: 150px;
    height: 150px;
    margin: 0 auto;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--border-color);
    overflow: hidden;
}

.showcase-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 15px;
}

/* Item Details */
.item-details {
    space-y: 1.5rem;
}

.detail-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--accent-blue);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5rem;
}

.description-section,
.requirements-section,
.availability-section {
    background: rgba(0, 20, 40, 0.4);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    border: 1px solid var(--border-color);
}

.item-description {
    color: var(--text-muted);
    line-height: 1.6;
    margin: 0;
}

.requirements-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.requirement-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: rgba(255, 255, 255, 0.05);
    padding: 1rem;
    border-radius: 10px;
}

.req-icon-container {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.req-icon {
    width: 24px;
    height: 24px;
    object-fit: contain;
}

.level-req {
    background: linear-gradient(135deg, #9370DB, #7B68EE);
    color: white;
    font-size: 18px;
}

.req-details {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.req-amount {
    font-size: 1.2rem;
    font-weight: 700;
    color: white;
    background: rgba(0, 0, 0, 0.3);
    padding: 4px 12px;
    border-radius: 20px;
}

.req-currency {
    color: var(--text-muted);
    font-weight: 500;
}

.req-level {
    font-size: 1.2rem;
    font-weight: 700;
    color: #FFD700;
}

/* Availability */
.availability-info {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.availability-count {
    font-size: 1.1rem;
    font-weight: 600;
    color: white;
}

.availability-bar {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
}

.availability-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--success-color), #00cc66);
    border-radius: 4px;
    transition: width 0.3s ease;
}

.availability-unlimited {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: var(--accent-blue);
}

.modal-footer {
    padding: 1.5rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: center;
}

.btn-buy-large {
    background: linear-gradient(135deg, var(--accent-blue), var(--light-blue));
    border: none;
    color: white;
    font-weight: 600;
    padding: 15px 40px;
    border-radius: 12px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(41, 171, 226, 0.3);
    font-size: 1.1rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-buy-large:hover:not(:disabled) {
    background: linear-gradient(135deg, var(--light-blue), #156a8a);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(41, 171, 226, 0.4);
    color: white;
}

.btn-buy-large:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* History Modal Specific Styles */
.loading-state,
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
}

.loading-text {
    margin-top: 1rem;
    color: var(--text-muted);
}

.empty-icon {
    font-size: 4rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.empty-title {
    color: white;
    margin-bottom: 0.5rem;
}

.empty-text {
    color: var(--text-muted);
    margin: 0;
}

.purchases-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.purchase-item {
    background: rgba(0, 20, 40, 0.4);
    border-radius: 12px;
    padding: 1.5rem;
    border: 1px solid var(--border-color);
}

.purchase-header {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
}

.purchase-image {
    flex-shrink: 0;
}

.purchase-thumbnail {
    width: 60px;
    height: 60px;
    object-fit: contain;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
    padding: 5px;
}

.purchase-info {
    flex: 1;
}

.purchase-name {
    font-size: 1.1rem;
    font-weight: 600;
    color: white;
    margin-bottom: 0.5rem;
}

.purchase-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.purchase-date {
    color: var(--text-muted);
    font-size: 0.9rem;
    display: flex;
    align-items: center;
}

.purchase-status {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.status-delivered {
    background: rgba(0, 255, 136, 0.2);
    color: var(--success-color);
    border: 1px solid rgba(0, 255, 136, 0.3);
}

.status-pending {
    background: rgba(255, 165, 0, 0.2);
    color: var(--warning-color);
    border: 1px solid rgba(255, 165, 0, 0.3);
}

.purchase-cost {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    padding: 1rem;
}

.cost-title {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.cost-items {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.cost-badge {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(0, 0, 0, 0.3);
    padding: 6px 12px;
    border-radius: 20px;
    border: 1px solid var(--border-color);
}

.cost-icon {
    width: 20px;
    height: 20px;
    object-fit: contain;
}

.cost-amount {
    font-weight: 600;
    color: white;
}

.cost-currency {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--border-color);
    color: white;
    font-weight: 600;
    padding: 12px 24px;
    border-radius: 12px;
    transition: all 0.3s ease;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

/* Animation Classes */
.fade-in {
    animation: fadeIn 0.6s ease-out;
}

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

.slide-up {
    animation: slideUp 0.8s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(40px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .container-moai {
        padding-top: 60px;
    }

    .page-title {
        font-size: 2rem;
    }

    .back-button {
        width: 45px;
        height: 45px;
    }

    .back-icon {
        font-size: 20px;
    }

    .currency-value {
        font-size: 1.5rem;
    }

    .currency-icon-container {
        width: 50px;
        height: 50px;
    }

    .currency-icon {
        width: 32px;
        height: 32px;
    }

    .history-button {
        padding: 10px 16px;
        font-size: 0.9rem;
    }

    .history-text {
        display: none;
    }

    .item-image {
        width: 60px;
        height: 60px;
    }

    .item-name {
        font-size: 0.9rem;
        min-height: 2.4rem;
    }

    .btn-buy {
        padding: 10px 12px;
        font-size: 0.8rem;
    }

    .item-modal,
    .history-modal {
        margin: 10px;
        max-height: 95vh;
    }

    .modal-header,
    .modal-body,
    .modal-footer {
        padding: 1rem;
    }

    .item-image-large {
        width: 120px;
        height: 120px;
    }

    .purchase-header {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .purchase-meta {
        justify-content: center;
    }

    /* Mobile-specific centering for rewards grid */
    .rewards-grid {
        justify-content: center !important;
        align-items: center;
        display: flex !important;
        flex-wrap: wrap;
        gap: 1rem;
    }

    .rewards-grid .col {
        flex: 0 0 auto;
        width: calc(50% - 0.5rem);
        max-width: 180px;
        margin: 0;
        padding: 0;
    }

    /* Ensure reward cards are centered within their containers */
    .reward-card {
        margin: 0 auto;
        max-width: 100%;
        width: 100%;
    }

    /* Center the entire rewards section */
    .rewards-section {
        text-align: center;
    }

    .rewards-section .section-header {
        text-align: center;
        margin-bottom: 2rem;
    }
}

@media (max-width: 576px) {
    .back-button-container {
        top: 15px;
        left: 15px;
    }

    .page-header .d-flex {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }

    .page-title {
        font-size: 1.75rem;
        text-align: center;
    }

    .title-underline {
        margin: 0.5rem auto 0;
    }

    .history-button {
        align-self: center;
    }

    .section-title {
        font-size: 1.5rem;
        flex-direction: column;
        gap: 0.5rem;
    }

    .currency-content {
        flex-direction: column;
        text-align: center;
        gap: 0.75rem;
    }

    .item-image-container {
        min-height: 100px;
    }

    .item-image {
        width: 50px;
        height: 50px;
    }

    .requirements-list {
        gap: 0.75rem;
    }

    .requirement-item {
        padding: 0.75rem;
    }

    .cost-items {
        justify-content: center;
    }
}

/* For very small screens, consider single column */
@media (max-width: 480px) {
    .rewards-grid .col {
        width: calc(100% - 2rem);
        max-width: 280px;
    }
}

/* Loading Spinner */
.spinner-border {
    width: 1rem;
    height: 1rem;
    border-width: 2px;
}
