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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: #0a0e27;
    min-height: 100vh;
    padding: 20px;
    color: #e0e0e0;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    background: #1a1f3a;
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    border: 1px solid #2a2f4a;
}

.header {
    text-align: center;
    margin-bottom: 30px;
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 15px;
    color: white;
}

.header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
}

.header h1 i {
    font-size: 1.2em;
}

.subtitle {
    color: rgba(255, 255, 255, 0.9);
    font-size: 1.1em;
}

.action-buttons {
    display: flex;
    gap: 15px;
    margin-bottom: 25px;
    justify-content: center;
    flex-wrap: wrap;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 10px;
    font-size: 1em;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    will-change: transform;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-info {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    color: white;
}

.btn-success {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    color: white;
}

.btn-warning {
    background: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
    color: white;
}

.btn-danger {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a6f 100%);
    color: white;
}

.btn-secondary {
    background: linear-gradient(135deg, #6c757d 0%, #5a6268 100%);
    color: white;
}

.btn-block {
    width: 100%;
    justify-content: center;
}

.platform-selector {
    display: flex;
    gap: 15px;
    margin-bottom: 30px;
    justify-content: center;
}

.platform-btn {
    flex: 1;
    max-width: 300px;
    padding: 20px;
    border: 3px solid #2a2f4a;
    border-radius: 15px;
    background: #1a1f3a;
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease, transform 0.15s ease, box-shadow 0.15s ease;
    font-size: 1.1em;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: #e0e0e0;
    will-change: transform;
}

.platform-btn:hover {
    border-color: #667eea;
    transform: translateY(-1px);
    box-shadow: 0 3px 15px rgba(102, 126, 234, 0.2);
    background: #252a4a;
}

.platform-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: #667eea;
}

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

.stat-card {
    background: #252a4a;
    padding: 25px;
    border-radius: 15px;
    text-align: center;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    transition: transform 0.3s;
    border: 1px solid #2a2f4a;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
    border-color: #667eea;
}

.stat-icon {
    font-size: 2.5em;
    margin-bottom: 10px;
    color: #667eea;
}

.stat-icon.green {
    color: #4caf50;
}

.stat-icon.red {
    color: #f44336;
}

.stat-value {
    font-size: 2.5em;
    font-weight: bold;
    color: #fff;
    margin-bottom: 5px;
}

.stat-label {
    color: #b0b0b0;
    font-size: 0.9em;
}

.table-container {
    overflow-x: auto;
    background: #1a1f3a;
    border-radius: 15px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    border: 1px solid #2a2f4a;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table thead {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.data-table th {
    padding: 15px;
    text-align: left;
    font-weight: 600;
}

.data-table td {
    padding: 15px;
    border-bottom: 1px solid #2a2f4a;
    color: #e0e0e0;
}

.data-table tbody tr {
    background: #1a1f3a;
}

.data-table tbody tr:hover {
    background: #252a4a;
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

.status-badge {
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.85em;
    font-weight: 600;
    display: inline-block;
}

.status-active {
    background: #4caf50;
    color: white;
}

.status-expired {
    background: #ff9800;
    color: white;
}

.status-inactive {
    background: #f44336;
    color: white;
}

.action-buttons-cell {
    display: flex;
    gap: 8px;
}

.action-btn {
    padding: 6px 12px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.85em;
    transition: all 0.3s;
    color: white;
}

.action-btn:hover {
    transform: scale(1.05);
}

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: #1a1f3a;
    border-radius: 20px;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: slideIn 0.3s;
    border: 1px solid #2a2f4a;
}

@keyframes slideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    padding: 25px;
    border-bottom: 2px solid #2a2f4a;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 20px 20px 0 0;
    color: white;
}

.modal-header h2 {
    display: flex;
    align-items: center;
    gap: 10px;
}

.close {
    font-size: 2em;
    cursor: pointer;
    color: rgba(255, 255, 255, 0.8);
    transition: color 0.3s;
}

.close:hover {
    color: white;
}

.modal-body {
    padding: 25px;
    background: #1a1f3a;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #e0e0e0;
}

.sub-label {
    font-size: 0.85em;
    color: #b0b0b0;
    font-weight: normal;
    margin-left: 5px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid #2a2f4a;
    border-radius: 10px;
    font-size: 1em;
    transition: border-color 0.3s;
    background: #252a4a;
    color: #e0e0e0;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
    background: #2a2f4a;
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
}

.loading {
    text-align: center;
    padding: 40px;
    color: #b0b0b0;
    font-size: 1.1em;
}

.plugins-list {
    margin-top: 20px;
}

.plugin-item {
    background: #252a4a;
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 1px solid #2a2f4a;
}

.plugin-item:hover {
    border-color: #667eea;
    background: #2a2f4a;
}

.plugin-info {
    flex: 1;
}

.plugin-name {
    font-weight: 600;
    color: #fff;
    font-size: 1.1em;
}

.plugin-platform {
    color: #b0b0b0;
    font-size: 0.9em;
    margin-top: 5px;
}

.license-key {
    font-family: 'Courier New', monospace;
    font-size: 0.85em;
    background: #1a1f3a;
    padding: 5px 10px;
    border-radius: 5px;
    word-break: break-all;
    color: #667eea;
    border: 1px solid #2a2f4a;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
}

.license-key:hover {
    background: #252a4a;
    border-color: #667eea;
    transform: scale(1.02);
}

.license-key::after {
    content: '📋';
    margin-left: 8px;
    opacity: 0;
    transition: opacity 0.3s;
}

.license-key:hover::after {
    opacity: 1;
}

/* Поиск и фильтры */
.search-filters {
    background: #252a4a;
    padding: 20px;
    border-radius: 15px;
    margin-bottom: 25px;
    border: 1px solid #2a2f4a;
}

.search-box {
    position: relative;
    margin-bottom: 15px;
}

.search-box i {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #667eea;
    font-size: 1.1em;
}

.search-box input {
    width: 100%;
    padding: 12px 15px 12px 45px;
    border: 2px solid #2a2f4a;
    border-radius: 10px;
    font-size: 1em;
    background: #1a1f3a;
    color: #e0e0e0;
    transition: all 0.3s;
}

.search-box input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.filter-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 15px;
}

.filter-btn {
    padding: 8px 16px;
    border: 2px solid #2a2f4a;
    border-radius: 8px;
    background: #1a1f3a;
    color: #e0e0e0;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 500;
}

.filter-btn:hover {
    border-color: #667eea;
    background: #252a4a;
}

.filter-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-color: #667eea;
    color: white;
}

.export-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* Сортировка таблицы */
.sortable {
    cursor: pointer;
    user-select: none;
    position: relative;
    transition: background 0.3s;
}

.sortable:hover {
    background: rgba(102, 126, 234, 0.2);
}

.sortable i {
    margin-left: 5px;
    opacity: 0.5;
    font-size: 0.8em;
}

.sortable.sort-asc i::before {
    content: '\f0de';
    opacity: 1;
}

.sortable.sort-desc i::before {
    content: '\f0dd';
    opacity: 1;
}

/* Toast уведомления */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    background: #1a1f3a;
    border: 1px solid #2a2f4a;
    border-radius: 10px;
    padding: 15px 20px;
    min-width: 300px;
    max-width: 400px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    gap: 15px;
    animation: slideInRight 0.3s ease-out;
    position: relative;
    overflow: hidden;
}

.toast::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: #667eea;
}

.toast.success::before {
    background: #4caf50;
}

.toast.error::before {
    background: #f44336;
}

.toast.warning::before {
    background: #ff9800;
}

.toast.info::before {
    background: #2196f3;
}

.toast-icon {
    font-size: 1.5em;
    flex-shrink: 0;
}

.toast.success .toast-icon {
    color: #4caf50;
}

.toast.error .toast-icon {
    color: #f44336;
}

.toast.warning .toast-icon {
    color: #ff9800;
}

.toast.info .toast-icon {
    color: #2196f3;
}

.toast-message {
    flex: 1;
    color: #e0e0e0;
    font-weight: 500;
}

.toast-close {
    background: none;
    border: none;
    color: #b0b0b0;
    cursor: pointer;
    font-size: 1.2em;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.3s;
}

.toast-close:hover {
    color: #fff;
}

@keyframes slideInRight {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOutRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(400px);
        opacity: 0;
    }
}

.toast.hiding {
    animation: slideOutRight 0.3s ease-in forwards;
}

/* Аналитика */
.analytics-content {
    display: flex;
    flex-direction: column;
    gap: 25px;
}

.chart-container {
    background: #252a4a;
    padding: 20px;
    border-radius: 15px;
    border: 1px solid #2a2f4a;
}

.analytics-stats {
    background: #252a4a;
    padding: 20px;
    border-radius: 15px;
    border: 1px solid #2a2f4a;
}

.analytics-stats h3 {
    margin-bottom: 15px;
    color: #e0e0e0;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid #2a2f4a;
}

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

.stat-item-label {
    color: #b0b0b0;
}

.stat-item-value {
    color: #fff;
    font-weight: 600;
}

/* Чекбоксы в таблице */
.data-table input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #667eea;
}

/* Toggle Switch для статуса лицензии */
.toggle-label {
    display: flex;
    align-items: center;
    gap: 15px;
    cursor: pointer;
    padding: 15px;
    background: #252a4a;
    border-radius: 10px;
    border: 1px solid #2a2f4a;
    transition: all 0.3s;
}

.toggle-label:hover {
    border-color: #667eea;
    background: #2a2f4a;
}

.toggle-text {
    flex: 1;
    font-weight: 600;
    color: #e0e0e0;
    font-size: 1em;
}

.toggle-switch {
    position: relative;
    width: 60px;
    height: 30px;
    flex-shrink: 0;
}

.toggle-input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a6f 100%);
    transition: 0.4s;
    border-radius: 30px;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3);
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 22px;
    width: 22px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: 0.4s;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.toggle-input:checked + .toggle-slider {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
}

.toggle-input:checked + .toggle-slider:before {
    transform: translateX(30px);
}

.toggle-status {
    min-width: 80px;
    text-align: right;
    font-weight: 600;
    font-size: 0.95em;
    color: #ff6b6b;
    transition: color 0.3s;
}

.toggle-input:checked ~ .toggle-status {
    color: #38ef7d;
}

@media (max-width: 768px) {
    body {
        padding: 10px;
    }
    
    .container {
        padding: 15px;
        border-radius: 15px;
    }
    
    .header {
        padding: 15px;
        margin-bottom: 20px;
    }
    
    .header h1 {
        font-size: 1.5em;
        flex-direction: column;
        gap: 10px;
    }
    
    .header > div {
        flex-direction: column !important;
        gap: 15px;
    }
    
    .header > div > div:last-child {
        width: 100%;
    }
    
    #currentUser {
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
    }
    
    .subtitle {
        font-size: 0.9em;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    
    .stat-card {
        padding: 15px;
    }
    
    .stat-icon {
        font-size: 2em;
    }
    
    .stat-value {
        font-size: 2em;
    }
    
    .platform-selector {
        flex-direction: column;
        gap: 10px;
    }
    
    .platform-btn {
        max-width: 100%;
        padding: 15px;
    }
    
    .action-buttons {
        flex-direction: column;
        gap: 10px;
    }
    
    .btn {
        width: 100%;
        padding: 12px 20px;
        font-size: 0.95em;
    }
    
    .search-filters {
        padding: 15px;
    }
    
    .filter-buttons {
        flex-direction: column;
        gap: 8px;
    }
    
    .filter-btn {
        width: 100%;
    }
    
    .export-buttons {
        flex-direction: column;
    }
    
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .data-table {
        min-width: 800px;
        font-size: 0.85em;
    }
    
    .data-table th,
    .data-table td {
        padding: 10px 8px;
    }
    
    .action-buttons-cell {
        flex-direction: column;
        gap: 5px;
    }
    
    .action-btn {
        width: 100%;
        padding: 8px;
        font-size: 0.8em;
    }
    
    .modal-content {
        width: 95%;
        max-width: 95%;
        margin: 10px;
        max-height: 95vh;
    }
    
    .modal-header {
        padding: 15px;
    }
    
    .modal-header h2 {
        font-size: 1.2em;
    }
    
    .modal-body {
        padding: 15px;
    }
    
    .form-group {
        margin-bottom: 15px;
    }
    
    .form-group input,
    .form-group select,
    .form-group textarea {
        padding: 10px;
        font-size: 0.95em;
    }
    
    .form-group > div {
        flex-direction: column !important;
        gap: 10px;
    }
    
    .form-group > div > button {
        width: 100%;
    }
    
    .toast-container {
        left: 10px;
        right: 10px;
        top: 10px;
    }
    
    .toast {
        min-width: auto;
        max-width: 100%;
        padding: 12px 15px;
    }
    
    .plugin-item {
        flex-direction: column;
        gap: 10px;
        align-items: flex-start;
    }
    
    .toggle-label {
        flex-direction: column;
        gap: 10px;
        align-items: flex-start;
    }
    
    .toggle-status {
        text-align: left;
    }
}

@media (max-width: 480px) {
    .header h1 {
        font-size: 1.3em;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .stat-value {
        font-size: 1.8em;
    }
    
    .data-table {
        min-width: 700px;
        font-size: 0.8em;
    }
    
    .data-table th,
    .data-table td {
        padding: 8px 5px;
    }
}
