/* Wheel Selection Styles */
.wheel-selection {
    margin-bottom: 30px;
}

.wheels-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.wheel-card {
    background-color: rgba(27, 40, 56, 0.8);
    border: 1px solid var(--secondary-color);
    border-radius: 8px;
    padding: 20px;
    transition: transform 0.3s, box-shadow 0.3s;
}

.wheel-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(102, 192, 244, 0.3);
}

.wheel-card h4 {
    color: var(--secondary-color);
    margin-bottom: 10px;
}

.wheel-card p {
    margin-bottom: 10px;
}

.wheel-cost {
    color: #66ff66;
    font-weight: bold;
}

.wheel-status {
    font-size: 0.9em;
}

.wheel-card button {
    width: 100%;
    margin-top: 10px;
}

#active-wheel-game {
    animation: fadeIn 0.5s ease-in;
}

#active-wheel-name {
    color: var(--secondary-color);
    text-align: center;
    margin-bottom: 20px;
    font-size: 1.5em;
}

.btn-secondary {
    background-color: #4a5568;
    color: white;
}

.btn-secondary:hover {
    background-color: #5a6578;
}

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

/* Global Styles */
:root {
    --primary-color: #171a21;
    --secondary-color: #66c0f4;
    --accent-color: #1b2838;
    --text-color: #c7d5e0;
    --background-color: #2a475e;
    --card-background: #1b2838;
    --success-color: #66c0f4;
    --error-color: #ff3333;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    line-height: 1.6;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
}

/* Header Styles */
header {
    text-align: center;
    margin-bottom: 30px;
    padding: 20px;
    background-color: var(--primary-color);
    border-radius: 8px;
}

header h1 {
    color: var(--secondary-color);
    margin-bottom: 10px;
}

/* Card Styles */
.card {
    background-color: var(--card-background);
    border-radius: 8px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.card h2 {
    color: var(--secondary-color);
    margin-bottom: 20px;
    text-align: center;
}

/* Button Styles */
.btn, .steam-btn {
    display: inline-block;
    padding: 12px 24px;
    background-color: var(--secondary-color);
    color: var(--primary-color);
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    margin: 10px 5px;
    text-decoration: none;
    text-align: center;
    transition: all 0.3s ease;
}

/* Admin Button */
.btn-admin {
    background-color: #9b59b6 !important;
    color: white !important;
}

.btn-admin:hover {
    background-color: #8e44ad !important;
    transform: translateY(-2px);
}

.btn:hover, .steam-btn:hover {
    background-color: #7fd6ff;
}

.steam-btn {
    background-color: transparent;
    padding: 0;
}

.steam-btn img {
    display: block;
    margin: 0 auto;
}

/* Profile Section Styles */
.profile-info {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
}

.avatar {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    margin-right: 20px;
    border: 3px solid var(--secondary-color);
}

.user-details {
    flex: 1;
}

.user-details p {
    margin-bottom: 10px;
}

.user-details a {
    color: var(--secondary-color);
    text-decoration: none;
}

.user-details a:hover {
    text-decoration: underline;
}

.token-info {
    margin-top: 20px;
}

.token-info h3 {
    margin-bottom: 10px;
    color: var(--secondary-color);
}

textarea {
    width: 100%;
    height: 80px;
    background-color: var(--primary-color);
    color: var(--text-color);
    border: 1px solid var(--secondary-color);
    border-radius: 4px;
    padding: 10px;
    font-family: monospace;
    resize: none;
}

/* Footer Styles */
footer {
    text-align: center;
    margin-top: 30px;
    padding: 20px;
    background-color: var(--primary-color);
    border-radius: 8px;
    font-size: 14px;
}

/* Navigation */
.navigation {
    display: flex;
    justify-content: space-between;
    margin-top: 20px;
}

.navigation .btn {
    margin: 0;
    width: 48%;
}

/* Wheel Game Styles */
.game-info {
    background-color: var(--primary-color);
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.wheel-container {
    position: relative;
    width: 300px;
    height: 300px;
    margin: 30px auto;
}

.wheel {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background-color: var(--primary-color);
    position: relative;
    overflow: hidden;
    transition: transform 3s cubic-bezier(0.17, 0.67, 0.83, 0.67);
    box-shadow: 0 0 0 8px var(--secondary-color), 0 0 0 15px var(--primary-color);
}

.wheel-segment {
    position: absolute;
    width: 50%;
    height: 50%;
    transform-origin: bottom right;
    clip-path: polygon(0 0, 100% 0, 0 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
}

.wheel-arrow {
    position: absolute;
    top: -20px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 20px solid transparent;
    border-right: 20px solid transparent;
    border-top: 40px solid var(--secondary-color);
    z-index: 10;
}

.wheel-controls {
    text-align: center;
    margin: 20px 0;
}

.wheel-controls label {
    display: block;
    margin-top: 10px;
    color: var(--text-color);
}

.spin-result {
    background-color: var(--primary-color);
    padding: 20px;
    border-radius: 8px;
    text-align: center;
    margin: 20px 0;
    border: 2px solid var(--secondary-color);
}

.spin-result h3 {
    color: var(--secondary-color);
    margin-bottom: 10px;
}

.reward-image {
    max-width: 100px;
    max-height: 100px;
    margin: 10px auto;
    display: block;
    border-radius: 8px;
}

.spin-history {
    margin-top: 30px;
}

.spin-history h3 {
    color: var(--secondary-color);
    margin-bottom: 15px;
}

.history-container {
    max-height: 200px;
    overflow-y: auto;
    background-color: var(--primary-color);
    border-radius: 8px;
    padding: 10px;
}

.history-item {
    padding: 10px;
    border-bottom: 1px solid var(--accent-color);
    display: flex;
    align-items: center;
}

.history-item:last-child {
    border-bottom: none;
}

.history-item img {
    width: 40px;
    height: 40px;
    margin-right: 10px;
    border-radius: 4px;
}

.history-item-details {
    flex: 1;
}

.history-item-time {
    font-size: 12px;
    color: #999;
}

/* Spinning Animation */
@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.spinning {
    animation: spin 3s cubic-bezier(0.17, 0.67, 0.83, 0.67);
}

/* Utility Classes */
.hidden {
    display: none;
}

.error {
    color: var(--error-color);
    text-align: center;
    margin: 10px 0;
}

.success {
    color: var(--success-color);
    text-align: center;
    margin: 10px 0;
}

/* ================================ */
/* BUYBACK SYSTEM STYLES */
/* ================================ */

/* Inventory Controls */
.inventory-controls {
    background-color: var(--primary-color);
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.inventory-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 15px;
}

.search-input, .filter-select, .date-input {
    padding: 10px;
    background-color: var(--card-background);
    color: var(--text-color);
    border: 1px solid var(--secondary-color);
    border-radius: 4px;
    font-size: 14px;
}

.search-input {
    flex: 1;
    min-width: 200px;
}

.filter-select, .date-input {
    min-width: 150px;
}

.inventory-info {
    display: flex;
    gap: 30px;
    color: var(--secondary-color);
    font-weight: bold;
}

/* Inventory Grid */
.inventory-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.inventory-item {
    background-color: var(--card-background);
    border: 1px solid var(--primary-color);
    border-radius: 8px;
    padding: 15px;
    transition: all 0.3s ease;
    position: relative;
}

.inventory-item:hover {
    border-color: var(--secondary-color);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 192, 244, 0.2);
}

.item-image-container {
    position: relative;
    text-align: center;
    margin-bottom: 15px;
}

.item-image {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 4px;
    background-color: var(--primary-color);
}

.item-rarity {
    position: absolute;
    top: 5px;
    right: 5px;
    background-color: var(--secondary-color);
    color: var(--primary-color);
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 10px;
    font-weight: bold;
    text-transform: uppercase;
}

.item-rarity.common { background-color: #b0c3d9; }
.item-rarity.uncommon { background-color: #5e98d9; }
.item-rarity.rare { background-color: #4b69ff; }
.item-rarity.mythical { background-color: #8847ff; }
.item-rarity.legendary { background-color: #d32ce6; }
.item-rarity.ancient { background-color: #eb4b4b; }
.item-rarity.immortal { background-color: #e4ae39; }

.item-details {
    text-align: center;
    margin-bottom: 15px;
}

.item-name {
    color: var(--text-color);
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: bold;
}

.item-value {
    color: var(--secondary-color);
    margin-bottom: 5px;
    font-weight: bold;
}

.buyback-price {
    color: #66ff66;
    font-weight: bold;
}

.not-eligible {
    color: #ff6666;
    font-style: italic;
}

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

.btn-sell {
    background-color: #28a745 !important;
    color: white !important;
    padding: 8px 16px;
    font-size: 14px;
}

.btn-sell:hover {
    background-color: #218838 !important;
}

.btn-sell:disabled {
    background-color: #6c757d !important;
    cursor: not-allowed;
}

.item-checkbox {
    position: absolute;
    top: 10px;
    left: 10px;
    width: 20px;
    height: 20px;
}

/* Buyback History Styles */
.buyback-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background-color: var(--primary-color);
    padding: 20px;
    border-radius: 8px;
    text-align: center;
    border: 1px solid var(--secondary-color);
}

.stat-card h3 {
    color: var(--secondary-color);
    margin-bottom: 10px;
    font-size: 16px;
}

.stat-card p {
    color: var(--text-color);
    font-size: 24px;
    font-weight: bold;
}

.history-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 30px;
    align-items: center;
}

.history-list {
    space-y: 15px;
}

.history-item {
    background-color: var(--card-background);
    border: 1px solid var(--primary-color);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 15px;
}

.history-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.history-item-header h4 {
    color: var(--text-color);
    margin: 0;
}

.transaction-status {
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: bold;
    text-transform: uppercase;
}

.transaction-status.COMPLETED {
    background-color: #28a745;
    color: white;
}

.transaction-status.PENDING {
    background-color: #ffc107;
    color: #212529;
}

.transaction-status.FAILED {
    background-color: #dc3545;
    color: white;
}

.history-item-details p {
    margin: 5px 0;
    color: var(--text-color);
}

.history-item-details strong {
    color: var(--secondary-color);
}

/* Modal Styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal.hidden {
    display: none !important;
}

.modal-content {
    background-color: var(--card-background);
    border-radius: 8px;
    padding: 30px;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    border: 1px solid var(--secondary-color);
}

.close-modal {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 24px;
    color: var(--text-color);
    cursor: pointer;
    background: none;
    border: none;
    padding: 0;
    line-height: 1;
}

.close-modal:hover {
    color: var(--secondary-color);
}

.item-preview {
    text-align: center;
    margin-bottom: 20px;
}

.item-preview img {
    width: 100px;
    height: 100px;
    border-radius: 8px;
    margin-bottom: 10px;
    background-color: var(--primary-color);
}

.item-preview h3 {
    color: var(--text-color);
    margin-bottom: 10px;
}

.price-details {
    background-color: var(--primary-color);
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.price-details p {
    margin: 10px 0;
    color: var(--text-color);
}

.price-details .highlight {
    color: #66ff66;
    font-size: 18px;
    font-weight: bold;
}

.modal-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.btn-primary {
    background-color: var(--secondary-color) !important;
    color: var(--primary-color) !important;
}

.btn-primary:hover {
    background-color: #7fd6ff !important;
}

/* Bulk Operations */
.bulk-details {
    background-color: var(--primary-color);
    padding: 15px;
    border-radius: 8px;
    margin: 15px 0;
}

.bulk-items-list {
    max-height: 200px;
    overflow-y: auto;
    background-color: var(--primary-color);
    padding: 15px;
    border-radius: 8px;
    margin: 15px 0;
}

.bulk-item {
    display: flex;
    justify-content: space-between;
    padding: 5px 0;
    border-bottom: 1px solid var(--card-background);
}

.bulk-item:last-child {
    border-bottom: none;
}

/* Transaction Result Modal */
.transaction-message {
    text-align: center;
    padding: 20px;
    border-radius: 8px;
    margin: 20px 0;
}

.transaction-message .success {
    background-color: rgba(40, 167, 69, 0.1);
    border: 1px solid #28a745;
}

.transaction-message .error {
    background-color: rgba(220, 53, 69, 0.1);
    border: 1px solid #dc3545;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin: 30px 0;
}

.pagination button {
    min-width: 100px;
}

.pagination button:disabled {
    background-color: #6c757d;
    cursor: not-allowed;
}

.pagination span {
    color: var(--text-color);
    font-weight: bold;
}

/* Loading and Error States */
.loading {
    text-align: center;
    padding: 40px;
    color: var(--secondary-color);
    font-size: 18px;
}

.loading::after {
    content: "";
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--secondary-color);
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 1s ease-in-out infinite;
    margin-left: 10px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-color);
    background-color: var(--primary-color);
    border-radius: 8px;
    font-size: 16px;
}

/* Navigation Updates */
.navigation {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 20px;
}

.navigation .btn {
    flex: 1;
    min-width: 140px;
    margin: 0;
}

/* Responsive Design */
@media (max-width: 768px) {
    .inventory-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        gap: 15px;
    }

    .buyback-stats {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .inventory-filters {
        flex-direction: column;
    }

    .search-input {
        min-width: auto;
        width: 100%;
    }

    .modal-content {
        margin: 20px;
        padding: 20px;
    }

    .navigation {
        flex-direction: column;
    }

    .navigation .btn {
        width: 100%;
    }

    .inventory-info {
        flex-direction: column;
        gap: 10px;
    }

    .history-filters {
        flex-direction: column;
        align-items: stretch;
    }

    .date-input {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .inventory-grid {
        grid-template-columns: 1fr;
    }

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

    .modal-content {
        width: 95%;
        margin: 10px;
        padding: 15px;
    }

    .history-item-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
}
