* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-purple: #2d1b4e;
    --secondary-purple: #4a2c7a;
    --accent-purple: #6b3fa0;
    --dark-purple: #1a0d2e;
    --light-purple: #8b6bb1;
    --text-light: #e0d4f0;
    --text-white: #ffffff;
    --user-green: #44FF44;
    --admin-red: #FF4444;
    --superadmin-blue: #4169E1;
    --star-color: #ffffff;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, var(--dark-purple) 0%, var(--primary-purple) 50%, var(--secondary-purple) 100%);
    color: var(--text-light);
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
}

/* Animated Background Stars */
.stars, .stars2, .stars3 {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
}

.stars {
    background: transparent url("data:image/svg+xml,%3Csvg width='100' height='100' xmlns='http://www.w3.org/2000/svg'%3E%3Ccircle cx='10' cy='10' r='1' fill='white' opacity='0.8'/%3E%3Ccircle cx='50' cy='30' r='1' fill='white' opacity='0.6'/%3E%3Ccircle cx='80' cy='60' r='1' fill='white' opacity='0.9'/%3E%3C/svg%3E") repeat;
    animation: moveStars 100s linear infinite;
}

.stars2 {
    background: transparent url("data:image/svg+xml,%3Csvg width='150' height='150' xmlns='http://www.w3.org/2000/svg'%3E%3Ccircle cx='20' cy='20' r='1.5' fill='white' opacity='0.7'/%3E%3Ccircle cx='100' cy='50' r='1.5' fill='white' opacity='0.5'/%3E%3C/svg%3E") repeat;
    animation: moveStars 150s linear infinite;
}

.stars3 {
    background: transparent url("data:image/svg+xml,%3Csvg width='200' height='200' xmlns='http://www.w3.org/2000/svg'%3E%3Ccircle cx='30' cy='30' r='2' fill='white' opacity='0.6'/%3E%3Ccircle cx='150' cy='80' r='2' fill='white' opacity='0.4'/%3E%3C/svg%3E") repeat;
    animation: moveStars 200s linear infinite;
}

@keyframes moveStars {
    from { transform: translateY(0); }
    to { transform: translateY(-100vh); }
}

/* Navbar */
.navbar {
    background: rgba(26, 13, 46, 0.9);
    backdrop-filter: blur(10px);
    padding: 1rem 2rem;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 4px 20px rgba(107, 63, 160, 0.3);
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--text-white);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: transform 0.3s ease;
}

.logo:hover {
    transform: scale(1.1);
}

.logo i {
    color: var(--accent-purple);
}

.nav-links {
    display: flex;
    gap: 1.5rem;
    align-items: center;
}

.nav-links a {
    color: var(--text-light);
    text-decoration: none;
    transition: all 0.3s ease;
    padding: 0.5rem 1rem;
    border-radius: 8px;
}

.nav-links a:hover {
    background: rgba(107, 63, 160, 0.3);
    color: var(--text-white);
    transform: translateY(-2px);
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    position: relative;
    z-index: 1;
}

/* Flash Messages */
.flash-messages {
    margin-bottom: 2rem;
}

.flash-message {
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    animation: slideIn 0.3s ease;
}

.flash-success {
    background: rgba(68, 255, 68, 0.2);
    border: 1px solid var(--user-green);
    color: var(--user-green);
}

.flash-error {
    background: rgba(255, 68, 68, 0.2);
    border: 1px solid var(--admin-red);
    color: var(--admin-red);
}

.flash-info {
    background: rgba(65, 105, 225, 0.2);
    border: 1px solid var(--superadmin-blue);
    color: var(--superadmin-blue);
}

.close-flash {
    background: none;
    border: none;
    color: inherit;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
}

@keyframes slideIn {
    from {
        transform: translateX(-100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Buttons */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
    font-weight: 600;
}

.btn-primary {
    background: var(--accent-purple);
    color: var(--text-white);
}

.btn-primary:hover {
    background: var(--light-purple);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(107, 63, 160, 0.4);
}

.btn-danger {
    background: var(--admin-red);
    color: var(--text-white);
}

.btn-danger:hover {
    background: #cc3333;
    transform: translateY(-2px);
}

.btn-success {
    background: var(--user-green);
    color: var(--dark-purple);
}

.btn-success:hover {
    background: #33dd33;
    transform: translateY(-2px);
}

/* Forms */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-light);
    font-weight: 600;
}

.form-control {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid rgba(107, 63, 160, 0.3);
    border-radius: 8px;
    background: rgba(26, 13, 46, 0.5);
    color: var(--text-white);
    font-size: 1rem;
    transition: all 0.3s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--accent-purple);
    box-shadow: 0 0 10px rgba(107, 63, 160, 0.3);
}

textarea.form-control {
    min-height: 120px;
    resize: vertical;
}

/* Product Cards */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.product-card {
    background: rgba(26, 13, 46, 0.7);
    border-radius: 16px;
    overflow: hidden;
    transition: all 0.3s ease;
    cursor: pointer;
    border: 2px solid rgba(107, 63, 160, 0.3);
    position: relative;
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(107, 63, 160, 0.5);
    border-color: var(--accent-purple);
}

.product-card.expanding {
    animation: expandCard 0.5s ease forwards;
    position: fixed;
    z-index: 1000;
    max-width: 90vw;
    max-height: 90vh;
}

.product-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.product-card:hover .product-image {
    transform: scale(1.05);
}

.product-info {
    padding: 1.5rem;
}

.product-name {
    font-size: 1.25rem;
    font-weight: bold;
    margin-bottom: 0.5rem;
    color: var(--text-white);
}

.product-description {
    color: var(--text-light);
    margin-bottom: 1rem;
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1rem;
}

.product-price {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--user-green);
}

.product-type {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.875rem;
    font-weight: 600;
}

.product-type.key {
    background: rgba(65, 105, 225, 0.3);
    color: var(--superadmin-blue);
}

.product-type.game {
    background: rgba(255, 68, 68, 0.3);
    color: var(--admin-red);
}

/* Product Detail Modal */
.product-detail-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.product-detail-modal.active {
    display: flex;
    animation: fadeIn 0.3s ease;
}

.product-detail-content {
    background: var(--primary-purple);
    border-radius: 16px;
    padding: 2rem;
    max-width: 800px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    border: 2px solid var(--accent-purple);
    animation: slideUp 0.5s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from {
        transform: translateY(50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes expandCard {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1) translateY(-20px);
    }
    100% {
        transform: scale(1);
    }
}

.close-modal {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    color: var(--text-white);
    font-size: 2rem;
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.close-modal:hover {
    background: rgba(255, 68, 68, 0.3);
    transform: rotate(90deg);
}

/* User Colors */
.username {
    font-weight: 600;
}

.username.user {
    color: var(--user-green);
}

.username.admin {
    color: var(--admin-red);
}

.username.superadmin {
    color: var(--superadmin-blue);
}

/* Profile */
.profile-header {
    background: rgba(26, 13, 46, 0.7);
    border-radius: 16px;
    padding: 2rem;
    margin-bottom: 2rem;
    display: flex;
    align-items: center;
    gap: 2rem;
}

.profile-avatar {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    border: 4px solid var(--accent-purple);
    object-fit: cover;
}

.profile-info h1 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.profile-role {
    display: inline-block;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-weight: 600;
    margin-top: 0.5rem;
}

/* Orders */
.orders-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.order-card {
    background: rgba(26, 13, 46, 0.7);
    border-radius: 12px;
    padding: 1.5rem;
    border: 2px solid rgba(107, 63, 160, 0.3);
    transition: all 0.3s ease;
}

.order-card:hover {
    border-color: var(--accent-purple);
    transform: translateX(5px);
}

.order-status {
    display: inline-block;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-weight: 600;
    margin-left: 1rem;
}

.order-status.pending {
    background: rgba(255, 165, 0, 0.3);
    color: #ffa500;
}

.order-status.paid {
    background: rgba(65, 105, 225, 0.3);
    color: var(--superadmin-blue);
}

.order-status.delivered {
    background: rgba(68, 255, 68, 0.3);
    color: var(--user-green);
}

/* Chat Widget */
.chat-widget {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 1000;
}

.chat-toggle {
    width: 60px;
    height: 60px;
    background: var(--accent-purple);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(107, 63, 160, 0.5);
    transition: all 0.3s ease;
}

.chat-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 25px rgba(107, 63, 160, 0.7);
}

.chat-toggle i {
    font-size: 1.5rem;
    color: var(--text-white);
}

.chat-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 350px;
    height: 500px;
    background: rgba(26, 13, 46, 0.95);
    border-radius: 16px;
    border: 2px solid var(--accent-purple);
    display: none;
    flex-direction: column;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.chat-window.active {
    display: flex;
    animation: slideUpChat 0.3s ease;
}

@keyframes slideUpChat {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.chat-header {
    padding: 1rem;
    border-bottom: 2px solid rgba(107, 63, 160, 0.3);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-header h3 {
    margin: 0;
    color: var(--text-white);
}

.close-chat {
    background: none;
    border: none;
    color: var(--text-white);
    font-size: 1.5rem;
    cursor: pointer;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.close-chat:hover {
    background: rgba(255, 68, 68, 0.3);
}

.chat-messages {
    flex: 1;
    padding: 1rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.chat-message {
    padding: 0.75rem;
    border-radius: 12px;
    max-width: 80%;
    word-wrap: break-word;
}

.chat-message.user {
    align-self: flex-end;
    background: rgba(107, 63, 160, 0.5);
}

.chat-message.admin {
    align-self: flex-start;
    background: rgba(255, 68, 68, 0.3);
}

.chat-info {
    text-align: center;
    color: var(--text-light);
    font-style: italic;
    padding: 1rem;
}

.chat-input {
    padding: 1rem;
    border-top: 2px solid rgba(107, 63, 160, 0.3);
}

.chat-input form {
    display: flex;
    gap: 0.5rem;
}

.chat-input input {
    flex: 1;
    padding: 0.75rem;
    border: 2px solid rgba(107, 63, 160, 0.3);
    border-radius: 8px;
    background: rgba(26, 13, 46, 0.5);
    color: var(--text-white);
}

.chat-input button {
    padding: 0.75rem 1rem;
    background: var(--accent-purple);
    border: none;
    border-radius: 8px;
    color: var(--text-white);
    cursor: pointer;
    transition: all 0.3s ease;
}

.chat-input button:hover {
    background: var(--light-purple);
}

/* Responsive */
@media (max-width: 768px) {
    .nav-links {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .products-grid {
        grid-template-columns: 1fr;
    }
    
    .profile-header {
        flex-direction: column;
        text-align: center;
    }
    
    .chat-window {
        width: calc(100vw - 4rem);
        right: -2rem;
    }
}
