/* Admin Panel Styles */

.admin-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
}

.admin-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.admin-btn i {
    font-size: 0.9rem;
}

/* Admin Panel Modal */
.admin-panel-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}

.admin-panel-overlay.active {
    opacity: 1;
    visibility: visible;
}

.admin-panel {
    background: var(--card-bg, #fff);
    border-radius: 16px;
    width: 90%;
    max-width: 1000px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    transform: translateY(20px);
    transition: transform 0.3s;
}

.admin-panel-overlay.active .admin-panel {
    transform: translateY(0);
}

.admin-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border, #eee);
}

.admin-panel-header h2 {
    margin: 0;
    font-size: 1.5rem;
    color: var(--text-primary, #333);
}

.admin-panel-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-secondary, #666);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background 0.2s;
}

.admin-panel-close:hover {
    background: var(--hover-bg, #f0f0f0);
}

/* Tabs */
.admin-tabs {
    display: flex;
    border-bottom: 1px solid var(--border, #eee);
    padding: 0 24px;
}

.admin-tab {
    padding: 12px 24px;
    background: none;
    border: none;
    font-size: 1rem;
    color: var(--text-secondary, #666);
    cursor: pointer;
    border-bottom: 3px solid transparent;
    margin-bottom: -1px;
    transition: all 0.2s;
}

.admin-tab:hover {
    color: var(--text-primary, #333);
}

.admin-tab.active {
    color: var(--primary, #667eea);
    border-bottom-color: var(--primary, #667eea);
    font-weight: 600;
}

/* Tab Content */
.admin-tab-content {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

.admin-tab-pane {
    display: none;
}

.admin-tab-pane.active {
    display: block;
}

/* Users Table */
.users-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.users-table th,
.users-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border, #eee);
}

.users-table th {
    background: var(--hover-bg, #f8f9fa);
    font-weight: 600;
    color: var(--text-secondary, #666);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Sortable Headers */
.users-table th.sortable-header {
    cursor: pointer;
    user-select: none;
    transition: background 0.2s, color 0.2s;
}

.users-table th.sortable-header:hover {
    background: var(--border, #e2e8f0);
    color: var(--text-primary, #333);
}

.users-table tr:hover {
    background: var(--hover-bg, #f8f9fa);
}

.users-table .email-cell {
    font-weight: 500;
    color: var(--text-primary, #333);
}

.users-table .stat-cell {
    text-align: center;
    font-family: var(--font-mono, monospace);
}

.users-table .last-login-cell {
    font-size: 0.8rem;
    color: var(--text-secondary, #666);
    white-space: nowrap;
}

/* Blocked row styling */
.users-table tr.blocked-row {
    background: rgba(239, 68, 68, 0.1);
}

.users-table tr.blocked-row:hover {
    background: rgba(239, 68, 68, 0.15);
}

/* Block toggle button */
.block-toggle-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border: 1px solid #10b981;
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
    border-radius: 6px;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s;
}

.block-toggle-btn:hover {
    background: rgba(16, 185, 129, 0.2);
}

.block-toggle-btn.blocked {
    border-color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.block-toggle-btn.blocked:hover {
    background: rgba(239, 68, 68, 0.2);
}

/* Access Level Dropdown */
.access-level-select {
    padding: 6px 12px;
    border: 1px solid var(--border, #ddd);
    border-radius: 6px;
    font-size: 0.85rem;
    background: var(--card-bg, #fff);
    color: var(--text-primary, #333);
    cursor: pointer;
}

.access-level-select.free {
    border-color: #94a3b8;
}

.access-level-select.pro {
    border-color: #667eea;
    background: linear-gradient(135deg, #667eea15 0%, #764ba215 100%);
}

/* Limits Editor */
.limits-section {
    margin-bottom: 32px;
}

.limits-section h3 {
    margin: 0 0 16px 0;
    font-size: 1.1rem;
    color: var(--text-primary, #333);
    display: flex;
    align-items: center;
    gap: 8px;
}

.limits-section h3 .badge {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.limits-section h3 .badge.free {
    background: #e2e8f0;
    color: #475569;
}

.limits-section h3 .badge.pro {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.limits-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.limit-card {
    background: var(--hover-bg, #f8f9fa);
    border: 1px solid var(--border, #eee);
    border-radius: 12px;
    padding: 16px;
}

.limit-card label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-secondary, #666);
    margin-bottom: 8px;
}

.limit-card input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border, #ddd);
    border-radius: 8px;
    font-size: 1rem;
    font-family: var(--font-mono, monospace);
    background: var(--card-bg, #fff);
    color: var(--text-primary, #333);
}

.limit-card input:focus {
    outline: none;
    border-color: var(--primary, #667eea);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.save-limits-btn {
    margin-top: 24px;
    padding: 12px 24px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s;
}

.save-limits-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

/* Limit Exceeded Modal */
.limit-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 20000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}

.limit-modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.limit-modal {
    background: var(--card-bg, #fff);
    border-radius: 16px;
    padding: 32px;
    max-width: 450px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.limit-modal-icon {
    font-size: 3rem;
    margin-bottom: 16px;
}

.limit-modal h3 {
    margin: 0 0 16px 0;
    font-size: 1.3rem;
    color: var(--text-primary, #333);
}

.limit-modal p {
    margin: 0 0 24px 0;
    color: var(--text-secondary, #666);
    line-height: 1.6;
}

.limit-modal .telegram-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: #0088cc;
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.2s;
}

.limit-modal .telegram-link:hover {
    background: #0077b5;
    transform: translateY(-1px);
}

.limit-modal .close-btn {
    display: block;
    margin-top: 16px;
    padding: 8px 16px;
    background: none;
    border: 1px solid var(--border, #ddd);
    border-radius: 6px;
    color: var(--text-secondary, #666);
    cursor: pointer;
    margin-left: auto;
    margin-right: auto;
}

/* Loading State */
.admin-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 48px;
    color: var(--text-secondary, #666);
}

.admin-loading i {
    margin-right: 8px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    100% {
        transform: rotate(360deg);
    }
}

/* Responsive */
@media (max-width: 768px) {
    .admin-panel {
        width: 95%;
        max-height: 90vh;
    }

    .limits-grid {
        grid-template-columns: 1fr;
    }

    .users-table {
        font-size: 0.8rem;
    }

    .users-table th,
    .users-table td {
        padding: 8px 10px;
    }
}