/* ========== ADMIN PANEL STYLES v4.0 ========== */

.admin-panel-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: auto;
}

.admin-panel-modal {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border: 2px solid #00ff88;
    border-radius: 10px;
    width: 95%;
    max-width: 1400px;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: 0 10px 50px rgba(0, 255, 136, 0.3);
    display: flex;
    flex-direction: column;
}

.admin-panel-header {
    background: #0f3460;
    padding: 15px 20px;
    border-bottom: 2px solid #00ff88;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

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

.close-btn {
    background: #ff4444;
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 18px;
    font-weight: bold;
}

.close-btn:hover {
    background: #cc0000;
}

.admin-panel-content {
    flex: 1;
    overflow: auto;
    padding: 20px;
}

/* ========== TABS ========== */

.admin-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    border-bottom: 2px solid #00ff88;
    padding-bottom: 10px;
    flex-wrap: wrap;
}

.admin-tab {
    background: #16213e;
    color: #aaa;
    border: 1px solid #333;
    padding: 10px 20px;
    cursor: pointer;
    border-radius: 5px 5px 0 0;
    transition: all 0.3s;
}

.admin-tab:hover {
    background: #1f2a48;
    color: #00ff88;
}

.admin-tab.active {
    background: #00ff88;
    color: #1a1a2e;
    font-weight: bold;
    border-color: #00ff88;
}

.tab-content {
    min-height: 400px;
}

/* ========== USERS TAB ========== */

.users-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.users-header h3 {
    color: #00ff88;
    margin: 0;
}

.users-filters {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

#userSearch {
    flex: 1;
    padding: 10px;
    background: #16213e;
    border: 1px solid #00ff88;
    color: #00ff88;
    border-radius: 5px;
    font-size: 14px;
}

#roleFilter {
    padding: 10px;
    background: #16213e;
    border: 1px solid #00ff88;
    color: #00ff88;
    border-radius: 5px;
}

.users-table {
    width: 100%;
    border-collapse: collapse;
    background: #16213e;
    border-radius: 5px;
    overflow: hidden;
}

.users-table thead {
    background: #0f3460;
}

.users-table th {
    padding: 12px;
    color: #00ff88;
    text-align: left;
    font-weight: bold;
    border-bottom: 2px solid #00ff88;
}

.users-table td {
    padding: 10px 12px;
    color: #ddd;
    border-bottom: 1px solid #333;
}

.users-table tbody tr:hover {
    background: #1f2a48;
}

.users-table .actions {
    display: flex;
    gap: 5px;
}

/* ========== BUTTONS ========== */

.btn-primary, .btn-success, .btn-danger, .btn-secondary, .btn-sm {
    padding: 8px 15px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s;
}

.btn-primary {
    background: #00ff88;
    color: #1a1a2e;
    font-weight: bold;
}

.btn-primary:hover {
    background: #00cc6e;
}

.btn-success {
    background: #00ff88;
    color: #1a1a2e;
}

.btn-success:hover {
    background: #00cc6e;
}

.btn-danger {
    background: #ff4444;
    color: white;
}

.btn-danger:hover {
    background: #cc0000;
}

.btn-secondary {
    background: #666;
    color: white;
}

.btn-secondary:hover {
    background: #444;
}

.btn-sm {
    padding: 5px 10px;
    font-size: 12px;
    background: #0f3460;
    color: #00ff88;
    border: 1px solid #00ff88;
}

.btn-sm:hover {
    background: #00ff88;
    color: #1a1a2e;
}

/* ========== PENDING TAB ========== */

.pending-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.pending-card {
    background: #16213e;
    border: 1px solid #00ff88;
    border-radius: 5px;
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.pending-info h4 {
    color: #00ff88;
    margin: 0 0 10px 0;
}

.pending-info p {
    color: #aaa;
    margin: 3px 0;
    font-size: 14px;
}

.pending-actions {
    display: flex;
    gap: 10px;
}

/* ========== STATS TAB ========== */

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

.stat-card {
    background: #16213e;
    border: 1px solid #00ff88;
    border-radius: 5px;
    padding: 20px;
    text-align: center;
}

.stat-card h4 {
    color: #aaa;
    margin: 0 0 10px 0;
    font-size: 14px;
}

.stat-number {
    color: #00ff88;
    font-size: 36px;
    font-weight: bold;
    margin: 0;
}

.stats-section {
    background: #16213e;
    border: 1px solid #00ff88;
    border-radius: 5px;
    padding: 20px;
    margin-bottom: 20px;
}

.stats-section h4 {
    color: #00ff88;
    margin: 0 0 15px 0;
}

.stats-section p {
    color: #ddd;
    margin: 5px 0;
}

.role-stats {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.role-stat-item {
    display: flex;
    justify-content: space-between;
    padding: 10px;
    background: #0f3460;
    border-radius: 3px;
}

.role-name {
    color: #aaa;
}

.role-count {
    color: #00ff88;
    font-weight: bold;
}

/* ========== SYSTEM TAB ========== */

.system-section {
    background: #16213e;
    border: 1px solid #00ff88;
    border-radius: 5px;
    padding: 20px;
    margin-bottom: 20px;
}

.system-section h4 {
    color: #00ff88;
    margin: 0 0 15px 0;
}

.system-section p {
    color: #ddd;
    margin: 10px 0;
}

#shardInput {
    padding: 8px;
    background: #0f3460;
    border: 1px solid #00ff88;
    color: #00ff88;
    border-radius: 5px;
    margin-right: 10px;
}

/* ========== AUDIT TAB ========== */

.audit-table {
    width: 100%;
    border-collapse: collapse;
    background: #16213e;
    border-radius: 5px;
    overflow: hidden;
}

.audit-table thead {
    background: #0f3460;
}

.audit-table th {
    padding: 12px;
    color: #00ff88;
    text-align: left;
    font-weight: bold;
    border-bottom: 2px solid #00ff88;
}

.audit-table td {
    padding: 8px 12px;
    color: #ddd;
    border-bottom: 1px solid #333;
    font-size: 13px;
}

.audit-table tbody tr:hover {
    background: #1f2a48;
}

.action-badge {
    background: #0f3460;
    color: #00ff88;
    padding: 3px 8px;
    border-radius: 3px;
    font-size: 12px;
    font-weight: bold;
}

/* ========== DIALOGS ========== */

.dialog-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 20000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dialog {
    background: #16213e;
    border: 2px solid #00ff88;
    border-radius: 10px;
    padding: 25px;
    width: 90%;
    max-width: 500px;
}

.dialog h3 {
    color: #00ff88;
    margin: 0 0 15px 0;
}

.dialog p {
    color: #ddd;
    margin: 10px 0;
}

.dialog-select, .dialog-textarea {
    width: 100%;
    padding: 10px;
    background: #0f3460;
    border: 1px solid #00ff88;
    color: #00ff88;
    border-radius: 5px;
    margin: 10px 0;
    font-family: inherit;
    font-size: 14px;
}

.dialog-textarea {
    min-height: 80px;
    resize: vertical;
}

.dialog-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

/* ========== ERROR MESSAGES ========== */

.error {
    color: #ff4444;
    background: rgba(255, 68, 68, 0.1);
    border: 1px solid #ff4444;
    padding: 15px;
    border-radius: 5px;
    text-align: center;
}

/* ========== RESPONSIVE ========== */

@media (max-width: 768px) {
    .admin-panel-modal {
        width: 100%;
        height: 100%;
        max-height: 100vh;
        border-radius: 0;
    }

    .admin-tabs {
        flex-wrap: wrap;
    }

    .admin-tab {
        flex: 1;
        min-width: 100px;
        font-size: 12px;
        padding: 8px 10px;
    }

    .users-table {
        font-size: 12px;
    }

    .users-table td, .users-table th {
        padding: 8px 5px;
    }

    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }
}

/* ==================== DASHBOARD TAB v4.0 ==================== */

.dashboard-tab {
    padding: 20px;
}

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

.stat-card {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border: 1px solid #00ff88;
    border-radius: 10px;
    padding: 20px;
    display: flex;
    gap: 15px;
    transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 20px rgba(0, 255, 136, 0.3);
}

.stat-icon {
    font-size: 48px;
    line-height: 1;
}

.stat-content {
    flex: 1;
}

.stat-content h4 {
    margin: 0 0 10px 0;
    color: #00ff88;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.stat-number {
    font-size: 36px;
    font-weight: bold;
    color: #fff;
    margin-bottom: 8px;
}

.stat-breakdown {
    font-size: 12px;
    color: #aaa;
    margin-bottom: 8px;
    line-height: 1.4;
}

.stat-footer {
    font-size: 11px;
    color: #00ff88;
    font-weight: 500;
}

/* Quick Actions Panel */
.quick-actions-panel {
    background: #1a1a2e;
    border: 1px solid #00ff88;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 30px;
}

.quick-actions-panel h3 {
    margin: 0 0 15px 0;
    color: #00ff88;
    font-size: 18px;
}

.quick-actions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 10px;
}

.quick-action-btn {
    background: linear-gradient(135deg, #16213e 0%, #1a1a2e 100%);
    border: 1px solid #00ff88;
    color: #00ff88;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.quick-action-btn:hover {
    background: linear-gradient(135deg, #00ff88 0%, #00cc6f 100%);
    color: #0f0f1e;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 255, 136, 0.4);
}

.quick-action-btn:active {
    transform: translateY(0);
}

/* Recent Actions Panel */
.recent-actions-panel {
    background: #1a1a2e;
    border: 1px solid #00ff88;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 30px;
}

.recent-actions-panel h3 {
    margin: 0 0 15px 0;
    color: #00ff88;
    font-size: 18px;
}

.recent-actions-list {
    max-height: 400px;
    overflow-y: auto;
}

.action-item {
    display: flex;
    gap: 15px;
    padding: 12px;
    margin-bottom: 10px;
    background: #16213e;
    border-left: 3px solid #00ff88;
    border-radius: 5px;
    transition: background 0.2s;
}

.action-item:hover {
    background: #1a2840;
}

.action-icon {
    font-size: 24px;
    line-height: 1;
}

.action-details {
    flex: 1;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.action-text {
    color: #ddd;
    font-size: 13px;
}

.action-text strong {
    color: #00ff88;
}

.action-time {
    color: #888;
    font-size: 11px;
    white-space: nowrap;
}

/* System Status Panel */
.system-status-panel {
    background: #1a1a2e;
    border: 1px solid #00ff88;
    border-radius: 10px;
    padding: 20px;
}

.system-status-panel h3 {
    margin: 0 0 15px 0;
    color: #00ff88;
    font-size: 18px;
}

.status-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.status-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    background: #16213e;
    border-radius: 5px;
}

.status-label {
    color: #aaa;
    font-size: 13px;
    font-weight: 500;
}

.status-value {
    font-size: 13px;
    font-weight: 600;
}

.status-healthy {
    color: #00ff88;
}

.status-warning {
    color: #ffa500;
}

.status-error {
    color: #ff4444;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .quick-actions-grid {
        grid-template-columns: 1fr;
    }
    
    .status-grid {
        grid-template-columns: 1fr;
    }
    
    .action-details {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }
}
