/* Reset CSS */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
.header {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    margin-bottom: 30px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 30px;
    flex-wrap: wrap;
    gap: 20px;
}

.main-logo {
    width: 60px;
    height: 60px;
    border-radius: 10px;
    object-fit: cover;
}

.header h1 {
    color: #4a5568;
    font-size: 2rem;
    font-weight: 700;
    flex: 1;
    margin-left: 20px;
}

.user-info {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 5px;
}

.key-info {
    font-size: 0.9rem;
    color: #718096;
}

.admin-btn-link {
    background: #667eea;
    color: white;
    padding: 8px 16px;
    border-radius: 8px;
    text-decoration: none;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    margin-right: 10px;
}

.admin-btn-link:hover {
    background: #5a67d8;
    transform: translateY(-1px);
}

.logout-btn {
    background: #e53e3e;
    color: white;
    padding: 8px 16px;
    border-radius: 8px;
    text-decoration: none;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.logout-btn:hover {
    background: #c53030;
    transform: translateY(-1px);
}

/* Alerts */
.alert {
    padding: 15px 20px;
    border-radius: 10px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: slideIn 0.3s ease;
    transition: opacity 0.3s ease;
}

.alert-success {
    background: rgba(72, 187, 120, 0.1);
    border: 1px solid #48bb78;
    color: #2f855a;
}

.alert-error {
    background: rgba(245, 101, 101, 0.1);
    border: 1px solid #f56565;
    color: #c53030;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Key Form */
.key-form-container {
    display: flex;
    justify-content: center;
    margin: 50px 0;
}

.key-form {
    background: rgba(255, 255, 255, 0.95);
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    width: 100%;
    max-width: 500px;
}

.key-form h2 {
    text-align: center;
    margin-bottom: 30px;
    color: #4a5568;
    font-size: 1.8rem;
}

.form-group {
    margin-bottom: 25px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #4a5568;
}

.form-group input {
    width: 100%;
    padding: 15px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.8);
}

.form-group input:focus {
    outline: none;
    border-color: #667eea;
    background: white;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-group small {
    display: block;
    margin-top: 5px;
    color: #718096;
    font-size: 0.85rem;
}

.submit-btn {
    width: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 15px;
    border: none;
    border-radius: 10px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(102, 126, 234, 0.3);
}

.buy-key {
    margin-top: 30px;
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid #e2e8f0;
}

.telegram-btn {
    display: inline-block;
    background: #0088cc;
    color: white;
    padding: 12px 24px;
    border-radius: 25px;
    text-decoration: none;
    margin-top: 10px;
    transition: all 0.3s ease;
}

.telegram-btn:hover {
    background: #0077bb;
    transform: translateY(-2px);
}

/* Games Grid */
.games-container {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
}

.games-container h2 {
    text-align: center;
    margin-bottom: 40px;
    color: #4a5568;
    font-size: 2rem;
}

.games-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 25px;
}

.game-card {
    background: white;
    border-radius: 15px;
    padding: 25px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
}

.game-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.15);
    border-color: #667eea;
}

.game-logo {
    width: 80px;
    height: 80px;
    margin: 0 auto 20px;
    border-radius: 15px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.game-logo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.no-logo {
    color: white;
    font-size: 2rem;
}

.game-info h3 {
    font-size: 1.3rem;
    margin-bottom: 10px;
    color: #4a5568;
}

.game-file {
    font-size: 0.9rem;
    color: #718096;
    margin-bottom: 20px;
    font-family: 'Courier New', monospace;
}

.play-btn {
    background: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 25px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.play-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(72, 187, 120, 0.3);
}

.no-games {
    text-align: center;
    padding: 60px 20px;
    color: #718096;
}

.no-games i {
    font-size: 4rem;
    margin-bottom: 20px;
    color: #cbd5e0;
}

/* Footer */
.footer {
    margin-top: 50px;
    text-align: center;
    color: rgba(255, 255, 255, 0.8);
}

.footer a {
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
}

.footer a:hover {
    color: white;
}

/* Admin Panel Styles */
.admin-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

.admin-header {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    margin-bottom: 30px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.admin-nav {
    display: flex;
    gap: 15px;
}

.nav-btn {
    background: #4299e1;
    color: white;
    padding: 10px 20px;
    border-radius: 8px;
    text-decoration: none;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.nav-btn:hover {
    background: #3182ce;
    transform: translateY(-1px);
}

.nav-btn.logout {
    background: #e53e3e;
}

.nav-btn.logout:hover {
    background: #c53030;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: white;
    padding: 25px;
    border-radius: 15px;
    display: flex;
    align-items: center;
    gap: 20px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
}

.stat-card i {
    font-size: 2.5rem;
    color: #667eea;
}

.stat-info h3 {
    font-size: 2rem;
    font-weight: 700;
    color: #4a5568;
    margin-bottom: 5px;
}

.stat-info p {
    color: #718096;
    font-size: 0.9rem;
}

/* Admin Tabs */
.admin-tabs {
    background: white;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
}

.tab-buttons {
    display: flex;
    background: #f7fafc;
    border-bottom: 1px solid #e2e8f0;
}

.tab-btn {
    flex: 1;
    padding: 15px 20px;
    background: none;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
    color: #718096;
}

.tab-btn.active {
    background: white;
    color: #667eea;
    border-bottom: 2px solid #667eea;
}

.tab-btn:hover {
    color: #4a5568;
}

.tab-content {
    display: none;
    padding: 30px;
}

.tab-content.active {
    display: block;
}

.section {
    margin-bottom: 40px;
}

.section h3 {
    color: #4a5568;
    margin-bottom: 20px;
    font-size: 1.3rem;
}

/* Forms */
.admin-form {
    background: #f7fafc;
    padding: 25px;
    border-radius: 10px;
    margin-bottom: 30px;
}

.form-row {
    display: flex;
    gap: 20px;
    align-items: end;
    flex-wrap: wrap;
}

.admin-form .form-group {
    flex: 1;
    min-width: 200px;
}

.admin-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.admin-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.3);
}

/* Tables */
.table-container {
    overflow-x: auto;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

.admin-table th {
    background: #f7fafc;
    padding: 15px;
    text-align: left;
    font-weight: 600;
    color: #4a5568;
    border-bottom: 1px solid #e2e8f0;
}

.admin-table td {
    padding: 15px;
    border-bottom: 1px solid #f7fafc;
}

.admin-table tr:hover {
    background: #f9f9f9;
}

.admin-table code {
    background: #edf2f7;
    padding: 4px 8px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
}

/* Status badges */
.status {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}

.status.used {
    background: rgba(245, 101, 101, 0.1);
    color: #c53030;
}

.status.unused {
    background: rgba(72, 187, 120, 0.1);
    color: #2f855a;
}

.badge {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
}

.badge.admin {
    background: #667eea;
    color: white;
}

.action-badge {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 500;
    text-transform: capitalize;
}

.action-badge.login_success {
    background: rgba(72, 187, 120, 0.1);
    color: #2f855a;
}

.action-badge.login_failed {
    background: rgba(245, 101, 101, 0.1);
    color: #c53030;
}

.action-badge.create_key {
    background: rgba(66, 153, 225, 0.1);
    color: #2b6cb0;
}

.action-badge.open_game {
    background: rgba(128, 90, 213, 0.1);
    color: #6b46c1;
}

.action-badge.click_game {
    background: rgba(237, 137, 54, 0.1);
    color: #c05621;
}

.action-badge.access_game {
    background: rgba(72, 187, 120, 0.1);
    color: #2f855a;
}

.action-badge.key_activation_for_game {
    background: rgba(66, 153, 225, 0.1);
    color: #2b6cb0;
}

.action-badge.invalid_key_for_game {
    background: rgba(245, 101, 101, 0.1);
    color: #c53030;
}

.action-badge.session_expired {
    background: rgba(160, 174, 192, 0.1);
    color: #4a5568;
}

/* Buttons */
.btn-small {
    padding: 6px 12px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.3s ease;
    margin: 0 2px;
}

.btn-danger {
    background: #e53e3e;
    color: white;
}

.btn-danger:hover {
    background: #c53030;
}

.btn-success {
    background: #48bb78;
    color: white;
}

.btn-success:hover {
    background: #38a169;
}

/* Text colors */
.text-success {
    color: #2f855a !important;
}

.text-danger {
    color: #c53030 !important;
}

/* Extend form */
.extend-form {
    display: flex;
    align-items: center;
    gap: 5px;
}

.extend-form input {
    padding: 4px 6px;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    font-size: 0.8rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container, .admin-container {
        padding: 15px;
    }
    
    .header-content {
        flex-direction: column;
        text-align: center;
    }
    
    .header h1 {
        margin-left: 0;
        font-size: 1.5rem;
    }
    
    .user-info {
        align-items: center;
    }
    
    .key-form {
        padding: 30px 25px;
    }
    
    .games-grid {
        grid-template-columns: 1fr;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .tab-buttons {
        flex-wrap: wrap;
    }
    
    .tab-btn {
        flex: none;
        min-width: 120px;
    }
    
    .form-row {
        flex-direction: column;
    }
    
    .admin-nav {
        flex-direction: column;
        align-items: center;
    }
    
    .admin-table {
        font-size: 0.9rem;
    }
    
    .admin-table th,
    .admin-table td {
        padding: 10px 8px;
    }
}

@media (max-width: 480px) {
    .key-form {
        padding: 25px 20px;
    }
    
    .games-container {
        padding: 25px 20px;
    }
    
    .tab-content {
        padding: 20px 15px;
    }
    
    .admin-form {
        padding: 20px 15px;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    body {
        background: linear-gradient(135deg, #2d3748 0%, #4a5568 100%);
    }
    
    .header,
    .key-form,
    .games-container {
        background: rgba(45, 55, 72, 0.95);
        color: #e2e8f0;
    }
    
    .header h1,
    .key-form h2,
    .games-container h2 {
        color: #e2e8f0;
    }
    
    .game-card {
        background: #2d3748;
        color: #e2e8f0;
    }
    
    .game-info h3 {
        color: #e2e8f0;
    }
}

/* Loading animation */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Smooth transitions for all interactive elements */
button, a, input, .game-card, .stat-card {
    transition: all 0.3s ease;
}

/* Focus styles for accessibility */
button:focus,
a:focus,
input:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

/* Print styles */
@media print {
    .header,
    .footer,
    .admin-nav,
    .tab-buttons {
        display: none;
    }
    
    .container,
    .admin-container {
        max-width: none;
        padding: 0;
    }
    
    .tab-content.active {
        display: block !important;
    }
}

/* Contact Links in Success Alert */
.contact-link {
    color: white !important;
    text-decoration: none;
    background: rgba(255, 255, 255, 0.2);
    padding: 8px 15px;
    border-radius: 20px;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.contact-link:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

.contact-link i {
    font-size: 1.1rem;
}

/* Form Buttons */
.form-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

.price-btn {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
    border: none;
    padding: 12px 25px;
    border-radius: 50px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
}

.price-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(40, 167, 69, 0.3);
}

/* Price Modal */
.price-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    padding: 20px;
}

.price-modal-content {
    background: white;
    border-radius: 20px;
    max-width: 900px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.price-modal-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 25px 30px;
    border-radius: 20px 20px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.price-modal-header h2 {
    margin: 0;
    font-size: 1.8rem;
}

.close-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    font-size: 2rem;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

/* Price List */
.price-list {
    padding: 30px;
}

.price-category {
    margin-bottom: 40px;
}

.price-category h3 {
    color: #495057;
    margin-bottom: 20px;
    font-size: 1.4rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.price-items {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}

.price-item {
    background: #f8f9fa;
    border: 2px solid #dee2e6;
    border-radius: 15px;
    padding: 25px;
    text-align: center;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.price-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.price-item.popular {
    border-color: #ffc107;
    background: linear-gradient(135deg, #fff3cd 0%, #ffeaa7 100%);
}

.price-item.vip {
    border-color: #6f42c1;
    background: linear-gradient(135deg, #e2d5f1 0%, #dda0dd 100%);
}

.price-item.best-deal {
    border-color: #dc3545;
    background: linear-gradient(135deg, #f8d7da 0%, #ffc0cb 100%);
}

.price-item.special {
    border-color: #17a2b8;
    background: linear-gradient(135deg, #d1ecf1 0%, #b8daff 100%);
}

.price-duration {
    font-size: 1.3rem;
    font-weight: bold;
    color: #495057;
    margin-bottom: 10px;
}

.price-amount {
    font-size: 2rem;
    font-weight: 900;
    color: #28a745;
    margin-bottom: 10px;
}

.price-desc {
    color: #6c757d;
    font-size: 0.95rem;
    margin-bottom: 15px;
}

.popular-badge, .best-badge {
    position: absolute;
    top: 15px;
    right: -30px;
    background: #ffc107;
    color: #212529;
    padding: 5px 40px;
    font-size: 0.8rem;
    font-weight: bold;
    transform: rotate(45deg);
    text-align: center;
}

.best-badge {
    background: #dc3545;
    color: white;
}

/* Price Contact */
.price-contact {
    background: #f8f9fa;
    padding: 30px;
    border-radius: 0 0 20px 20px;
    text-align: center;
    border-top: 1px solid #dee2e6;
}

.price-contact h3 {
    color: #495057;
    margin-bottom: 20px;
    font-size: 1.4rem;
}

.contact-buttons {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.contact-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    text-decoration: none;
    padding: 15px 25px;
    border-radius: 50px;
    font-weight: 600;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 1rem;
}

.contact-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
}

.contact-btn.admin {
    background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
}

.contact-btn.community {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
}

.price-note {
    color: #6c757d;
    font-size: 0.9rem;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

/* Responsive for Price Modal */
@media (max-width: 768px) {
    .price-modal {
        padding: 10px;
    }
    
    .price-modal-content {
        border-radius: 15px;
    }
    
    .price-modal-header {
        padding: 20px;
        border-radius: 15px 15px 0 0;
    }
    
    .price-modal-header h2 {
        font-size: 1.4rem;
    }
    
    .price-list {
        padding: 20px;
    }
    
    .price-items {
        grid-template-columns: 1fr;
    }
    
    .contact-buttons {
        flex-direction: column;
        align-items: center;
    }
    
    .form-buttons {
        flex-direction: column;
    }
    
    .price-contact {
        padding: 20px;
    }
}