.admin-panel-overlay {
    position: fixed;
    inset: 0;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    background: rgba(4, 10, 25, 0.78);
    backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 200000;
    padding: 24px;
}

.admin-panel-overlay.visible {
    display: flex;
}

.admin-panel {
    width: min(1180px, 96vw);
    height: min(980px, 96vh);
    background: var(--color-bg-primary, #111018);
    border-radius: 18px;
    border: 1px solid var(--color-border, rgba(255, 255, 255, 0.12));
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.35);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    color: var(--color-text-primary, #f5f5f5);
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.admin-panel-header {
    padding: 16px 24px 8px;
    border-bottom: 1px solid var(--color-border, rgba(255, 255, 255, 0.08));
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.admin-panel-header h2 {
    margin: 0;
    font-size: 22px;
}

.admin-panel-header p {
    margin: 4px 0 0;
    font-size: 14px;
    color: var(--color-text-secondary, #b2b2b2);
}

.admin-panel-header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.admin-panel-close-btn {
    border: none;
    background: transparent;
    color: inherit;
    font-size: 20px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s ease;
}

.admin-panel-close-btn:hover {
    background: rgba(255, 255, 255, 0.08);
}

.admin-refresh-btn {
    border: 1px solid var(--color-border, rgba(255, 255, 255, 0.2));
    background: transparent;
    color: inherit;
    padding: 6px 14px;
    border-radius: 999px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.2s ease, color 0.2s ease;
}

.admin-refresh-btn:hover {
    background: var(--color-primary, #ff6b35);
    color: #fff;
    border-color: transparent;
}

.admin-panel-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.admin-panel-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    padding: 10px 24px 2px;
}

.admin-stat-card {
    border: 1px solid var(--color-border, rgba(255, 255, 255, 0.08));
    border-radius: 14px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.02);
}

.admin-stat-card .stat-label {
    color: var(--color-text-secondary, #9ea4b5);
    font-size: 13px;
    margin-bottom: 6px;
}

.admin-stat-card .stat-value {
    font-size: 22px;
    font-weight: 600;
}

.admin-panel-tabs {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 24px;
    border-bottom: 1px solid var(--color-border, rgba(255, 255, 255, 0.08));
}

.admin-panel-tab-btn {
    border: none;
    background: transparent;
    color: var(--color-text-secondary, #b2b2b2);
    padding: 10px 18px;
    border-radius: 999px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.2s ease, color 0.2s ease;
}

.admin-panel-tab-btn.active {
    background: rgba(255, 255, 255, 0.08);
    color: var(--color-text-primary, #fff);
}

.admin-panel-content {
    flex: 1;
    position: relative;
    padding: 12px 24px 16px;
    overflow: hidden;
}

.admin-tab {
    display: none;
    height: 100%;
}

.admin-tab.active {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.admin-filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 10px;
}

.admin-filter-bar select,
.admin-filter-bar input {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--color-border, rgba(255, 255, 255, 0.08));
    color: inherit;
    font-size: 14px;
    padding: 8px 12px;
    border-radius: 8px;
    min-width: 160px;
}

.admin-filter-bar button {
    padding: 8px 14px;
    border-radius: 8px;
    border: 1px solid transparent;
    background: var(--color-primary, #ff6b35);
    color: #fff;
    cursor: pointer;
    transition: opacity 0.2s ease;
}

.admin-filter-bar button:hover {
    opacity: 0.85;
}

.admin-table-wrapper {
    flex: 1;
    overflow: auto;
    border: 1px solid var(--color-border, rgba(255, 255, 255, 0.08));
    border-radius: 12px;
    background: rgba(7, 9, 15, 0.6);
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    min-width: 640px;
}

.admin-table thead {
    position: sticky;
    top: 0;
    z-index: 2;
}

.admin-table th,
.admin-table td {
    padding: 10px 14px;
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.admin-table th {
    position: sticky;
    top: 0;
    z-index: 3;
    background: #3a3f46;
    box-shadow: inset 0 -1px 0 rgba(255, 255, 255, 0.08);
}

.admin-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 8px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    font-size: 12px;
}

.admin-badge.super {
    background: rgba(255, 107, 53, 0.12);
    color: #ffb499;
}

.admin-badge.feedback {
    background: rgba(82, 196, 255, 0.15);
    color: #9ed9ff;
}

.admin-badge.feedback.bug {
    background: rgba(255, 99, 99, 0.18);
    color: #ffb3b3;
}

.admin-badge.feedback.idea {
    background: rgba(255, 206, 86, 0.18);
    color: #ffe3a0;
}

.admin-badge.feedback.ux {
    background: rgba(46, 204, 113, 0.18);
    color: #b6f2cd;
}

.admin-actions {
    display: flex;
    gap: 8px;
}

.admin-actions button {
    border: none;
    padding: 6px 10px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
}

.admin-actions .danger {
    background: rgba(255, 99, 99, 0.15);
    color: #ff8b94;
}

.admin-actions .open {
    background: rgba(82, 196, 255, 0.15);
    color: #9ed9ff;
}

.admin-empty-state {
    margin-top: 32px;
    text-align: center;
    color: var(--color-text-secondary, #b2b2b2);
}

.admin-panel-loading {
    position: absolute;
    inset: 0;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(4, 10, 25, 0.65);
    backdrop-filter: blur(4px);
    z-index: 2;
}

.admin-panel-loading.visible {
    display: flex;
}

.admin-loading-spinner {
    width: 42px;
    height: 42px;
    border: 3px solid rgba(255, 255, 255, 0.15);
    border-top-color: var(--color-primary, #ff6b35);
    border-radius: 50%;
    animation: admin-spin 1s linear infinite;
    margin-bottom: 12px;
}

.admin-panel-loading .loading-text {
    font-size: 14px;
    color: #fff;
}

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

.admin-panel-messages {
    position: absolute;
    top: 90px;
    right: 40px;
    z-index: 3;
}

.admin-panel-message {
    background: rgba(0, 0, 0, 0.7);
    border-radius: 8px;
    padding: 10px 14px;
    color: #fff;
    font-size: 13px;
    margin-bottom: 8px;
    animation: admin-toast-in 0.3s ease;
}

.admin-panel-message.error {
    background: rgba(255, 107, 107, 0.9);
}

.admin-panel-message.success {
    background: rgba(46, 204, 113, 0.9);
}

@keyframes admin-toast-in {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Light theme adjustments */
html[data-theme='light'] .admin-panel {
    background: #ffffff;
    color: #1a1a1a;
    border-color: rgba(0, 0, 0, 0.08);
}

html[data-theme='light'] .admin-panel-header,
html[data-theme='light'] .admin-panel-tabs,
html[data-theme='light'] .admin-table-wrapper {
    border-color: rgba(0, 0, 0, 0.08);
}

html[data-theme='light'] .admin-panel-stats {
    background: transparent;
}

html[data-theme='light'] .admin-stat-card,
html[data-theme='light'] .admin-table-wrapper {
    background: rgba(0, 0, 0, 0.02);
}

html[data-theme='light'] .admin-table th {
    background: #e0e0e0;
    box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.12);
}

html[data-theme='light'] .admin-panel-loading {
    background: rgba(255, 255, 255, 0.8);
}

html[data-theme='light'] .admin-panel-message {
    background: rgba(40, 40, 40, 0.85);
}

html[data-theme='light'] .admin-panel-message.success {
    background: rgba(46, 204, 113, 0.85);
}

html[data-theme='light'] .admin-panel-message.error {
    background: rgba(255, 99, 99, 0.85);
}

html[data-theme='light'] .admin-badge {
    background: rgba(0, 0, 0, 0.08);
    color: #222;
}

html[data-theme='light'] .admin-badge.super {
    background: rgba(255, 107, 53, 0.15);
    color: #c05423;
}

html[data-theme='light'] .admin-badge.feedback {
    background: rgba(82, 196, 255, 0.18);
    color: #24628a;
}

html[data-theme='light'] .admin-badge.feedback.bug {
    background: rgba(255, 99, 99, 0.2);
    color: #a43232;
}

html[data-theme='light'] .admin-badge.feedback.idea {
    background: rgba(255, 206, 86, 0.25);
    color: #8a6b15;
}

html[data-theme='light'] .admin-badge.feedback.ux {
    background: rgba(46, 204, 113, 0.2);
    color: #1d6a3e;
}

html[data-theme='light'] .admin-panel-tab-btn.active {
    background: rgba(0, 0, 0, 0.08);
    color: #111;
}

html[data-theme='light'] .admin-actions .danger {
    background: rgba(255, 99, 99, 0.18);
    color: #b0262e;
}

html[data-theme='light'] .admin-actions .open {
    background: rgba(82, 196, 255, 0.2);
    color: #245f85;
}

html[data-theme='light'] .admin-refresh-btn {
    border-color: rgba(0, 0, 0, 0.15);
}
